From b6777bc26ea2faafa4d6a8eee8aa791a8736780a Mon Sep 17 00:00:00 2001 From: Vitiko Date: Thu, 22 Jun 2023 16:50:42 -0400 Subject: [PATCH] Debugging: update subtitle and language representations This will help making the logs more comprehensible. --- libs/subliminal_patch/subtitle.py | 4 ++-- libs/subzero/language.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/subliminal_patch/subtitle.py b/libs/subliminal_patch/subtitle.py index a7140e958..9c8094b86 100644 --- a/libs/subliminal_patch/subtitle.py +++ b/libs/subliminal_patch/subtitle.py @@ -76,8 +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 self.id).replace("\n", " | ").strip() + return f"<{self.__class__.__name__}: {r_info} [{self.language}]>" @property def text(self): diff --git a/libs/subzero/language.py b/libs/subzero/language.py index 199856704..c7f3c3a2d 100644 --- a/libs/subzero/language.py +++ b/libs/subzero/language.py @@ -112,7 +112,8 @@ class Language(Language_): bool(self.hi) == bool(other.hi)) def __str__(self): - return super(Language, self).__str__() + (":forced" if self.forced else "") + info = ";".join(f"{k}={v}" for k, v in vars(self).items() if v) + return f"<{self.__class__.__name__}: {info}>" @property def basename(self):