mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
937ed6ebcc | ||
|
|
4b5ec6121c | ||
|
|
ade55c6dba | ||
|
|
75311e56d1 | ||
|
|
dc829815f5 | ||
|
|
9ecf957c81 | ||
|
|
ea4ff29e52 | ||
|
|
33e07bea9d | ||
|
|
94e06f99de | ||
|
|
9a594d37c7 | ||
|
|
b45f75b5ca | ||
|
|
75114bc26e | ||
|
|
456b404e73 | ||
|
|
43f9dd7f8d | ||
|
|
b24802f815 | ||
|
|
851d88fdd8 | ||
|
|
4ee2b51550 | ||
|
|
c73f55b8ce | ||
|
|
e47744f99c | ||
|
|
5d185844d7 | ||
|
|
7f587fe667 |
18
CHANGES.md
18
CHANGES.md
@@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.2.6] (Hotfix Release) - 2020-03-02
|
||||||
|
### Fixed
|
||||||
|
Embed release date metadata only when available (follow up of #672) ([@ritiek](https://github.com/ritiek)) (#674)
|
||||||
|
|
||||||
|
## [1.2.5] - 2020-03-02
|
||||||
|
### Fixed
|
||||||
|
- Skip crash when accessing YouTube-API-only fields in scrape mode ([@ritiek](https://github.com/ritiek)) (#672)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Changed FFMPEG args to convert to 48k quality audio instead of the current 44k audio. ([@AvinashReddy3108](https://github.com/AvinashReddy3108)) (#667)
|
||||||
|
|
||||||
|
## [1.2.4] - 2020-01-10
|
||||||
|
### Fixed
|
||||||
|
- Fixed a crash occuring when lyrics for a track are not yet released
|
||||||
|
on Genius ([@ritiek](https://github.com/ritiek)) (#654)
|
||||||
|
- Fixed a regression where a track would fail to download if it isn't
|
||||||
|
found on Spotify ([@ritiek](https://github.com/ritiek)) (#653)
|
||||||
|
|
||||||
## [1.2.3] - 2019-12-20
|
## [1.2.3] - 2019-12-20
|
||||||
### Added
|
### Added
|
||||||
- Added `--no-remove-original-file` ([@NightMachinary](https://github.com/NightMachinary)) (#580)
|
- Added `--no-remove-original-file` ([@NightMachinary](https://github.com/NightMachinary)) (#580)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
__version__ = "1.2.3"
|
__version__ = "1.2.6"
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class Converter:
|
|||||||
|
|
||||||
if self.input_ext == ".m4a":
|
if self.input_ext == ".m4a":
|
||||||
if self.output_ext == ".mp3":
|
if self.output_ext == ".mp3":
|
||||||
ffmpeg_params = "-codec:v copy -codec:a libmp3lame -ar 44100 "
|
ffmpeg_params = "-codec:v copy -codec:a libmp3lame -ar 48000 "
|
||||||
elif self.output_ext == ".webm":
|
elif self.output_ext == ".webm":
|
||||||
ffmpeg_params = "-codec:a libopus -vbr on "
|
ffmpeg_params = "-codec:a libopus -vbr on "
|
||||||
elif self.output_ext == ".m4a":
|
elif self.output_ext == ".m4a":
|
||||||
@@ -125,12 +125,12 @@ class Converter:
|
|||||||
|
|
||||||
elif self.input_ext == ".webm":
|
elif self.input_ext == ".webm":
|
||||||
if self.output_ext == ".mp3":
|
if self.output_ext == ".mp3":
|
||||||
ffmpeg_params = "-codec:a libmp3lame -ar 44100 "
|
ffmpeg_params = "-codec:a libmp3lame -ar 48000 "
|
||||||
elif self.output_ext == ".m4a":
|
elif self.output_ext == ".m4a":
|
||||||
ffmpeg_params = "-cutoff 20000 -codec:a aac -ar 44100 "
|
ffmpeg_params = "-cutoff 20000 -codec:a aac -ar 48000 "
|
||||||
|
|
||||||
if self.output_ext == ".flac":
|
if self.output_ext == ".flac":
|
||||||
ffmpeg_params = "-codec:a flac -ar 44100 "
|
ffmpeg_params = "-codec:a flac -ar 48000 "
|
||||||
|
|
||||||
# add common params for any of the above combination
|
# add common params for any of the above combination
|
||||||
ffmpeg_params += "-b:a 192k -vn "
|
ffmpeg_params += "-b:a 192k -vn "
|
||||||
|
|||||||
@@ -93,7 +93,10 @@ def format_string(
|
|||||||
format_tags[9] = tags["track_number"]
|
format_tags[9] = tags["track_number"]
|
||||||
format_tags[10] = tags["total_tracks"]
|
format_tags[10] = tags["total_tracks"]
|
||||||
format_tags[11] = tags["external_ids"]["isrc"]
|
format_tags[11] = tags["external_ids"]["isrc"]
|
||||||
format_tags[12] = tags["id"]
|
try:
|
||||||
|
format_tags[12] = tags["id"]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
format_tags_sanitized = {
|
format_tags_sanitized = {
|
||||||
k: sanitize_title(str(v), ok="'-_()[]{}") if slugification else str(v)
|
k: sanitize_title(str(v), ok="'-_()[]{}") if slugification else str(v)
|
||||||
|
|||||||
@@ -37,8 +37,10 @@ class Genius(LyricBase):
|
|||||||
def _get_lyrics_text(self, html):
|
def _get_lyrics_text(self, html):
|
||||||
soup = BeautifulSoup(html, "html.parser")
|
soup = BeautifulSoup(html, "html.parser")
|
||||||
lyrics_paragraph = soup.find("p")
|
lyrics_paragraph = soup.find("p")
|
||||||
lyrics = lyrics_paragraph.get_text()
|
if lyrics_paragraph:
|
||||||
return lyrics
|
return lyrics_paragraph.get_text()
|
||||||
|
else:
|
||||||
|
raise LyricsNotFound("The lyrics for this track are yet to be released.")
|
||||||
|
|
||||||
def get_lyrics(self, linesep="\n", timeout=None):
|
def get_lyrics(self, linesep="\n", timeout=None):
|
||||||
url = self._guess_lyric_url()
|
url = self._guess_lyric_url()
|
||||||
|
|||||||
@@ -76,8 +76,9 @@ class EmbedMetadata:
|
|||||||
# https://github.com/quodlibet/mutagen/blob/master/mutagen/id3/_frames.py
|
# https://github.com/quodlibet/mutagen/blob/master/mutagen/id3/_frames.py
|
||||||
# Each class represents an id3 tag
|
# Each class represents an id3 tag
|
||||||
audiofile = ID3(music_file)
|
audiofile = ID3(music_file)
|
||||||
audiofile["TORY"] = TORY(encoding=3, text=meta_tags["year"])
|
if meta_tags["year"]:
|
||||||
audiofile["TYER"] = TYER(encoding=3, text=meta_tags["year"])
|
audiofile["TORY"] = TORY(encoding=3, text=meta_tags["year"])
|
||||||
|
audiofile["TYER"] = TYER(encoding=3, text=meta_tags["year"])
|
||||||
if meta_tags["publisher"]:
|
if meta_tags["publisher"]:
|
||||||
audiofile["TPUB"] = TPUB(encoding=3, text=meta_tags["publisher"])
|
audiofile["TPUB"] = TPUB(encoding=3, text=meta_tags["publisher"])
|
||||||
audiofile["COMM"] = COMM(
|
audiofile["COMM"] = COMM(
|
||||||
@@ -109,7 +110,8 @@ class EmbedMetadata:
|
|||||||
meta_tags = self.meta_tags
|
meta_tags = self.meta_tags
|
||||||
audiofile = MP4(music_file)
|
audiofile = MP4(music_file)
|
||||||
self._embed_basic_metadata(audiofile, preset=M4A_TAG_PRESET)
|
self._embed_basic_metadata(audiofile, preset=M4A_TAG_PRESET)
|
||||||
audiofile[M4A_TAG_PRESET["year"]] = meta_tags["year"]
|
if meta_tags["year"]:
|
||||||
|
audiofile[M4A_TAG_PRESET["year"]] = meta_tags["year"]
|
||||||
audiofile[M4A_TAG_PRESET["comment"]] = meta_tags["external_urls"][self.provider]
|
audiofile[M4A_TAG_PRESET["comment"]] = meta_tags["external_urls"][self.provider]
|
||||||
if meta_tags["lyrics"]:
|
if meta_tags["lyrics"]:
|
||||||
audiofile[M4A_TAG_PRESET["lyrics"]] = meta_tags["lyrics"]
|
audiofile[M4A_TAG_PRESET["lyrics"]] = meta_tags["lyrics"]
|
||||||
@@ -130,7 +132,8 @@ class EmbedMetadata:
|
|||||||
meta_tags = self.meta_tags
|
meta_tags = self.meta_tags
|
||||||
audiofile = FLAC(music_file)
|
audiofile = FLAC(music_file)
|
||||||
self._embed_basic_metadata(audiofile)
|
self._embed_basic_metadata(audiofile)
|
||||||
audiofile["year"] = meta_tags["year"]
|
if meta_tags["year"]:
|
||||||
|
audiofile["year"] = meta_tags["year"]
|
||||||
audiofile["comment"] = meta_tags["external_urls"][self.provider]
|
audiofile["comment"] = meta_tags["external_urls"][self.provider]
|
||||||
if meta_tags["lyrics"]:
|
if meta_tags["lyrics"]:
|
||||||
audiofile["lyrics"] = meta_tags["lyrics"]
|
audiofile["lyrics"] = meta_tags["lyrics"]
|
||||||
@@ -155,8 +158,9 @@ class EmbedMetadata:
|
|||||||
if meta_tags["album"]["name"]:
|
if meta_tags["album"]["name"]:
|
||||||
audiofile[preset["album"]] = meta_tags["album"]["name"]
|
audiofile[preset["album"]] = meta_tags["album"]["name"]
|
||||||
audiofile[preset["title"]] = meta_tags["name"]
|
audiofile[preset["title"]] = meta_tags["name"]
|
||||||
audiofile[preset["date"]] = meta_tags["release_date"]
|
if meta_tags["release_date"]:
|
||||||
audiofile[preset["originaldate"]] = meta_tags["release_date"]
|
audiofile[preset["date"]] = meta_tags["release_date"]
|
||||||
|
audiofile[preset["originaldate"]] = meta_tags["release_date"]
|
||||||
if meta_tags["genre"]:
|
if meta_tags["genre"]:
|
||||||
audiofile[preset["genre"]] = meta_tags["genre"]
|
audiofile[preset["genre"]] = meta_tags["genre"]
|
||||||
if meta_tags["copyright"]:
|
if meta_tags["copyright"]:
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ def generate_metadata(content):
|
|||||||
"artists": [{"name": None}],
|
"artists": [{"name": None}],
|
||||||
"name": None,
|
"name": None,
|
||||||
},
|
},
|
||||||
"year": content.published.split("-")[0],
|
"year": None,
|
||||||
"release_date": content.published.split(" ")[0],
|
"release_date": None,
|
||||||
"type": "track",
|
"type": "track",
|
||||||
"disc_number": 1,
|
"disc_number": 1,
|
||||||
"track_number": 1,
|
"track_number": 1,
|
||||||
@@ -122,6 +122,14 @@ def generate_metadata(content):
|
|||||||
"genre": None,
|
"genre": None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Workaround for
|
||||||
|
# https://github.com/ritiek/spotify-downloader/issues/671
|
||||||
|
try:
|
||||||
|
meta_tags["year"] = content.published.split("-")[0]
|
||||||
|
meta_tags["release_date"] = content.published.split(" ")[0]
|
||||||
|
except pafy.util.GdataError:
|
||||||
|
pass
|
||||||
|
|
||||||
return meta_tags
|
return meta_tags
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user