Use flatten_list decorator for movie_sections, show_sections
MODIFY
plextraktsync/plex_api.py
plextraktsync/plex_api.py
@@ -433,27 +433,23 @@ def __init__(self, plex: PlexServer):
def plex_base_url(self):
return f"https://app.plex.tv/desktop/#!/server/{self.plex.machineIdentifier}"
- def movie_sections(self, library=None):
- result = []
+ @flatten_list
+ def movie_sections(self, library=None) -> List[PlexLibrarySection]:
for section in self.library_sections:
if not type(section) is MovieSection:
continue
if library and section.title != library:
continue
- result.append(PlexLibrarySection(section))
-
- return result
+ yield PlexLibrarySection(section)
- def show_sections(self, library=None):
- result = []
+ @flatten_list
+ def show_sections(self, library=None) -> List[PlexLibrarySection]:
for section in self.library_sections:
if not type(section) is ShowSection:
continue
if library and section.title != library:
continue
- result.append(PlexLibrarySection(section))
-
- return result
+ yield PlexLibrarySection(section)
@memoize
@nocache

Use flatten_list decorator for movie_sections, show_sections