Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line options for skip and successful file #386

Merged
merged 3 commits into from
Oct 7, 2018
Merged

Conversation

linusg
Copy link
Contributor

@linusg linusg commented Oct 4, 2018

Closes #296.

Adding two command line flags: -sk/--skip and -w/--write-successful. Both have the same format, so using the same file with both flags is possible:

spotdl -l playlist.txt -w skip.txt -sk skip.txt

I.e. successfully downloaded tracks will land in skip.txt and thus being skipped directly when creating and downloading the track file again.

@linusg
Copy link
Contributor Author

linusg commented Oct 4, 2018

Also I fixed a bug where the tracks file would contain multiple songs in one line:

Since we use '\n'.join(...) for (over)writing the file, there will be no newline at the end.
(Verified by returning right after this, but the theory is simple anyway.)

https://github.com/ritiek/spotify-downloader/blob/e076d11a19672b1b08119dce846358747c203df7/spotdl/spotdl.py#L74

When we then append raw_song + '\n', it will be on the same line as the last song!

https://github.com/ritiek/spotify-downloader/blob/e076d11a19672b1b08119dce846358747c203df7/spotdl/spotdl.py#L97

spotdl/spotdl.py Outdated
@@ -193,7 +209,7 @@ def main():
if const.args.song:
download_single(raw_song=const.args.song)
elif const.args.list:
download_list(text_file=const.args.list)
download_list(tracks_file=const.args.list, skip_file=const.args.skip, write_successful_file=const.args.write_successful)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is really long. Best we break it into lines like:

download_list(tracks_file=const.args.list,
              skip_file=const.args.skip,
              write_successful_file=const.args.write_successful)

@ritiek
Copy link
Member

ritiek commented Oct 7, 2018

I left a minor comment but looks good to me overall. We could merge this once it has been addressed.

@linusg
Copy link
Contributor Author

linusg commented Oct 7, 2018

You're right, that was quick copy and paste 😉
I'd love to introduce the usage of a style guide/autoformatter (I personally love black), but that's another issue.

Copy link
Member

@ritiek ritiek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this. Thanks @linusg!

@ritiek ritiek merged commit a565d44 into master Oct 7, 2018
@ritiek ritiek deleted the skip-file branch October 7, 2018 22:32
@ritiek ritiek added this to the v1.1.0 milestone Nov 13, 2018
@ritiek ritiek mentioned this pull request Nov 13, 2018
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants