Skip to content

Commit

Permalink
Check ignore_ids in MediaFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Dec 26, 2024
1 parent 54c7a8a commit 75193af
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion plextraktsync/media/MediaFactory.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING

from plexapi.exceptions import PlexApiException
from requests import RequestException
from trakt.errors import TraktException

from plextraktsync.factory import logging
from plextraktsync.factory import factory, logging
from plextraktsync.media.Media import Media

if TYPE_CHECKING:
Expand All @@ -28,7 +29,19 @@ def __init__(self, plex: PlexApi, trakt: TraktApi):
self.plex = plex
self.trakt = trakt

@property
def config(self):
return factory.config

@cached_property
def ignore_ids(self):
return self.config.ignore_ids

def resolve_any(self, pm: PlexLibraryItem, show: Media = None) -> Media | None:
if pm.key in self.ignore_ids:
self.logger.error(f"Skipping {pm} because listed in ignore_ids")
return None

try:
guids = pm.guids
except (PlexApiException, RequestException) as e:
Expand Down

0 comments on commit 75193af

Please sign in to comment.