Merge pull request #442 from ritiek/download-multiple-tracks

Pass multiple tracks at once in --song argument
This commit is contained in:
Linus Groh
2018-12-04 18:01:41 +01:00
committed by GitHub
3 changed files with 10 additions and 3 deletions

View File

@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [Unreleased]
### Added
- Ability to pass multiple tracks with `-s` option ([@ritiek](https://github.com/ritiek)) (#442)
### Changed
- Refactored core downloading module ([@ritiek](https://github.com/ritiek)) (#410)

View File

@@ -99,7 +99,10 @@ def get_arguments(raw_args=None, to_group=True, to_merge=True):
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument(
"-s", "--song", help="download track by spotify link or name"
"-s",
"--song",
nargs='+',
help="download track by spotify link or name"
)
group.add_argument("-l", "--list", help="download tracks from a file")
group.add_argument(

View File

@@ -22,8 +22,9 @@ def debug_sys_info():
def match_args():
if const.args.song:
track_dl = downloader.Downloader(raw_song=const.args.song)
track_dl.download_single()
for track in const.args.song:
track_dl = downloader.Downloader(raw_song=track)
track_dl.download_single()
elif const.args.list:
if const.args.write_m3u:
youtube_tools.generate_m3u(track_file=const.args.list)