Add default attribute to Subtitle

This commit is contained in:
Vitiko 2021-12-13 15:41:46 -04:00
parent a67da7dd9e
commit 718bd2f8b9
2 changed files with 11 additions and 10 deletions

View File

@ -50,6 +50,8 @@ class Subtitle(object):
#: Encoding to decode with when accessing :attr:`text` #: Encoding to decode with when accessing :attr:`text`
self.encoding = None self.encoding = None
self.release_info = None
# validate the encoding # validate the encoding
if encoding: if encoding:
try: try:

View File

@ -187,16 +187,15 @@ class SZProviderPool(ProviderPool):
if (str(provider), str(s.id)) in self.blacklist: if (str(provider), str(s.id)) in self.blacklist:
logger.info("Skipping blacklisted subtitle: %s", s) logger.info("Skipping blacklisted subtitle: %s", s)
continue continue
if hasattr(s, 'release_info'): if s.release_info is not None:
if s.release_info is not None: if any([x for x in self.ban_list["must_not_contain"]
if any([x for x in self.ban_list["must_not_contain"] if re.search(x, s.release_info, flags=re.IGNORECASE) is not None]):
if re.search(x, s.release_info, flags=re.IGNORECASE) is not None]): logger.info("Skipping subtitle because release name contains prohibited string: %s", s)
logger.info("Skipping subtitle because release name contains prohibited string: %s", s) continue
continue if any([x for x in self.ban_list["must_contain"]
if any([x for x in self.ban_list["must_contain"] if re.search(x, s.release_info, flags=re.IGNORECASE) is None]):
if re.search(x, s.release_info, flags=re.IGNORECASE) is None]): logger.info("Skipping subtitle because release name does not contains required string: %s", s)
logger.info("Skipping subtitle because release name does not contains required string: %s", s) continue
continue
if s.id in seen: if s.id in seen:
continue continue
s.plex_media_fps = float(video.fps) if video.fps else None s.plex_media_fps = float(video.fps) if video.fps else None