mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-25 04:24:49 -04:00
Add version parser
Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
parent
3bd9c815f3
commit
1e1e3c7062
1 changed files with 21 additions and 0 deletions
|
@ -361,3 +361,24 @@ def get_container(quality: int, source: str) -> str:
|
||||||
return "AAC"
|
return "AAC"
|
||||||
|
|
||||||
return "MP3"
|
return "MP3"
|
||||||
|
|
||||||
|
|
||||||
|
class Version:
|
||||||
|
def __init__(self, version: str):
|
||||||
|
self.value = tuple(map(int, version.split(".")))
|
||||||
|
|
||||||
|
def __gt__(self, other) -> bool:
|
||||||
|
assert isinstance(other, Version)
|
||||||
|
for v1, v2 in zip(self.value, other.value):
|
||||||
|
if v1 > v2:
|
||||||
|
return True
|
||||||
|
elif v1 < v2:
|
||||||
|
return False
|
||||||
|
return False
|
||||||
|
|
||||||
|
def __lt__(self, other) -> bool:
|
||||||
|
return not self.__gt__(other) and not self.__eq__(other)
|
||||||
|
|
||||||
|
def __eq__(self, other) -> bool:
|
||||||
|
assert isinstance(other, Version)
|
||||||
|
return all(v1 == v2 for v1, v2 in zip(self.value, other.value))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue