diff --git a/README.md b/README.md index 0b18740..32e26f2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # streamrip -A scriptable stream downloader for Qobuz, Tidal, and Deezer. +A scriptable stream downloader for Qobuz, Tidal, Deezer and SoundCloud. ## Features -- Downloads tracks, albums, playlists, discographies, and labels from Qobuz, Tidal, and Deezer +- Downloads tracks, albums, playlists, discographies, and labels from Qobuz, Tidal, Deezer, and SoundCloud - Automatically converts files to a preferred format - Has a database that stores the downloaded tracks' IDs so that repeats are avoided @@ -30,7 +30,7 @@ pip3 install streamrip windows-curses --upgrade -If you would like to use `streamrip`'s conversion capabilities, install [ffmpeg](https://ffmpeg.org/download.html). +If you would like to use `streamrip`'s conversion capabilities, or download music from SoundCloud, install [ffmpeg](https://ffmpeg.org/download.html). ## Example Usage @@ -54,13 +54,13 @@ rip --convert mp3 -u https://open.qobuz.com/album/0060253780968 To set the quality, use the `--quality` option to `0, 1, 2, 3, 4`: -| Quality ID | Audio Quality | Available Sources | -| ---------- | --------------------- | -------------------- | -| 0 | 128 kbps MP3 or AAC | Deezer, Tidal | -| 1 | 320 kbps MP3 or AAC | Deezer, Tidal, Qobuz | -| 2 | 16 bit, 44.1 kHz (CD) | Deezer, Tidal, Qobuz | -| 3 | 24 bit, ≤ 96 kHz | Tidal (MQA), Qobuz | -| 4 | 24 bit, ≤ 192 kHz | Qobuz | +| Quality ID | Audio Quality | Available Sources | +| ---------- | --------------------- | -------------------------------------------- | +| 0 | 128 kbps MP3 or AAC | Deezer, Tidal, SoundCloud (most of the time) | +| 1 | 320 kbps MP3 or AAC | Deezer, Tidal, Qobuz, SoundCloud (rarely) | +| 2 | 16 bit, 44.1 kHz (CD) | Deezer, Tidal, Qobuz, SoundCloud (rarely) | +| 3 | 24 bit, ≤ 96 kHz | Tidal (MQA), Qobuz, SoundCloud (rarely) | +| 4 | 24 bit, ≤ 192 kHz | Qobuz | @@ -70,10 +70,10 @@ To set the quality, use the `--quality` option to `0, 1, 2, 3, 4`: rip --quality 3 https://tidal.com/browse/album/147569387 ``` -Search for *Fleetwood Mac - Rumours* on Qobuz +Search for albums matching `lil uzi vert` on SoundCloud ```bash -rip search 'fleetwood mac rumours' +rip search -s soundcloud 'lil uzi vert' ``` ![streamrip interactive search](https://github.com/nathom/streamrip/blob/main/demo/interactive_search.png?raw=true) @@ -155,6 +155,7 @@ Thanks to Vitiko98, Sorrow446, and DashLt for their contributions to this projec - [qobuz-dl](https://github.com/vitiko98/qobuz-dl) - [Qo-DL Reborn](https://github.com/badumbass/Qo-DL-Reborn) - [Tidal-Media-Downloader](https://github.com/yaronzz/Tidal-Media-Downloader) +- [scdl](https://github.com/flyingrub/scdl) diff --git a/demo/interactive_search.png b/demo/interactive_search.png index 6d3a6b4..4007b11 100644 Binary files a/demo/interactive_search.png and b/demo/interactive_search.png differ diff --git a/streamrip/downloader.py b/streamrip/downloader.py index bd85492..10e70e6 100644 --- a/streamrip/downloader.py +++ b/streamrip/downloader.py @@ -709,7 +709,6 @@ class Album(Tracklist): def load_meta(self): assert hasattr(self, "id"), "id must be set to load metadata" self.meta = self.client.get(self.id, media_type="album") - pprint(self.meta) # update attributes based on response for k, v in self._parse_get_resp(self.meta, self.client).items(): @@ -865,7 +864,8 @@ class Album(Tracklist): True by default. """ self.folder_format = kwargs.get("folder_format", FOLDER_FORMAT) - folder = self._get_formatted_folder(parent_folder) + quality = min(quality, self.client.max_quality) + folder = self._get_formatted_folder(parent_folder, quality) os.makedirs(folder, exist_ok=True) logger.debug("Directory created: %s", folder) @@ -940,15 +940,15 @@ class Album(Tracklist): return fmt - def _get_formatted_folder(self, parent_folder: str) -> str: - if self.bit_depth is not None and self.sampling_rate is not None: - self.container = "FLAC" - elif self.client.source in ("qobuz", "deezer", "soundcloud"): - self.container = "MP3" - elif self.client.source == "tidal": - self.container = "AAC" + def _get_formatted_folder(self, parent_folder: str, quality: int) -> str: + if quality >= 2: + self.container = 'FLAC' else: - raise Exception(f"{self.bit_depth}, {self.sampling_rate}") + self.bit_depth = self.sampling_rate = None + if self.client.source == 'tidal': + self.container = 'AAC' + else: + self.container = 'MP3' formatted_folder = clean_format(self.folder_format, self._get_formatter())