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

Generate an M3U playlist from the downloaded files #279

Open
badrihippo opened this issue Jul 2, 2022 · 2 comments
Open

Generate an M3U playlist from the downloaded files #279

badrihippo opened this issue Jul 2, 2022 · 2 comments

Comments

@badrihippo
Copy link

Is your feature request related to a problem? Please describe.
My original problem was that I wanted my downloaded files to be played in the same order as the original playlist. As I was opening this issue, I discovered the -k option which does just that: prepending a number to the files so they play in order!

That said, it would still be handy to have an M3U playlist file which plays all the songs in order even if they aren't numbered using -k. One reason is simply that the numbers feel a bit messy, but also, it'll be easier to have one song in muliple playlists: imagine having all the songs together in one folder, and then .m3u files to decide which sequence you'd like.

Describe the solution you'd like
I'm thinking something like a --generate-playlist option which creates the .m3u file. Since spotify-dl is already generating a downloaded-songs.txt, I'm guessing it would be easy to implement another dump, but with the final filenames instead of the original YouTube IDs? I don't mind giving it a shot if you show me where 🙂

Describe alternatives you've considered
I can actually implement this manually with a few extra steps. Suppose I want one playlist with all the files but without the numbers at the beginning of the filename, I could:

  1. Download using spotify-dl with the -k option
  2. Open the songs in some music player software, and save them as a playlist
  3. Do a bulk rename on the files to get rid of the number prefix
  4. Run a "find and replace" on the playlist to remove the number prefix

Either way I'd need to do additional work to have my music collection just the way I want it, which is out of scope for a project like spotify-dl! But still, if this is easy to implement it'd be a handy feature to have 💭

Additional context
I think this would be especially useful when combined with some of the other feature requests like #177. With those two, we can actually choose to download all songs to one big folder instead of segregating them by playlist, and still have individual .m3u files for each. (Of course, people might want more subtleties like organising the folders by artist or album instead of by playlist, but that's probably something spotify-dl can't really help with at this point)

@SathyaBhat
Copy link
Owner

Hi @badrihippo I didn't think many people would be using m3u playlists to this date. I can certainly see the appeal. a PR to include this feature is welcome.

https://github.com/SathyaBhat/spotify-dl/blob/master/spotify_dl/spotify_dl.py

Is the main entry point of the script and the songs dictionary has details fetched from Spotify API. Hope this is good enough to get you started

https://github.com/SathyaBhat/spotify-dl/blob/master/spotify_dl/spotify_dl.py#L94

@badrihippo
Copy link
Author

Oops, sorry, I somehow missed this notification till now! Thanks for the info @SathyaBhat, I'll take a look when I have the time and send in a PR 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants