Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a new "me" command to download by liked albums/tracks #185

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 74 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,51 @@
# qobuz-dl

Search, explore and download Lossless and Hi-Res music from [Qobuz](https://www.qobuz.com/).
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VZWSWVGZGJRMU&source=url)

## Features

* Download FLAC and MP3 files from Qobuz
* Explore and download music directly from your terminal with **interactive** or **lucky** mode
* Download albums, tracks, artists, playlists and labels with **download** mode
* Download music from last.fm playlists (Spotify, Apple Music and Youtube playlists are also supported through this method)
* Queue support on **interactive** mode
* Effective duplicate handling with own portable database
* Support for albums with multiple discs
* Support for M3U playlists
* Downloads URLs from text file
* Extended tags
* And more
- Download FLAC and MP3 files from Qobuz
- Explore and download music directly from your terminal with **interactive** or **lucky** mode
- Download albums, tracks, artists, playlists and labels with **download** mode
- Download music from last.fm playlists (Spotify, Apple Music and Youtube playlists are also supported through this method)
- Queue support on **interactive** mode
- Effective duplicate handling with own portable database
- Support for albums with multiple discs
- Support for M3U playlists
- Downloads URLs from text file
- Extended tags
- And more

## Getting started

> You'll need an **active subscription**

#### Install qobuz-dl with pip

##### Linux / MAC OS

```
pip3 install --upgrade qobuz-dl
```

##### Windows

```
pip3 install windows-curses
pip3 install --upgrade qobuz-dl
```

#### Run qobuz-dl and enter your credentials

##### Linux / MAC OS

```
qobuz-dl
```

##### Windows

```
qobuz-dl.exe
```
Expand All @@ -45,47 +55,65 @@ qobuz-dl.exe
## Examples

### Download mode

Download URL in 24B<96khz quality

```
qobuz-dl dl https://play.qobuz.com/album/qxjbxh1dc3xyb -q 7
```

Download multiple URLs to custom directory

```
qobuz-dl dl https://play.qobuz.com/artist/2038380 https://play.qobuz.com/album/ip8qjy1m6dakc -d "Some pop from 2020"
```

Download multiple URLs from text file

```
qobuz-dl dl this_txt_file_has_urls.txt
```

Download albums from a label and also embed cover art images into the downloaded files

```
qobuz-dl dl https://play.qobuz.com/label/7526 --embed-art
```

Download a Qobuz playlist in maximum quality

```
qobuz-dl dl https://play.qobuz.com/playlist/5388296 -q 27
```

Download all the music from an artist except singles, EPs and VA releases

```
qobuz-dl dl https://play.qobuz.com/artist/2528676 --albums-only
```

#### Last.fm playlists

> Last.fm has a new feature for creating playlists: you can create your own based on the music you listen to or you can import one from popular streaming services like Spotify, Apple Music and Youtube. Visit: `https://www.last.fm/user/<your profile>/playlists` (e.g. https://www.last.fm/user/vitiko98/playlists) to get started.

Download a last.fm playlist in the maximum quality

```
qobuz-dl dl https://www.last.fm/user/vitiko98/playlists/11887574 -q 27
```

Run `qobuz-dl dl --help` for more info.

### Interactive mode

Run interactive mode with a limit of 10 results

```
qobuz-dl fun -l 10
```

Type your search query

```
Logging...
Logged: OK
Expand All @@ -95,39 +123,67 @@ Membership: Studio
Enter your search: [Ctrl + c to quit]
- fka twigs magdalene
```

`qobuz-dl` will bring up a nice list of releases. Now choose whatever releases you want to download (everything else is interactive).

Run `qobuz-dl fun --help` for more info.

### Lucky mode

Download the first album result

```
qobuz-dl lucky playboi carti die lit
```

Download the first 5 artist results

```
qobuz-dl lucky joy division -n 5 --type artist
```

Download the first 3 track results in 320 quality

```
qobuz-dl lucky eric dolphy remastered --type track -n 3 -q 5
```

Download the first track result without cover art

```
qobuz-dl lucky jay z story of oj --type track --no-cover
```

Run `qobuz-dl lucky --help` for more info.

### Me mode

Download all liked albums

```
qobuz-dl me
```

Download all liked tracks

```
qobuz-dl me -t tracks
```

Run `qobuz-dl me --help` for more info.

### Other

Reset your config file

```
qobuz-dl -r
```

By default, `qobuz-dl` will skip already downloaded items by ID with the message `This release ID ({item_id}) was already downloaded`. To avoid this check, add the flag `--no-db` at the end of a command. In extreme cases (e.g. lost collection), you can run `qobuz-dl -p` to completely reset the database.

## Usage

```
usage: qobuz-dl [-h] [-r] {fun,dl,lucky} ...

Expand All @@ -149,7 +205,8 @@ commands:
lucky lucky mode
```

## Module usage
## Module usage

Using `qobuz-dl` as a module is really easy. Basically, the only thing you need is `QobuzDL` from `core`.

```python
Expand All @@ -171,7 +228,10 @@ qobuz.handle_url("https://play.qobuz.com/album/va4j3hdlwaubc")
Attributes, methods and parameters have been named as self-explanatory as possible.

## A note about Qo-DL

`qobuz-dl` is inspired in the discontinued Qo-DL-Reborn. This tool uses two modules from Qo-DL: `qopy` and `spoofer`, both written by Sorrow446 and DashLt.

## Disclaimer
* This tool was written for educational purposes. I will not be responsible if you use this program in bad faith. By using it, you are accepting the [Qobuz API Terms of Use](https://static.qobuz.com/apps/api/QobuzAPI-TermsofUse.pdf).
* `qobuz-dl` is not affiliated with Qobuz

- This tool was written for educational purposes. I will not be responsible if you use this program in bad faith. By using it, you are accepting the [Qobuz API Terms of Use](https://static.qobuz.com/apps/api/QobuzAPI-TermsofUse.pdf).
- `qobuz-dl` is not affiliated with Qobuz
14 changes: 9 additions & 5 deletions qobuz_dl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,19 @@ def _reset_config(config_file):
config = configparser.ConfigParser()
config["DEFAULT"]["email"] = input("Enter your email:\n- ")
password = input("Enter your password\n- ")
config["DEFAULT"]["password"] = hashlib.md5(password.encode("utf-8")).hexdigest()
config["DEFAULT"]["password"] = hashlib.md5(
password.encode("utf-8")).hexdigest()
config["DEFAULT"]["default_folder"] = (
input("Folder for downloads (leave empty for default 'Qobuz Downloads')\n- ")
or "Qobuz Downloads"
input("Folder for downloads (leave empty for default 'Qobuz Downloads')\n- ") or
"Qobuz Downloads"
)
config["DEFAULT"]["default_quality"] = (
input(
"Download quality (5, 6, 7, 27) "
"[320, LOSSLESS, 24B <96KHZ, 24B >96KHZ]"
"\n(leave empty for default '6')\n- "
)
or "6"
) or
"6"
)
config["DEFAULT"]["default_limit"] = "20"
config["DEFAULT"]["no_m3u"] = "false"
Expand Down Expand Up @@ -86,6 +87,9 @@ def _handle_commands(qobuz, arguments):
qobuz.lucky_type = arguments.type
qobuz.lucky_limit = arguments.number
qobuz.lucky_mode(query)
elif arguments.command == "me":
qobuz.me_type = arguments.type
qobuz.me_mode()
else:
qobuz.interactive_limit = arguments.limit
qobuz.interactive()
Expand Down
18 changes: 17 additions & 1 deletion qobuz_dl/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ def dl_args(subparsers):
return download


def me_args(subparsers):
me = subparsers.add_parser(
"me",
description="Download by liked albums or tracks.",
help="input mode",
)
me.add_argument(
"-t",
"--type",
default="album",
help=("type of items to search (albums, tracks) (default: album)"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default: albums

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already fixed in newest commits

)
return me


def add_common_arg(custom_parser, default_folder, default_quality):
custom_parser.add_argument(
"-d",
Expand Down Expand Up @@ -159,9 +174,10 @@ def qobuz_dl_args(
interactive = fun_args(subparsers, default_limit)
download = dl_args(subparsers)
lucky = lucky_args(subparsers)
me = me_args(subparsers)
[
add_common_arg(i, default_folder, default_quality)
for i in (interactive, download, lucky)
for i in (interactive, download, lucky, me)
]

return parser
Loading