Improve version comparison

This commit is contained in:
Nathan Thomas 2022-06-14 12:35:55 -07:00
parent 26da00f1a2
commit 15c826d03e
3 changed files with 13 additions and 4 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "streamrip"
version = "1.9.4"
version = "1.9.6"
description = "A fast, all-in-one music ripper for Qobuz, Deezer, Tidal, and SoundCloud"
authors = ["nathom <nathanthomas707@gmail.com>"]
license = "GPL-3.0-only"

View file

@ -20,7 +20,7 @@ logging.basicConfig(level="WARNING")
logger = logging.getLogger("streamrip")
outdated = False
newest_version = __version__
newest_version: Optional[str] = None
class DownloadCommand(Command):
@ -126,6 +126,7 @@ class DownloadCommand(Command):
self.line("<error>Must pass arguments. See </><cmd>rip url -h</cmd>.")
update_check.join()
if outdated:
import re
import subprocess
@ -814,7 +815,15 @@ def is_outdated():
global newest_version
r = requests.get("https://pypi.org/pypi/streamrip/json").json()
newest_version = r["info"]["version"]
outdated = newest_version != __version__
# Compare versions
curr_version_parsed = map(int, __version__.split("."))
newest_version_parsed = map(int, newest_version.split("."))
outdated = False
for c, n in zip(curr_version_parsed, newest_version_parsed):
outdated = c < n
if c != n:
break
def main():

View file

@ -1,5 +1,5 @@
"""streamrip: the all in one music downloader."""
__version__ = "1.9.4"
__version__ = "1.9.6"
from . import clients, constants, converter, downloadtools, media