diff --git a/streamrip/__init__.py b/streamrip/__init__.py index e69de29..260c070 100644 --- a/streamrip/__init__.py +++ b/streamrip/__init__.py @@ -0,0 +1 @@ +__version__ = "0.3.1" diff --git a/streamrip/cli.py b/streamrip/cli.py index 59a29a7..b5f2974 100644 --- a/streamrip/cli.py +++ b/streamrip/cli.py @@ -4,6 +4,7 @@ from getpass import getpass from hashlib import md5 import click +import requests from .clients import TidalClient from .config import Config @@ -54,6 +55,22 @@ def cli(ctx, **kwargs): config = Config() + if config.session["check_for_updates"]: + from importlib import metadata + + from packaging import version + + r = requests.get("https://pypi.org/pypi/streamrip/json").json() + newest = r['info']['version'] + if version.parse(metadata.version("streamrip")) < version.parse(newest): + click.secho( + "A new version of streamrip is available! " + "Run `pip3 install streamrip --upgrade` to update.", + fg="yellow", + ) + else: + click.secho("streamrip is up-to-date!", fg='green') + if kwargs["no_db"]: config.session["database"]["enabled"] = False if kwargs["convert"]: diff --git a/streamrip/config.py b/streamrip/config.py index b820e5b..c857b54 100644 --- a/streamrip/config.py +++ b/streamrip/config.py @@ -81,6 +81,7 @@ class Config: "keep_downloaded_cover": True, }, "path_format": {"folder": FOLDER_FORMAT, "track": TRACK_FORMAT}, + "check_for_updates": True, } def __init__(self, path: str = None): diff --git a/streamrip/downloader.py b/streamrip/downloader.py index 6d9b173..55b3a0d 100644 --- a/streamrip/downloader.py +++ b/streamrip/downloader.py @@ -782,7 +782,9 @@ class Album(Tracklist): "streamable": resp.get("allowStreaming"), "quality": TIDAL_Q_MAP[resp.get("audioQuality")], "bit_depth": 24 if resp.get("audioQuality") == "HI_RES" else 16, - "sampling_rate": 48000 if resp.get("audioQuality") == 'HI_RES' else 41000, + "sampling_rate": 48000 + if resp.get("audioQuality") == "HI_RES" + else 41000, "tracktotal": resp.get("numberOfTracks"), "disctotal": resp.get("numberOfVolumes"), }