mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-17 08:35:08 -04:00
Add capability to check for updates
This commit is contained in:
parent
4cf00a106e
commit
43edf0255c
4 changed files with 22 additions and 1 deletions
|
@ -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"]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue