@@ -160,11 +160,19 @@ def process_image(
160160 set_data .username ,
161161 )
162162 should_log = False
163- mediux .download_image (file_id = file .id , output = image_file )
163+ try :
164+ mediux .download_image (file_id = file .id , output = image_file )
165+ except ServiceError as err :
166+ LOGGER .error ("[Mediux] %s" , err )
167+ return
164168
165- success = service .upload_image (
166- object_id = obj .id , image_file = image_file , kometa_integration = kometa_integration
167- )
169+ try :
170+ success = service .upload_image (
171+ object_id = obj .id , image_file = image_file , kometa_integration = kometa_integration
172+ )
173+ except ServiceError as err :
174+ LOGGER .error ("[%s] %s" , type (service ).__name__ , err )
175+ success = False
168176 setattr (obj , uploaded_attr , success )
169177 if success :
170178 service .cache .insert (
@@ -190,7 +198,12 @@ def process_image(
190198 filename = "backdrop.jpg" ,
191199 )
192200 if isinstance (entry , Show ) and isinstance (set_data , ShowSet ):
193- for season in entry .seasons or service .list_seasons (show_id = entry .id ):
201+ try :
202+ seasons = service .list_seasons (show_id = entry .id )
203+ except ServiceError as err :
204+ LOGGER .error ("[%s] %s" , type (service ).__name__ , err )
205+ seasons = []
206+ for season in seasons :
194207 entry .seasons .append (season )
195208 mediux_season = next (
196209 (x for x in set_data .show .seasons if x .number == season .number ), None
@@ -204,9 +217,12 @@ def process_image(
204217 parent = slugify (value = entry .display_name ),
205218 filename = f"s{ season .number :02} .jpg" ,
206219 )
207- for episode in season .episodes or service .list_episodes (
208- show_id = entry .id , season_id = season .id
209- ):
220+ try :
221+ episodes = service .list_episodes (show_id = entry .id , season_id = season .id )
222+ except ServiceError as err :
223+ LOGGER .error ("[%s] %s" , type (service ).__name__ , err )
224+ episodes = []
225+ for episode in episodes :
210226 season .episodes .append (episode )
211227 mediux_episode = next (
212228 (x for x in mediux_season .episodes if x .number == episode .number ), None
@@ -221,7 +237,12 @@ def process_image(
221237 filename = f"s{ season .number :02} e{ episode .number :02} .jpg" ,
222238 )
223239 elif isinstance (entry , Collection ) and isinstance (set_data , CollectionSet ):
224- for movie in service .list_collection_movies (collection_id = entry .id ):
240+ try :
241+ movies = service .list_collection_movies (collection_id = entry .id )
242+ except ServiceError as err :
243+ LOGGER .error ("[%s] %s" , type (service ).__name__ , err )
244+ movies = []
245+ for movie in movies :
225246 entry .movies .append (movie )
226247 mediux_movie = next (
227248 (x for x in set_data .collection .movies if x .id == movie .tmdb_id ), None
0 commit comments