Skip to content

Commit

Permalink
Remove unused pager related code from PlexLibrarySection
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Jan 15, 2024
1 parent f9bfc2f commit eee2464
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions plextraktsync/plex/PlexLibrarySection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

from typing import TYPE_CHECKING

from plexapi import X_PLEX_CONTAINER_SIZE
from plexapi.exceptions import NotFound

from plextraktsync.decorators.retry import retry
from plextraktsync.mixin.RichMarkup import RichMarkup
from plextraktsync.plex.PlexLibraryItem import PlexLibraryItem

if TYPE_CHECKING:
from typing import Literal
Expand Down Expand Up @@ -62,38 +59,5 @@ def find_by_id(self, id: str | int) -> PlexMedia | None:
except NotFound:
return None

def search_episodes(self):
if self.section.type == "show":
from plextraktsync.plex.PlexSectionPager import PlexSectionPager

return PlexSectionPager(section=self.section, plex=self.plex)

return None

def all(self, max_items: int):
libtype = self.section.TYPE
key = self.section._buildSearchKey(libtype=libtype, returnKwargs=False)
start = 0
size = X_PLEX_CONTAINER_SIZE

while True:
items = self.fetch_items(key, size, start)
if not len(items):
break

yield from items

start += size
if start > max_items:
break

@retry()
def fetch_items(self, key: str, size: int, start: int):
return self.section.fetchItems(key, container_start=start, container_size=size, maxresults=size)

def items(self, max_items: int):
for item in self.all(max_items):
yield PlexLibraryItem(item, plex=self.plex)

def __repr__(self):
return f"<{self.__class__.__name__}:{self.type}:{self.title}>"

0 comments on commit eee2464

Please sign in to comment.