mikez / spotify-folders

Get your Spotify folder hierarchy with playlists into JSON.
MIT License
60 stars 6 forks source link

Add playlist names to the JSON output #3

Closed AlexSWall closed 2 years ago

AlexSWall commented 4 years ago

A simple change which adds the playlist names to the JSON output.

Feel free to modify my code to conform to any error checking or style you'd like. I attempted to keep it consistent with the current style.

mikez commented 4 years ago

@AlexSWall, good job on finding the playlist names! I ran it locally on my computer and it worked like a charm. 😊

Question: would this also support the use case of one computer with multiple Spotify accounts? See --account when running spotifyfolders --help for details.

AlexSWall commented 4 years ago

Thanks, good to hear. 🙂

I can't see why it wouldn't. The only problem apparent to me is that the file with the playlist folder names will not be found if the account has zero or one playlists, and I think there's a small chance if they only have two playlists? This is because the code looks for the file with the most entries of the text 'spotify:playlist', but this is not a clear winner when the number of playlists is very few. Some error checking could be added for this, which is what I alluded to before, if so desired.

mikez commented 4 years ago

@AlexSWall To clarify, say two people use the same computer: Person A is the father and has lots of Rock playlists. Person B is the child and has playlists of Ambient music. Spotify stores their cache files in the same place. In this case, there might be one file with playlist folder names for A and one file for B.

AlexSWall commented 4 years ago

Ah, I see, I wasn't aware of that, in which case I'm not sure. I suspect finding all files with more than two (or so) of such entries would work well. I can look into this and make modifications at some point in the future, I doubt it'd take long, but as a heads-up I won't be doing that immediately.

mikez commented 4 years ago

@AlexSWall 👍

mikez commented 2 years ago

Closing due to inactivity. Feel free to open again.