Skip to content

Commit

Permalink
style(Audio): Move __str__ method after constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
rlaphoenix committed Apr 14, 2024
1 parent 23485bc commit e7c4b9e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions devine/core/tracks/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,17 @@ def __init__(self, *args: Any, codec: Audio.Codec, bitrate: Union[str, int, floa
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:
"""
Expand Down Expand Up @@ -109,16 +120,5 @@ def get_track_name(self) -> Optional[str]:
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",)

0 comments on commit e7c4b9e

Please sign in to comment.