mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Write tracks to custom file with --write-to (#507)
* Write tracks to custom file * Update CHANGES.md
This commit is contained in:
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Added
|
### Added
|
||||||
|
- `--write-to` parameter for setting custom file to write Spotify track URLs to ([@ritiek](https://github.com/ritiek)) (#507)
|
||||||
- Set custom Spotify Client ID and Client Secret via config.yml ([@ManveerBasra](https://github.com/ManveerBasra)) (#502)
|
- Set custom Spotify Client ID and Client Secret via config.yml ([@ManveerBasra](https://github.com/ManveerBasra)) (#502)
|
||||||
- Use YouTube as fallback metadata if track not found on Spotify. Also added `--no-fallback-metadata`
|
- Use YouTube as fallback metadata if track not found on Spotify. Also added `--no-fallback-metadata`
|
||||||
to preserve old behaviour ([@ritiek](https://github.com/ritiek)) (#457)
|
to preserve old behaviour ([@ritiek](https://github.com/ritiek)) (#457)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ default_conf = {
|
|||||||
"overwrite": "prompt",
|
"overwrite": "prompt",
|
||||||
"input-ext": ".m4a",
|
"input-ext": ".m4a",
|
||||||
"output-ext": ".mp3",
|
"output-ext": ".mp3",
|
||||||
|
"write-to": None,
|
||||||
"trim-silence": False,
|
"trim-silence": False,
|
||||||
"download-only-metadata": False,
|
"download-only-metadata": False,
|
||||||
"dry-run": False,
|
"dry-run": False,
|
||||||
@@ -184,6 +185,11 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
|||||||
default=config["output-ext"],
|
default=config["output-ext"],
|
||||||
help="preferred output format .mp3, .m4a (AAC), .flac, etc.",
|
help="preferred output format .mp3, .m4a (AAC), .flac, etc.",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--write-to",
|
||||||
|
default=config["write-to"],
|
||||||
|
help="write tracks from Spotify playlist, album, etc. to this file",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-ff",
|
"-ff",
|
||||||
"--file-format",
|
"--file-format",
|
||||||
@@ -306,6 +312,12 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
|
|||||||
if parsed.avconv and parsed.trim_silence:
|
if parsed.avconv and parsed.trim_silence:
|
||||||
parser.error("--trim-silence can only be used with FFmpeg")
|
parser.error("--trim-silence can only be used with FFmpeg")
|
||||||
|
|
||||||
|
if parsed.write_to and not (parsed.playlist \
|
||||||
|
or parsed.album \
|
||||||
|
or parsed.all_albums \
|
||||||
|
or parsed.username):
|
||||||
|
parser.error("--write-to can only be used with --playlist, --album, --all-albums, or --username")
|
||||||
|
|
||||||
parsed.log_level = log_leveller(parsed.log_level)
|
parsed.log_level = log_leveller(parsed.log_level)
|
||||||
|
|
||||||
return parsed
|
return parsed
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ def match_args():
|
|||||||
track_dl.download_single()
|
track_dl.download_single()
|
||||||
elif const.args.list:
|
elif const.args.list:
|
||||||
if const.args.write_m3u:
|
if const.args.write_m3u:
|
||||||
youtube_tools.generate_m3u(track_file=const.args.list)
|
youtube_tools.generate_m3u(track_file=const.args.list,
|
||||||
|
text_file=const.args.write_to)
|
||||||
else:
|
else:
|
||||||
list_dl = downloader.ListDownloader(
|
list_dl = downloader.ListDownloader(
|
||||||
tracks_file=const.args.list,
|
tracks_file=const.args.list,
|
||||||
@@ -37,13 +38,17 @@ def match_args():
|
|||||||
)
|
)
|
||||||
list_dl.download_list()
|
list_dl.download_list()
|
||||||
elif const.args.playlist:
|
elif const.args.playlist:
|
||||||
spotify_tools.write_playlist(playlist_url=const.args.playlist)
|
spotify_tools.write_playlist(playlist_url=const.args.playlist,
|
||||||
|
text_file=const.args.write_to)
|
||||||
elif const.args.album:
|
elif const.args.album:
|
||||||
spotify_tools.write_album(album_url=const.args.album)
|
spotify_tools.write_album(album_url=const.args.album,
|
||||||
|
text_file=const.args.write_to)
|
||||||
elif const.args.all_albums:
|
elif const.args.all_albums:
|
||||||
spotify_tools.write_all_albums_from_artist(artist_url=const.args.all_albums)
|
spotify_tools.write_all_albums_from_artist(artist_url=const.args.all_albums,
|
||||||
|
text_file=const.args.write_to)
|
||||||
elif const.args.username:
|
elif const.args.username:
|
||||||
spotify_tools.write_user_playlist(username=const.args.username)
|
spotify_tools.write_user_playlist(username=const.args.username,
|
||||||
|
text_file=const.args.write_to)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user