Skip to content

Commit

Permalink
Merge pull request #12 from sirstudly/allow_empty_plex_lib
Browse files Browse the repository at this point in the history
Removes requirement to have at least one item in each Plex library
  • Loading branch information
funkypenguin authored Nov 15, 2024
2 parents e3ec7f2 + d0d04c8 commit 78f312b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 6 additions & 4 deletions content/services/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,21 +801,23 @@ def __new__(self,silent=False):
if section == '':
continue
section_response = []
section_title = ''
for type in types:
url = library.url + '/library/sections/' + section + '/all?type=' + type + '&X-Plex-Token=' + users[0][1]
response = get(url)
if hasattr(response, 'MediaContainer'):
if hasattr(response.MediaContainer, 'Metadata'):
for element in response.MediaContainer.Metadata:
section_response += [classes.media(element)]
if hasattr(response.MediaContainer, 'librarySectionTitle'):
section_title = response.MediaContainer.librarySectionTitle
if len(section_response) == 0:
ui_print("[plex error]: couldnt reach local plex library section '" + section + "' at server address: " + library.url + " - or this library really is empty.")
list_ = []
break
ui_print(f"[plex error]: local plex library section [{section}]: {section_title} at server address: {library.url} is empty!")
continue
else:
list_ += section_response
if len(list_) == 0:
ui_print("[plex error]: Your library seems empty. To prevent unwanted behaviour, no further downloads will be started. If your library really is empty, please add at least one media item manually.")
ui_print("[plex error]: No library items were found.")
shows = {}
seasons = {}
for item in list_:
Expand Down
2 changes: 0 additions & 2 deletions ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ def threaded(stop):
ui_print("couldnt sort monitored media by newest, using default order.", ui_settings.debug)
library = content.classes.library()[0]()
timeout_counter = 0
if len(library) == 0:
continue
ui_print('checking new content ...')
t0 = time.time()
for element in unique(watchlists):
Expand Down

0 comments on commit 78f312b

Please sign in to comment.