Skip to content

Commit 555c0fe

Browse files
authored
Release v4.0.1
2 parents e318174 + 4885853 commit 555c0fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+66766
-50662
lines changed

poetry.lock

+360-489
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "spotdl"
3-
version = "4.0.0"
3+
version = "4.0.1"
44
description = "Download your Spotify playlists and songs along with album art and metadata"
55
license = "MIT"
66
authors = ["spotDL Team <[email protected]>"]
@@ -28,46 +28,46 @@ classifiers = [
2828
[tool.poetry.dependencies]
2929
python = ">=3.7,<=3.11"
3030

31-
spotipy = "^2.19.0"
31+
spotipy = "^2.20.0"
3232
ytmusicapi = "^0.22.0"
3333
pytube = "^12.1.0"
34-
yt-dlp = "^2022.5.18"
35-
mutagen = "^1.45.1"
36-
rich = "^12.4.4"
37-
beautifulsoup4 = "^4.10.0"
38-
requests = "^2.27.1"
39-
rapidfuzz = "^2.0.15"
40-
python-slugify = "^6.1.1"
41-
uvicorn = "^0.17.1"
42-
pydantic = "^1.9.0"
34+
yt-dlp = "^2022.10.4"
35+
mutagen = "^1.46.0"
36+
rich = "^12.6.0"
37+
beautifulsoup4 = "^4.11.1"
38+
requests = "^2.28.1"
39+
rapidfuzz = "^2.12.0"
40+
python-slugify = "^6.1.2"
41+
uvicorn = "^0.17.6"
42+
pydantic = "^1.10.2"
4343
fastapi = "^0.78.0"
44-
nest_asyncio = "^1.5.4"
44+
nest_asyncio = "^1.5.6"
4545

4646
[tool.poetry.dev-dependencies]
47-
pytest = "^7.1.2"
48-
pytest-mock = "^3.7.0"
47+
pytest = "^7.2.0"
48+
pytest-mock = "^3.10.0"
4949
pytest-vcr = "^1.0.2"
50-
pyfakefs = "^4.5.4"
50+
pyfakefs = "^4.7.0"
5151
pytest-cov = "^3.0.0"
52-
pytest-subprocess = "^1.4.0"
52+
pytest-subprocess = "^1.4.2"
5353
pytest-asyncio = "^0.18.3"
5454
mypy = "^0.961"
5555
pylint = "^2.13.9"
56-
black = "^22.1.0"
56+
black = "^22.10.0"
5757
mdformat-gfm = "^0.3.5"
5858
types-orjson = "^3.6.2"
59-
types-python-slugify = "^5.0.3"
60-
types-requests = "^2.27.16"
61-
types-setuptools = "^57.4.11"
62-
types-toml = "^0.10.4"
63-
types-ujson = "^5.3.0"
64-
pyinstaller = "^5.1"
65-
mkdocs = "^1.3.0"
66-
mkdocs-material = "^8.3.3"
59+
types-python-slugify = "^5.0.4"
60+
types-requests = "^2.28.11.2"
61+
types-setuptools = "^57.4.18"
62+
types-toml = "^0.10.8"
63+
types-ujson = "^5.5.0"
64+
pyinstaller = "^5.6"
65+
mkdocs = "^1.4.1"
66+
mkdocs-material = "^8.5.7"
6767
mkdocstrings = "^0.19.0"
68-
mkdocstrings-python = "^0.7.0"
69-
pymdown-extensions = "^9.5"
70-
mkdocs-gen-files = "^0.3.4"
68+
mkdocstrings-python = "^0.7.1"
69+
pymdown-extensions = "^9.7"
70+
mkdocs-gen-files = "^0.3.5"
7171
mkdocs-literate-nav = "^0.4.1"
7272
mkdocs-section-index = "^0.3.4"
7373

spotdl/_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
Version module for spotdl.
33
"""
44

5-
__version__ = "4.0.0"
5+
__version__ = "4.0.1"

spotdl/providers/audio/ytmusic.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ def get_results(self, search_term: str, **kwargs) -> List[Dict[str, Any]]:
144144
{
145145
"name": result["title"],
146146
"type": result["resultType"],
147-
"link": f"https://youtube.com/watch?v={result['videoId']}",
147+
"link": (
148+
f'https://{"music" if result["resultType"] == "song" else "www"}'
149+
f".youtube.com/watch?v={result['videoId']}"
150+
),
148151
"album": result.get("album", {}).get("name")
149152
if result.get("album")
150153
else None,

spotdl/utils/ffmpeg.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from pathlib import Path
1616

1717
import requests
18+
1819
from spotdl.utils.config import get_spotdl_path
1920
from spotdl.utils.formatter import to_ms
2021

@@ -37,7 +38,7 @@
3738

3839
FFMPEG_FORMATS = {
3940
"mp3": ["-codec:a", "libmp3lame"],
40-
"flac": ["-codec:a", "flac"],
41+
"flac": ["-codec:a", "flac", "-sample_fmt", "s16"],
4142
"ogg": ["-codec:a", "libvorbis"],
4243
"opus": ["-codec:a", "libopus"],
4344
"m4a": ["-codec:a", "aac"],

spotdl/utils/metadata.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import base64
1414

1515
from pathlib import Path
16-
from typing import Any, Dict, Optional
16+
from typing import Any, Dict, Optional, Union
1717
from urllib.request import urlopen
1818

1919
from mutagen import File
@@ -22,6 +22,7 @@
2222
from mutagen.flac import Picture, FLAC
2323
from mutagen.oggvorbis import OggVorbis
2424
from mutagen.easyid3 import EasyID3, ID3
25+
from mutagen.mp3 import ID3FileType
2526
from mutagen.id3 import APIC as AlbumCover, USLT, COMM as Comment, ID3NoHeaderError
2627

2728
from spotdl.types import Song
@@ -71,13 +72,17 @@ def set_id3_mp3(output_file: Path, song: Song):
7172
"""
7273

7374
try:
74-
audio_file = EasyID3(str(output_file.resolve()))
75+
audio_file: Union[EasyID3, ID3FileType] = EasyID3(str(output_file.resolve()))
7576
except ID3NoHeaderError as exc:
76-
audio_file = File(str(output_file.resolve()), easy=True)
77-
if audio_file is None:
77+
unknown_file: Optional[ID3FileType] = File(
78+
str(output_file.resolve()), easy=True
79+
)
80+
81+
if unknown_file is None:
7882
raise MetadataError("Unable to load file.") from exc
7983

80-
audio_file.add_tags()
84+
unknown_file.add_tags()
85+
audio_file = unknown_file
8186

8287
audio_file.delete()
8388

@@ -100,10 +105,10 @@ def set_id3_mp3(output_file: Path, song: Song):
100105

101106
audio_file.save(v2_version=3)
102107

103-
audio_file = ID3(str(output_file.resolve()))
108+
temp_audio_file: ID3 = ID3(str(output_file.resolve()))
104109
if song.cover_url:
105110
with urlopen(song.cover_url) as raw_album_art:
106-
audio_file["APIC"] = AlbumCover(
111+
temp_audio_file["APIC"] = AlbumCover(
107112
encoding=3,
108113
mime="image/jpeg",
109114
type=3,
@@ -112,14 +117,14 @@ def set_id3_mp3(output_file: Path, song: Song):
112117
)
113118

114119
if song.lyrics:
115-
audio_file["USLT::'eng'"] = USLT(
120+
temp_audio_file["USLT::'eng'"] = USLT(
116121
encoding=3, lang="eng", desc="desc", text=song.lyrics
117122
)
118123

119124
if song.download_url:
120-
audio_file.add(Comment(encoding=3, text=song.download_url))
125+
temp_audio_file.add(Comment(encoding=3, text=song.download_url))
121126

122-
audio_file.save(v2_version=3)
127+
temp_audio_file.save(v2_version=3)
123128

124129

125130
def set_id3_m4a(output_file: Path, song: Song):

0 commit comments

Comments
 (0)