From 15c826d03e25a34ef10511fc10fac0afb36c547b Mon Sep 17 00:00:00 2001 From: Nathan Thomas Date: Tue, 14 Jun 2022 12:35:55 -0700 Subject: [PATCH] Improve version comparison --- pyproject.toml | 2 +- rip/cli.py | 13 +++++++++++-- streamrip/__init__.py | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a3fd028..dbc30f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 "] license = "GPL-3.0-only" diff --git a/rip/cli.py b/rip/cli.py index fe2154c..845c4d2 100644 --- a/rip/cli.py +++ b/rip/cli.py @@ -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("Must pass arguments. See rip url -h.") 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(): diff --git a/streamrip/__init__.py b/streamrip/__init__.py index 832f100..0d23a03 100644 --- a/streamrip/__init__.py +++ b/streamrip/__init__.py @@ -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