@@ -68,7 +68,7 @@ def run(self) -> Generator[MediaItem, None, None]:
68
68
return
69
69
70
70
plex_items : set [str ] = set (watchlist_items ) | set (rss_items )
71
- items_to_yield : list [MediaItem ] = [MediaItem ({"imdb_id" : imdb_id , "requested_by" : self .key }) for imdb_id in plex_items if imdb_id .startswith ("tt" )]
71
+ items_to_yield : list [MediaItem ] = [MediaItem ({"imdb_id" : imdb_id , "requested_by" : self .key }) for imdb_id in plex_items if imdb_id and imdb_id .startswith ("tt" )]
72
72
non_existing_items = _filter_existing_items (items_to_yield )
73
73
new_non_recurring_items = [item for item in non_existing_items if item .imdb_id not in self .recurring_items and isinstance (item , MediaItem )]
74
74
self .recurring_items .update ([item .imdb_id for item in new_non_recurring_items ])
@@ -86,7 +86,7 @@ def _get_items_from_rss(self) -> list[str]:
86
86
response = self .session .get (rss_url + "?format=json" , timeout = 60 )
87
87
for _item in response .json ().get ("items" , []):
88
88
imdb_id = self ._extract_imdb_ids (_item .get ("guids" , []))
89
- if imdb_id .startswith ("tt" ):
89
+ if imdb_id and imdb_id .startswith ("tt" ):
90
90
rss_items .append (imdb_id )
91
91
else :
92
92
logger .log ("NOT_FOUND" , f"Failed to extract IMDb ID from { _item ['title' ]} " )
@@ -102,7 +102,7 @@ def _get_items_from_watchlist(self) -> list[str]:
102
102
try :
103
103
if hasattr (item , "guids" ) and item .guids :
104
104
imdb_id : str = next ((guid .id .split ("//" )[- 1 ] for guid in item .guids if guid .id .startswith ("imdb://" )), "" )
105
- if imdb_id .startswith ("tt" ):
105
+ if imdb_id and imdb_id .startswith ("tt" ):
106
106
watchlist_items .append (imdb_id )
107
107
else :
108
108
logger .log ("NOT_FOUND" , f"Unable to extract IMDb ID from { item .title } ({ item .year } ) with data id: { imdb_id } " )
@@ -115,7 +115,7 @@ def _get_items_from_watchlist(self) -> list[str]:
115
115
def _extract_imdb_ids (self , guids : list ) -> str | None :
116
116
"""Helper method to extract IMDb IDs from guids"""
117
117
for guid in guids :
118
- if guid .startswith ("imdb://" ):
118
+ if guid and guid .startswith ("imdb://" ):
119
119
imdb_id = guid .split ("//" )[- 1 ]
120
120
if imdb_id :
121
121
return imdb_id
0 commit comments