Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

AttributeError: 'list' object has no attribute 'episode' #156

Open
zididadaday opened this issue Jan 6, 2022 · 1 comment
Open

AttributeError: 'list' object has no attribute 'episode' #156

zididadaday opened this issue Jan 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@zididadaday
Copy link

I got the same issue as in #120 today. Took me a while before I figured it out.
I installed this today and funny how I was testing with the show I am currently watching - any other show would probably have been fine.

If you try ask Plex Assistant to play a specific episode and season of a show, you might come across this issue.
If your search for a specific episode and season is for a series name which gives more than one match, you will get this error.
As an example, if you happen to have both shows below:

Dexter
Dexter: New Blood

And search for "season 1 episode 5 of Dexter", instead of an exact show match it will return two show IDs, and then everything breaks.

I printed the values from media list so you can see what the search results are for the show lookup, which are:

2022-01-06 20:44:17 DEBUG (SyncWorker_4) [custom_components.plex_assistant.const] <Show:12345:Dexter>
2022-01-06 20:44:17 DEBUG (SyncWorker_4) [custom_components.plex_assistant.const] <Show:12346:Dexter:-New-Blood>

and the media list object only has below attributes:
2022-01-06 20:44:17 DEBUG (SyncWorker_4) [custom_components.plex_assistant.const] ['__add__', '__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']

If you search for a show that only returns 1 match as in my other example below, you get the correct attributes for media list including the episode attribute and everything works as expected:

2022-01-06 20:39:26 DEBUG (SyncWorker_6) [custom_components.plex_assistant.const] <Show:12347:Breaking-Bad>

2022-01-06 20:39:26 DEBUG (SyncWorker_6) [custom_components.plex_assistant.const] ['METADATA_TYPE', 'TAG', 'TYPE', '_INCLUDES', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_autoReload', '_buildDetailsKey', '_buildItem', '_buildItemOrNone', '_castAttrValue', '_checkAttrs', '_clean', '_data', '_defaultSyncTitle', '_details_key', '_edit', '_edit_tags', '_getAttrOperator', '_getAttrValue', '_initpath', '_isChildOf', '_loadData', '_manuallyLoadXML', '_parent', '_reload', '_server', 'actors', 'addCollection', 'addGenre', 'addLabel', 'addedAt', 'analyze', 'art', 'artBlurHash', 'artUrl', 'arts', 'audienceRating', 'audienceRatingImage', 'augmentation', 'autoDeletionItemPolicyUnwatchedLibrary', 'autoDeletionItemPolicyWatchedLibrary', 'banner', 'bannerUrl', 'banners', 'childCount', 'collections', 'contentRating', 'defaultAdvanced', 'delete', 'download', 'duration', 'edit', 'editAdvanced', 'episode', 'episodeSort', 'episodes', 'fetchItem', 'fetchItems', 'fields', 'findItems', 'firstAttr', 'fixMatch', 'flattenSeasons', 'genres', 'get', 'guid', 'guids', 'history', 'hubs', 'index', 'isFullObject', 'isPartialObject', 'isWatched', 'key', 'labels', 'languageOverride', 'lastRatedAt', 'lastViewedAt', 'leafCount', 'librarySectionID', 'librarySectionKey', 'librarySectionTitle', 'listAttrs', 'listType', 'locations', 'lockArt', 'lockBanner', 'lockPoster', 'markUnwatched', 'markWatched', 'matches', 'merge', 'network', 'onDeck', 'optimize', 'originalTitle', 'originallyAvailableAt', 'posterUrl', 'posters', 'preference', 'preferences', 'rate', 'rating', 'ratingKey', 'refresh', 'reload', 'removeCollection', 'removeGenre', 'removeLabel', 'removeSubtitles', 'roles', 'season', 'seasons', 'section', 'setArt', 'setBanner', 'setPoster', 'showOrdering', 'similar', 'split', 'studio', 'subtitleStreams', 'summary', 'sync', 'tagline', 'theme', 'thumb', 'thumbBlurHash', 'thumbUrl', 'title', 'titleSort', 'type', 'unlockArt', 'unlockBanner', 'unlockPoster', 'unmatch', 'unwatched', 'updatedAt', 'uploadArt', 'uploadBanner', 'uploadPoster', 'uploadSubtitles', 'url', 'useOriginalTitle', 'userRating', 'viewCount', 'viewedLeafCount', 'watched', 'year']

Here is the error message for the issue:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1511, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1534, in _execute_service
await self._hass.async_add_executor_job(handler.job.target, service_call)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/plex_assistant/__init__.py", line 132, in handle_input
media, offset = filter_media(pa, command, media, library)
File "/config/custom_components/plex_assistant/helpers.py", line 222, in filter_media
media = media.episode(season=int(command["season"] or 1), episode=int(command["episode"]))
AttributeError: 'list' object has no attribute 'episode'
@zididadaday zididadaday added the bug Something isn't working label Jan 6, 2022
@github-actions
Copy link

github-actions bot commented Jan 6, 2022

Important:

Issues that don't provide the information requested in the troubleshooting docs may not get a reply and may be closed until the info is provided. Please, include as much of the requested info as possible so that I can replicate and investigate your issue.

When pasting in your config/code/errors always place 3 backticks ``` above the first line and after the last line. Doing this will format it correctly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant