Add debugging changes

pull/2182/head v1.2.2
Vitiko 2 years ago
parent f371d0585b
commit b17a2a5f4a

@ -161,7 +161,7 @@ class _LanguageEquals(list):
for equals in self: for equals in self:
from_, to_ = equals from_, to_ = equals
if to_ in items: if to_ in items:
logger.debug("Translating %s -> %s", to_, from_) logger.debug("Translating %r -> %r", to_, from_)
translated.add(from_) translated.add(from_)
if translated == items: if translated == items:
@ -182,7 +182,7 @@ class _LanguageEquals(list):
for equals in self: for equals in self:
from_, to_ = equals from_, to_ = equals
if from_ in items: if from_ in items:
logger.debug("Adding %s to %s item(s) set", to_, len(items)) logger.debug("Adding %r to %s item(s) set", to_, len(items))
to_add.append(to_) to_add.append(to_)
new_items = items.copy() new_items = items.copy()
@ -194,7 +194,7 @@ class _LanguageEquals(list):
for equals in self: for equals in self:
from_, to_ = equals from_, to_ = equals
if from_ == subtitle.language: if from_ == subtitle.language:
logger.debug("Updating language for %s (to %s)", subtitle, to_) logger.debug("Updating language for %r (to %r)", subtitle, to_)
subtitle.language = to_ subtitle.language = to_
break break
@ -330,7 +330,7 @@ class SZProviderPool(ProviderPool):
:rtype: list of :class:`~subliminal.subtitle.Subtitle` or None :rtype: list of :class:`~subliminal.subtitle.Subtitle` or None
""" """
logger.debug("Languages requested: %s", languages) logger.debug("Languages requested: %r", languages)
if self.language_hook: if self.language_hook:
languages_search_base = self.language_hook(provider) languages_search_base = self.language_hook(provider)

@ -76,7 +76,8 @@ class Subtitle(Subtitle_):
self.use_original_format = original_format self.use_original_format = original_format
def __repr__(self): def __repr__(self):
return '<%s %r [%s:%s]>' % (self.__class__.__name__, self.page_link, self.language, self._guessed_encoding) r_info = str(self.release_info or "").replace("\n", " | ").strip()
return f"<{self.__class__.__name__}: {r_info} [{repr(self.language)}]>"
@property @property
def text(self): def text(self):

@ -114,6 +114,10 @@ class Language(Language_):
def __str__(self): def __str__(self):
return super(Language, self).__str__() + (":forced" if self.forced else "") return super(Language, self).__str__() + (":forced" if self.forced else "")
def __repr__(self):
info = ";".join(f"{k}={v}" for k, v in vars(self).items() if v)
return f"<{self.__class__.__name__}: {info}>"
@property @property
def basename(self): def basename(self):
return super(Language, self).__str__() return super(Language, self).__str__()

Loading…
Cancel
Save