You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bazarr/libs/plex/objects/session.py

22 lines
538 B

from plex.core.helpers import to_iterable
from plex.objects.library.container import MediaContainer
class SessionContainer(MediaContainer):
filter_passes = lambda _, allowed, value: allowed is None or value in allowed
def filter(self, keys=None):
keys = to_iterable(keys)
for item in self:
if not self.filter_passes(keys, item.session.key):
continue
yield item
def get(self, key):
for item in self.filter(key):
return item
return None