Skip to content

Commit

Permalink
Release v4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat authored Oct 25, 2022
2 parents e318174 + 4885853 commit 555c0fe
Show file tree
Hide file tree
Showing 42 changed files with 66,766 additions and 50,662 deletions.
849 changes: 360 additions & 489 deletions poetry.lock

Large diffs are not rendered by default.

56 changes: 28 additions & 28 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "spotdl"
version = "4.0.0"
version = "4.0.1"
description = "Download your Spotify playlists and songs along with album art and metadata"
license = "MIT"
authors = ["spotDL Team <[email protected]>"]
Expand Down Expand Up @@ -28,46 +28,46 @@ classifiers = [
[tool.poetry.dependencies]
python = ">=3.7,<=3.11"

spotipy = "^2.19.0"
spotipy = "^2.20.0"
ytmusicapi = "^0.22.0"
pytube = "^12.1.0"
yt-dlp = "^2022.5.18"
mutagen = "^1.45.1"
rich = "^12.4.4"
beautifulsoup4 = "^4.10.0"
requests = "^2.27.1"
rapidfuzz = "^2.0.15"
python-slugify = "^6.1.1"
uvicorn = "^0.17.1"
pydantic = "^1.9.0"
yt-dlp = "^2022.10.4"
mutagen = "^1.46.0"
rich = "^12.6.0"
beautifulsoup4 = "^4.11.1"
requests = "^2.28.1"
rapidfuzz = "^2.12.0"
python-slugify = "^6.1.2"
uvicorn = "^0.17.6"
pydantic = "^1.10.2"
fastapi = "^0.78.0"
nest_asyncio = "^1.5.4"
nest_asyncio = "^1.5.6"

[tool.poetry.dev-dependencies]
pytest = "^7.1.2"
pytest-mock = "^3.7.0"
pytest = "^7.2.0"
pytest-mock = "^3.10.0"
pytest-vcr = "^1.0.2"
pyfakefs = "^4.5.4"
pyfakefs = "^4.7.0"
pytest-cov = "^3.0.0"
pytest-subprocess = "^1.4.0"
pytest-subprocess = "^1.4.2"
pytest-asyncio = "^0.18.3"
mypy = "^0.961"
pylint = "^2.13.9"
black = "^22.1.0"
black = "^22.10.0"
mdformat-gfm = "^0.3.5"
types-orjson = "^3.6.2"
types-python-slugify = "^5.0.3"
types-requests = "^2.27.16"
types-setuptools = "^57.4.11"
types-toml = "^0.10.4"
types-ujson = "^5.3.0"
pyinstaller = "^5.1"
mkdocs = "^1.3.0"
mkdocs-material = "^8.3.3"
types-python-slugify = "^5.0.4"
types-requests = "^2.28.11.2"
types-setuptools = "^57.4.18"
types-toml = "^0.10.8"
types-ujson = "^5.5.0"
pyinstaller = "^5.6"
mkdocs = "^1.4.1"
mkdocs-material = "^8.5.7"
mkdocstrings = "^0.19.0"
mkdocstrings-python = "^0.7.0"
pymdown-extensions = "^9.5"
mkdocs-gen-files = "^0.3.4"
mkdocstrings-python = "^0.7.1"
pymdown-extensions = "^9.7"
mkdocs-gen-files = "^0.3.5"
mkdocs-literate-nav = "^0.4.1"
mkdocs-section-index = "^0.3.4"

Expand Down
2 changes: 1 addition & 1 deletion spotdl/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Version module for spotdl.
"""

__version__ = "4.0.0"
__version__ = "4.0.1"
5 changes: 4 additions & 1 deletion spotdl/providers/audio/ytmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def get_results(self, search_term: str, **kwargs) -> List[Dict[str, Any]]:
{
"name": result["title"],
"type": result["resultType"],
"link": f"https://youtube.com/watch?v={result['videoId']}",
"link": (
f'https://{"music" if result["resultType"] == "song" else "www"}'
f".youtube.com/watch?v={result['videoId']}"
),
"album": result.get("album", {}).get("name")
if result.get("album")
else None,
Expand Down
3 changes: 2 additions & 1 deletion spotdl/utils/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from pathlib import Path

import requests

from spotdl.utils.config import get_spotdl_path
from spotdl.utils.formatter import to_ms

Expand All @@ -37,7 +38,7 @@

FFMPEG_FORMATS = {
"mp3": ["-codec:a", "libmp3lame"],
"flac": ["-codec:a", "flac"],
"flac": ["-codec:a", "flac", "-sample_fmt", "s16"],
"ogg": ["-codec:a", "libvorbis"],
"opus": ["-codec:a", "libopus"],
"m4a": ["-codec:a", "aac"],
Expand Down
25 changes: 15 additions & 10 deletions spotdl/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import base64

from pathlib import Path
from typing import Any, Dict, Optional
from typing import Any, Dict, Optional, Union
from urllib.request import urlopen

from mutagen import File
Expand All @@ -22,6 +22,7 @@
from mutagen.flac import Picture, FLAC
from mutagen.oggvorbis import OggVorbis
from mutagen.easyid3 import EasyID3, ID3
from mutagen.mp3 import ID3FileType
from mutagen.id3 import APIC as AlbumCover, USLT, COMM as Comment, ID3NoHeaderError

from spotdl.types import Song
Expand Down Expand Up @@ -71,13 +72,17 @@ def set_id3_mp3(output_file: Path, song: Song):
"""

try:
audio_file = EasyID3(str(output_file.resolve()))
audio_file: Union[EasyID3, ID3FileType] = EasyID3(str(output_file.resolve()))
except ID3NoHeaderError as exc:
audio_file = File(str(output_file.resolve()), easy=True)
if audio_file is None:
unknown_file: Optional[ID3FileType] = File(
str(output_file.resolve()), easy=True
)

if unknown_file is None:
raise MetadataError("Unable to load file.") from exc

audio_file.add_tags()
unknown_file.add_tags()
audio_file = unknown_file

audio_file.delete()

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

audio_file.save(v2_version=3)

audio_file = ID3(str(output_file.resolve()))
temp_audio_file: ID3 = ID3(str(output_file.resolve()))
if song.cover_url:
with urlopen(song.cover_url) as raw_album_art:
audio_file["APIC"] = AlbumCover(
temp_audio_file["APIC"] = AlbumCover(
encoding=3,
mime="image/jpeg",
type=3,
Expand All @@ -112,14 +117,14 @@ def set_id3_mp3(output_file: Path, song: Song):
)

if song.lyrics:
audio_file["USLT::'eng'"] = USLT(
temp_audio_file["USLT::'eng'"] = USLT(
encoding=3, lang="eng", desc="desc", text=song.lyrics
)

if song.download_url:
audio_file.add(Comment(encoding=3, text=song.download_url))
temp_audio_file.add(Comment(encoding=3, text=song.download_url))

audio_file.save(v2_version=3)
temp_audio_file.save(v2_version=3)


def set_id3_m4a(output_file: Path, song: Song):
Expand Down
Loading

0 comments on commit 555c0fe

Please sign in to comment.