style: Move __...__ methods after constructors

This commit is contained in:
rlaphoenix 2024-04-14 02:59:20 +01:00
parent 23485bc820
commit 642ad393b6
2 changed files with 19 additions and 19 deletions

View File

@ -76,6 +76,17 @@ class Audio(Track):
self.joc = joc
self.descriptive = bool(descriptive)
def __str__(self) -> str:
return " | ".join(filter(bool, [
"AUD",
f"[{self.codec.value}]",
str(self.channels or "?") + (f" (JOC {self.joc})" if self.joc else ""),
f"{self.bitrate // 1000 if self.bitrate else '?'} kb/s",
str(self.language),
self.get_track_name(),
self.edition
]))
@staticmethod
def parse_channels(channels: Union[str, int, float]) -> float:
"""
@ -109,16 +120,5 @@ class Audio(Track):
track_name += flag
return track_name or None
def __str__(self) -> str:
return " | ".join(filter(bool, [
"AUD",
f"[{self.codec.value}]",
str(self.channels or "?") + (f" (JOC {self.joc})" if self.joc else ""),
f"{self.bitrate // 1000 if self.bitrate else '?'} kb/s",
str(self.language),
self.get_track_name(),
self.edition
]))
__all__ = ("Audio",)

View File

@ -139,6 +139,14 @@ class Subtitle(Track):
# Called after Track has been converted to another format
self.OnConverted: Optional[Callable[[Subtitle.Codec], None]] = None
def __str__(self) -> str:
return " | ".join(filter(bool, [
"SUB",
f"[{self.codec.value}]",
str(self.language),
self.get_track_name()
]))
def get_track_name(self) -> Optional[str]:
"""Return the base Track Name."""
track_name = super().get_track_name() or ""
@ -525,13 +533,5 @@ class Subtitle(Track):
stdout=subprocess.DEVNULL
)
def __str__(self) -> str:
return " | ".join(filter(bool, [
"SUB",
f"[{self.codec.value}]",
str(self.language),
self.get_track_name()
]))
__all__ = ("Subtitle",)