Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat committed Feb 25, 2024
1 parent 789d056 commit 149b7a6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion spotdl/console/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def process_file(file: Path):
song.lyrics = song_meta.get("lyrics")

# Apply metadata to the song
embed_metadata(file, song, downloader.settings["skip_album_art"])
embed_metadata(file, song, skip_album_art=downloader.settings["skip_album_art"])

logger.info("Applied metadata to %s", file.name)

Expand Down
4 changes: 2 additions & 2 deletions spotdl/download/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ def search_and_download(self, song: Song) -> Tuple[Song, Optional[Path]]:
embed_metadata(
output_file,
song,
self.settings["skip_album_art"],
self.settings["id3_separator"],
id3_separator=self.settings["id3_separator"],
skip_album_art=self.settings["skip_album_art"],
)
except Exception as exception:
raise MetadataError(
Expand Down
2 changes: 1 addition & 1 deletion spotdl/types/saved.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def get_metadata(url: str = "saved") -> Tuple[Dict[str, Any], List[Song]]:
album_name=album_meta["name"],
album_artist=album_meta["artists"][0]["name"],
disc_number=track_meta["disc_number"],
duration=int(track_meta["duration_ms"]/1000),
duration=int(track_meta["duration_ms"] / 1000),
year=release_date[:4],
date=release_date,
track_number=track_meta["track_number"],
Expand Down
4 changes: 2 additions & 2 deletions spotdl/utils/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,17 @@ class MetadataError(Exception):
def embed_metadata(
output_file: Path,
song: Song,
skip_album_art: bool = False,
id3_separator: str = "/",
skip_album_art: Optional[bool] = False,
):
"""
Set ID3 tags for generic files (FLAC, OPUS, OGG)
### Arguments
- output_file: Path to the output file.
- song: Song object.
- skip_album_art: Boolean to skip album art embedding.
- id3_separator: The separator used for the id3 tags.
- skip_album_art: Boolean to skip album art embedding.
"""

# Get the file extension for the output file
Expand Down
7 changes: 7 additions & 0 deletions tests/test_matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,13 @@
# "https://www.youtube.com/watch?v=DKu9fWMpK3A",
# ],
# ),
(
# The Smiths - Bigmouth Strikes Again - 2011 Remaster
"https://open.spotify.com/track/2OErSh4oVVAUll0vHxdr6p",
[
"https://music.youtube.com/watch?v=XW1Riwvr9SU",
],
),
],
)
def test_ytmusic_matching(monkeypatch, query, expected):
Expand Down

0 comments on commit 149b7a6

Please sign in to comment.