-
Notifications
You must be signed in to change notification settings - Fork 150
Fix: Handle empty Kodi media details by setting curVideoInfo to `No…
#707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -86,23 +86,26 @@ def transitionCheck(self, isSeek: bool = False) -> None: | |||||||||||||
| self.videosToRate.append(self.curVideoInfo) | ||||||||||||||
| # update current information | ||||||||||||||
| self.curMPEpisode = epIndex | ||||||||||||||
| self.curVideoInfo = kodiUtilities.kodiRpcToTraktMediaObject( | ||||||||||||||
| "episode", | ||||||||||||||
| kodiUtilities.getEpisodeDetailsFromKodi( | ||||||||||||||
| self.curVideo["multi_episode_data"][ | ||||||||||||||
| self.curMPEpisode | ||||||||||||||
| ], | ||||||||||||||
| [ | ||||||||||||||
| "showtitle", | ||||||||||||||
| "season", | ||||||||||||||
| "episode", | ||||||||||||||
| "tvshowid", | ||||||||||||||
| "uniqueid", | ||||||||||||||
| "file", | ||||||||||||||
| "playcount", | ||||||||||||||
| ], | ||||||||||||||
| ), | ||||||||||||||
| episode_details = kodiUtilities.getEpisodeDetailsFromKodi( | ||||||||||||||
| self.curVideo["multi_episode_data"][ | ||||||||||||||
| self.curMPEpisode | ||||||||||||||
| ], | ||||||||||||||
| [ | ||||||||||||||
| "showtitle", | ||||||||||||||
| "season", | ||||||||||||||
| "episode", | ||||||||||||||
| "tvshowid", | ||||||||||||||
| "uniqueid", | ||||||||||||||
| "file", | ||||||||||||||
| "playcount", | ||||||||||||||
| ], | ||||||||||||||
| ) | ||||||||||||||
| if episode_details: | ||||||||||||||
| self.curVideoInfo = kodiUtilities.kodiRpcToTraktMediaObject( | ||||||||||||||
| "episode", episode_details | ||||||||||||||
| ) | ||||||||||||||
| else: | ||||||||||||||
| self.curVideoInfo = None | ||||||||||||||
|
||||||||||||||
| self.curVideoInfo = None | |
| logger.warning( | |
| "Failed to get episode details for multi-part " | |
| "episode index %s; keeping existing curVideoInfo.", | |
| self.curMPEpisode, | |
| ) |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When movieDetailsKodi is empty, self.curVideoInfo is set to None but playback continues. Later in this method there are conditions like "ids" in self.curVideoInfo that will raise TypeError when self.curVideoInfo is None (e.g., when scrobbling is disabled but rating is enabled). Consider aborting the playbackStarted flow (similar to the episode invalid-ID path) or ensure subsequent checks are guarded with self.curVideoInfo being a dict before using membership tests.
| self.curVideoInfo = None | |
| # Ensure curVideoInfo remains a dict so membership tests like | |
| # `"ids" in self.curVideoInfo` do not raise TypeError. | |
| self.curVideoInfo = {} |
Copilot
AI
Mar 11, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result can be None here (e.g., self.__scrobble("start") returns None when self.curVideoInfo is missing), but it is passed to __preFetchUserRatings which is annotated as result: Dict. Consider normalizing result to {} (or updating the type hints to Optional[Dict]) to keep the types consistent and avoid future misuse of result as a dict in this block.
Uh oh!
There was an error while loading. Please reload this page.