4 Commits

Author SHA1 Message Date
Vitiko 9c8901dc2f Update README.md 2025-07-18 23:04:07 -04:00
Vitiko 8b3a3c7e3c Update README.md 2025-07-18 23:03:06 -04:00
Vitiko 8096e6cf65 Merge pull request #228 from Qamynn/master
Sanitize album and track attributes
2023-08-21 18:36:43 -04:00
Qamynn 62f995483d Sanitize album and track attributes
Now using "sanitize_filename" on the album and artist attributes. Now no accidental subdirectories get created because of characters like: ":" or "/"
2023-08-20 14:16:43 +02:00
4 changed files with 6 additions and 10 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
# qobuz-dl # qobuz-dl
Search, explore and download Lossless and Hi-Res music from [Qobuz](https://www.qobuz.com/). Search, explore and download Lossless and Hi-Res music from [Qobuz](https://www.qobuz.com/). It *just works*™ (2025).
[![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) [![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 ## Features
-2
View File
@@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
from .qopy import Client from .qopy import Client
from .cli import main from .cli import main
+4 -4
View File
@@ -254,8 +254,8 @@ class Download:
@staticmethod @staticmethod
def _get_track_attr(meta, track_title, bit_depth, sampling_rate): def _get_track_attr(meta, track_title, bit_depth, sampling_rate):
return { return {
"album": meta["album"]["title"], "album": sanitize_filename(meta["album"]["title"]),
"artist": meta["album"]["artist"]["name"], "artist": sanitize_filename(meta["album"]["artist"]["name"]),
"tracktitle": track_title, "tracktitle": track_title,
"year": meta["album"]["release_date_original"].split("-")[0], "year": meta["album"]["release_date_original"].split("-")[0],
"bit_depth": bit_depth, "bit_depth": bit_depth,
@@ -265,8 +265,8 @@ class Download:
@staticmethod @staticmethod
def _get_album_attr(meta, album_title, file_format, bit_depth, sampling_rate): def _get_album_attr(meta, album_title, file_format, bit_depth, sampling_rate):
return { return {
"artist": meta["artist"]["name"], "artist": sanitize_filename(meta["artist"]["name"]),
"album": album_title, "album": sanitize_filename(album_title),
"year": meta["release_date_original"].split("-")[0], "year": meta["release_date_original"].split("-")[0],
"format": file_format, "format": file_format,
"bit_depth": bit_depth, "bit_depth": bit_depth,
+1 -3
View File
@@ -3,7 +3,6 @@
# original author. # original author.
import hashlib import hashlib
import json
import logging import logging
import time import time
@@ -121,8 +120,7 @@ class Client:
raise InvalidAppSecretError(f"Invalid app secret: {r.json()}.\n" + RESET) raise InvalidAppSecretError(f"Invalid app secret: {r.json()}.\n" + RESET)
r.raise_for_status() r.raise_for_status()
return json.loads(r.text.encode("utf-8", errors="ignore")) return r.json()
# return r.json()
def auth(self, email, pwd): def auth(self, email, pwd):
usr_info = self.api_call("user/login", email=email, pwd=pwd) usr_info = self.api_call("user/login", email=email, pwd=pwd)