Skip to content

Commit

Permalink
[FIX] Prevent checking all libraries while searching downloaded conte…
Browse files Browse the repository at this point in the history
…nt. (#69)
  • Loading branch information
giuseppe99barchetta authored Oct 29, 2024
1 parent e0cfca6 commit c22aea8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api_service/services/plex/plex_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,11 @@ async def get_all_library_items(self):
:return: A dictionary of items organized by library name.
"""
results_by_library = {}
libraries = await self.get_libraries()

if self.library_ids:
libraries = [{'key': library_id, 'title': f'Library {index}'} for index, library_id in enumerate(self.library_ids)]
else:
libraries = await self.get_libraries()

if not libraries:
self.logger.error("No libraries found.")
Expand Down Expand Up @@ -248,7 +252,8 @@ async def _fetch_library_items(self, session, library, results_by_library):
processed_items.append(item)

results_by_library[library_type] = processed_items
self.logger.info(f"Retrieved {len(processed_items)} items in {library_name} with TMDB IDs")
self.logger.info(f"Retrieved {len(processed_items)} items in {library_type} with TMDB IDs")

else:
self.logger.error(f"Expected list for items, got {type(items)}")
else:
Expand Down

0 comments on commit c22aea8

Please sign in to comment.