Skip to content

Commit

Permalink
v4.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat authored Apr 6, 2023
2 parents ff37ff7 + 443e88d commit ffcf230
Show file tree
Hide file tree
Showing 46 changed files with 89,089 additions and 92,843 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Change this title, poorly formatted issues will not be handled

description: Report bugs so we can fix them

labels: bug
labels: Bug

body:

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Change this title, poorly formatted issues will not be handled

description: Request a new feature

labels: feature-request
labels: Feature Request

body:

Expand Down
2 changes: 1 addition & 1 deletion .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exemptLabels:
- High Priority

# Label to use when marking an issue as stale
staleLabel: stale
staleLabel: Stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/standard-checks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Standard code checks (MyPy/Pylint/Black)
name: Standard code checks (MyPy/Pylint/Black/Isort)

on: [push, pull_request]

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ spotDL uses YouTube as a source for music downloads. This method is used to avoi

spotDL downloads music from YouTube and is designed to always download the highest possible bitrate; which is 128 kbps for regular users and 256 kbps for YouTube Music premium users.

Check the [Audio Formats](docs/USAGE.md#audio-formats-and-quality) page for more info.
Check the [Audio Formats](docs/usage.md#audio-formats-and-quality) page for more info.

## Contributing

Expand Down
923 changes: 465 additions & 458 deletions poetry.lock

Large diffs are not rendered by default.

44 changes: 26 additions & 18 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "spotdl"
version = "4.1.3"
version = "4.1.4"
description = "Download your Spotify playlists and songs along with album art and metadata"
license = "MIT"
authors = ["spotDL Team <[email protected]>"]
Expand Down Expand Up @@ -33,56 +33,58 @@ ytmusicapi = [
{version = "^0.22.0", python = "<3.8"},
{version = "^0.24.0", python = ">=3.8"},
]
pytube = "^12.1.2"
yt-dlp = "^2023.3.3"
pytube = "^12.1.3"
yt-dlp = "^2023.3.4"
mutagen = "^1.46.0"
rich = "^13.3.1"
beautifulsoup4 = "^4.11.2"
rich = "^13.3.3"
beautifulsoup4 = "^4.12.1"
requests = "^2.28.2"
rapidfuzz = "^2.13.7"
rapidfuzz = "^2.15.0"
python-slugify = {extras = ["unidecode"], version = "^8.0.1"}
uvicorn = "^0.20.0"
pydantic = "^1.10.5"
pydantic = "^1.10.7"
fastapi = "^0.89.1"
platformdirs = "^2.6.2"
pykakasi = "^2.2.1"
syncedlyrics = "^0.2.2"
syncedlyrics = "0.4.0"
typing-extensions = "^4.5.0"

[tool.poetry.dev-dependencies]
pytest = "^7.2.2"
pytest-mock = "^3.10.0"
pytest-vcr = "^1.0.2"
pyfakefs = "^5.1.0"
pyfakefs = "^5.2.0"
pytest-cov = "^4.0.0"
pytest-subprocess = "^1.5.0"
pytest-asyncio = "^0.20.3"
mypy = "^0.991"
pylint = "^2.16.3"
pylint = "^2.17.2"
black = "^22.12.0"
mdformat-gfm = "^0.3.5"
types-orjson = "^3.6.2"
types-python-slugify = "^7.0.0.1"
types-requests = "^2.28.11.15"
types-requests = "^2.28.11.17"
types-setuptools = "^65.7.0.4"
types-toml = "^0.10.8.5"
types-toml = "^0.10.8.6"
types-ujson = "^5.7.0.1"
pyinstaller = "^5.8.0"
pyinstaller = "^5.9.0"
mkdocs = "^1.4.2"
mkdocs-material = "^9.1.0"
isort = [
{version = "^5.11.4", python = "<3.8"},
{version = "^5.12.0", python = ">=3.8"},
]
dill = "^0.3.6"
mkdocs-material = "^9.1.5"
mkdocstrings = "^0.19.1"
mkdocstrings-python = "^0.8.3"
pymdown-extensions = "^9.9.2"
pymdown-extensions = "^9.10"
mkdocs-gen-files = "^0.4.0"
mkdocs-literate-nav = "^0.6.0"
mkdocs-section-index = "^0.3.5"

[tool.poetry.scripts]
spotdl = "spotdl:console_entry_point"

[tool.poetry.group.dev.dependencies]
isort = "^5.11.4"

[tool.isort]
profile = "black"

Expand All @@ -94,5 +96,11 @@ build-backend = "poetry.core.masonry.api"
limit-inference-results = 0
fail-under = 9

[tool.pytest.ini_options]
asyncio_mode = "auto"
markers = [
"vcr",
]

[mypy]
ignore_missing_imports = true
5 changes: 0 additions & 5 deletions pytest.ini

This file was deleted.

6 changes: 3 additions & 3 deletions scripts/docs/gen_ref_nav.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import mkdocs_gen_files

nav = mkdocs_gen_files.Nav()
nav = mkdocs_gen_files.Nav() # type: ignore

IGNORE = (
("_version",),
Expand Down Expand Up @@ -37,8 +37,8 @@
fd.write("::: spotdl")
continue

ident = "spotdl." + ".".join(parts)
fd.write(f"::: {ident}")
IDENT = "spotdl." + ".".join(parts)
fd.write(f"::: {IDENT}")

mkdocs_gen_files.set_edit_path(full_doc_path, path)

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.1.3"
__version__ = "4.1.4"
48 changes: 30 additions & 18 deletions spotdl/console/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
import asyncio
import logging
from pathlib import Path
from typing import List, Optional
from typing import List

from spotdl.download.downloader import Downloader
from spotdl.types.song import Song
from spotdl.utils.ffmpeg import FFMPEG_FORMATS
from spotdl.utils.metadata import embed_metadata, get_file_metadata
from spotdl.utils.search import get_search_results, get_song_from_file_metadata
from spotdl.utils.search import QueryError, get_search_results, reinit_song

__all__ = ["meta"]

Expand Down Expand Up @@ -53,6 +53,9 @@ def meta(query: List[str], downloader: Downloader) -> None:
def process_file(file: Path):
song_meta = get_file_metadata(file, downloader.settings["id3_separator"])

# Check if song has metadata
# and if it has all the required fields
# if it has all of these fields, we can assume that the metadata is correct
if song_meta and not downloader.settings["force_update_metadata"]:
if (
song_meta.get("artist")
Expand All @@ -64,28 +67,37 @@ def process_file(file: Path):
logger.info("Song already has metadata: %s", file.name)
return None

song: Optional[Song] = None
if not song_meta or None in [
song_meta.get("name"),
song_meta.get("album_art"),
song_meta.get("artist"),
song_meta.get("artists"),
song_meta.get("track_number"),
]:
logger.debug("Searching for metadata for %s", file.name)
# Same as above
if (
not song_meta
or None
in [
song_meta.get("name"),
song_meta.get("album_art"),
song_meta.get("artist"),
song_meta.get("artists"),
song_meta.get("track_number"),
]
or downloader.settings["force_update_metadata"]
):
# Song does not have metadata, or it is missing some fields
# or we are forcing update of metadata
# so we search for it
logger.debug("Searching metadata for %s", file.name)
search_results = get_search_results(file.stem)
if not search_results:
logger.error("Could not find metadata for %s", file.name)
return None

song = search_results[0]
else:
song = get_song_from_file_metadata(
file, downloader.settings["id3_separator"]
)

if song is None:
logger.error("Could not find metadata for %s", file.name)
return None
# Song has metadata, so we use it to reinitialize the song object
# and fill in the missing metadata
try:
song = reinit_song(Song.from_missing_data(**song_meta))
except QueryError:
logger.error("Could not find metadata for %s", file.name)
return None

# Check if the song has lyric
# if not use downloader to find lyrics
Expand Down
4 changes: 2 additions & 2 deletions spotdl/download/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def search_and_download(self, song: Song) -> Tuple[Song, Optional[Path]]:
) from exception

if self.settings["generate_lrc"]:
if is_lrc_valid(song.lyrics):
if song.lyrics and is_lrc_valid(song.lyrics):
lrc_data = song.lyrics
else:
try:
Expand All @@ -703,7 +703,7 @@ def search_and_download(self, song: Song) -> Tuple[Song, Optional[Path]]:
lrc_data = None

if lrc_data:
save_lrc_file(output_file.with_suffix(".lrc"), lrc_data)
save_lrc_file(str(output_file.with_suffix(".lrc")), lrc_data)
logger.debug("Saved lrc file for %s", song.display_name)
else:
logger.debug("No lrc file found for %s", song.display_name)
Expand Down
6 changes: 3 additions & 3 deletions spotdl/providers/audio/ytmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class YouTubeMusic(AudioProvider):

SUPPORTS_ISRC = True
GET_RESULTS_OPTS: List[Dict[str, Any]] = [
{"filter": "songs", "ignore_spelling": True},
{"filter": "videos", "ignore_spelling": True},
{"filter": "songs", "ignore_spelling": True, "limit": 50},
{"filter": "videos", "ignore_spelling": True, "limit": 50},
]

def __init__(self, *args: Any, **kwargs: Any) -> None:
Expand All @@ -40,7 +40,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
client_session = session()
if kwargs.get("geo_bypass"):
client_session.headers.update(
{"X-Forwarded-For": GeoUtils.random_ipv4("US")}
{"X-Forwarded-For": GeoUtils.random_ipv4("US")} # type: ignore
)

self.client = YTMusic(language="de", requests_session=client_session) # type: ignore
Expand Down
Loading

0 comments on commit ffcf230

Please sign in to comment.