INNER CODE UNIT · Python
get_operator
Casvt/Plex-scripts · library_management/recent_episode_maintainer.py:119
def get_operator(
extractor: Callable[[TMedia], Any],
operator: str,
value: Any
) -> Callable[[TMedia], bool]:
if operator == '<':
def op(media: TMedia) -> bool:
v = extractor(media)
if v is None:
return False
return v <= value
elif operator == '>':
def op(media: TMedia) -> bool:
v = extractor(media)
if v is None:
return False
return v >= value