mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-30 19:46:25 +00:00
21 lines
538 B
Python
21 lines
538 B
Python
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
|