diff --git a/README.md b/README.md index 73f17fa..719d7c7 100644 --- a/README.md +++ b/README.md @@ -18,24 +18,13 @@ A scriptable stream downloader for Qobuz, Tidal, Deezer and SoundCloud. ## Installation -First, ensure [pip](https://pip.pypa.io/en/stable/installing/) is installed. Then run the following in the command line: - - - -macOS/Linux: +First, ensure [Python](https://www.python.org/downloads/) and [pip](https://pip.pypa.io/en/stable/installing/) are installed. Then run the following in the command line: ```bash -pip3 install streamrip simple-term-menu --upgrade +pip3 install streamrip --upgrade ``` -Windows: - -```bash -pip3 install streamrip windows-curses --upgrade -``` - - -If you would like to use `streamrip`'s conversion capabilities, download TIDAL videos, or download music from SoundCloud, install [ffmpeg](https://ffmpeg.org/download.html). +If you would like to use `streamrip`'s conversion capabilities, download TIDAL videos, or download music from SoundCloud, install [ffmpeg](https://ffmpeg.org/download.html). To download music from YouTube, install [youtube-dl](https://github.com/ytdl-org/youtube-dl#installation). ## Example Usage diff --git a/requirements.txt b/requirements.txt index 55ddf35..b69ee73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,3 @@ pathvalidate requests mutagen tqdm -pycryptodome -pick -colorama diff --git a/setup.py b/setup.py index 6444eec..3759557 100644 --- a/setup.py +++ b/setup.py @@ -9,12 +9,21 @@ def read_file(fname): requirements = read_file("requirements.txt").strip().split() +requirements.append("simple-term-menu; platform_system == 'Linux'") +requirements.append("simple-term-menu; platform_system == 'Darwin'") +requirements.append("pick; platform_system == 'Windows'") +# Needed for pick to work +requirements.append("windows-curses; platform_system == 'Windows'") + +# required for click colors +# can be removed when click v8.0 is released +requirements.append("colorama; platform_system == 'Windows'") # https://github.com/pypa/sampleproject/blob/main/setup.py setup( name=pkg_name, - version="0.5.3", + version="0.5.4", author="Nathan", author_email="nathanthomas707@gmail.com", keywords="lossless, hi-res, qobuz, tidal, deezer, audio, convert, soundcloud, mp3", diff --git a/streamrip/__init__.py b/streamrip/__init__.py index da24bcc..e9e459a 100644 --- a/streamrip/__init__.py +++ b/streamrip/__init__.py @@ -1,3 +1,3 @@ """streamrip: the all in one music downloader.""" -__version__ = "0.5.3" +__version__ = "0.5.4" diff --git a/streamrip/config.py b/streamrip/config.py index 5828dd5..1a9f110 100644 --- a/streamrip/config.py +++ b/streamrip/config.py @@ -228,6 +228,10 @@ class ConfigDocumentation: download_videos: Download the video along with the audio video_downloads_folder: The path to download the videos to database: This stores a list of item IDs so that repeats are not downloaded. + conversion: Convert tracks to a codec after downloading them. + codec: FLAC, ALAC, OPUS, MP3, VORBIS, or AAC + sampling_rate: In Hz. Tracks are downsampled if their sampling rate is greater than this. Values greater than 48000 are only recommended if the audio will be processed. It is otherwise a waste of space as the human ear cannot discern higher frequencies. + bit_depth: Only 16 and 24 are available. It is only applied when the bit depth is higher than this value. filters: Filter a Qobuz artist's discography. Set to 'true' to turn on a filter. extras: Remove Collectors Editions, live recordings, etc. repeats: Picks the highest quality out of albums with identical titles. @@ -249,6 +253,7 @@ class ConfigDocumentation: track: Available keys: "tracknumber", "artist", "albumartist", "composer", and "title" lastfm: Last.fm playlists are downloaded by searching for the titles of the tracks source: The source on which to search for the tracks. + fallback_source: If no results were found with the primary source, the item is searched for on this one. concurrent_downloads: Download (and convert) tracks all at once, instead of sequentially. If you are converting the tracks, and/or have fast internet, this will substantially improve processing speed. """ diff --git a/streamrip/utils.py b/streamrip/utils.py index 6bb3676..4843343 100644 --- a/streamrip/utils.py +++ b/streamrip/utils.py @@ -1,24 +1,19 @@ """Miscellaneous utility functions.""" import base64 -import contextlib import logging import os import re -import sys from string import Formatter from typing import Dict, Hashable, Optional, Union import click import requests -from Crypto.Cipher import AES -from Crypto.Util import Counter from pathvalidate import sanitize_filename from requests.packages import urllib3 from tqdm import tqdm -from tqdm.contrib import DummyTqdmFile -from .constants import AGENT, LOG_DIR, TIDAL_COVER_URL +from .constants import AGENT, TIDAL_COVER_URL from .exceptions import InvalidSourceError, NonStreamable urllib3.disable_warnings() @@ -215,6 +210,19 @@ def decrypt_mqa_file(in_path, out_path, encryption_key): :param out_path: :param encryption_key: """ + try: + from Crypto.Cipher import AES + from Crypto.Util import Counter + except (ImportError, ModuleNotFoundError): + click.secho( + "To download this item in MQA, you need to run ", + fg="yellow", + nl=False, + ) + click.secho("pip3 install pycryptodome --upgrade", fg="blue", nl=False) + click.secho(".") + raise click.Abort + # Do not change this master_key = "UIlTTEMmmLfGowo/UC60x2H45W6MdGgTRfo/umg4754="