forked from DRMTalks/devine
Implement `__add__` to Tracks class
This commit is contained in:
parent
eef397f2e8
commit
0c20160ddc
|
@ -51,6 +51,12 @@ class Tracks:
|
|||
def __len__(self) -> int:
|
||||
return len(self.videos) + len(self.audio) + len(self.subtitles)
|
||||
|
||||
def __add__(self, other: Tracks) -> Tracks:
|
||||
if not isinstance(other, Tracks):
|
||||
raise TypeError(f"Cannot only add {Tracks} objects with one another, not {type(other)}")
|
||||
|
||||
return Tracks(list(self) + list(other))
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return "{name}({items})".format(
|
||||
name=self.__class__.__name__,
|
||||
|
|
Loading…
Reference in New Issue