From b17a2a5f4a5712d00dfb2c8be3c2062072c2aa61 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Fri, 23 Jun 2023 13:21:04 -0400 Subject: [PATCH] Add debugging changes --- libs/subliminal_patch/core.py | 8 ++++---- libs/subliminal_patch/subtitle.py | 3 ++- libs/subzero/language.py | 4 ++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index cd5bc5561..8be54828b 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -161,7 +161,7 @@ class _LanguageEquals(list): for equals in self: from_, to_ = equals if to_ in items: - logger.debug("Translating %s -> %s", to_, from_) + logger.debug("Translating %r -> %r", to_, from_) translated.add(from_) if translated == items: @@ -182,7 +182,7 @@ class _LanguageEquals(list): for equals in self: from_, to_ = equals 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_) new_items = items.copy() @@ -194,7 +194,7 @@ class _LanguageEquals(list): for equals in self: from_, to_ = equals 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_ break @@ -330,7 +330,7 @@ class SZProviderPool(ProviderPool): :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: languages_search_base = self.language_hook(provider) diff --git a/libs/subliminal_patch/subtitle.py b/libs/subliminal_patch/subtitle.py index 406baed70..529e99019 100644 --- a/libs/subliminal_patch/subtitle.py +++ b/libs/subliminal_patch/subtitle.py @@ -76,7 +76,8 @@ class Subtitle(Subtitle_): self.use_original_format = original_format 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 def text(self): diff --git a/libs/subzero/language.py b/libs/subzero/language.py index 199856704..3d556c0e1 100644 --- a/libs/subzero/language.py +++ b/libs/subzero/language.py @@ -114,6 +114,10 @@ class Language(Language_): def __str__(self): 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 def basename(self): return super(Language, self).__str__()