webamp
webamp copied to clipboard
Please load playlist from external JSON file
For make this:
- add few lines to ./js/config.ts:
import myPlaylist from "./../mp3/playlist.json";
console.log('myPlaylist', myPlaylist);
config.initialTracks = myPlaylist;
- Create file ./mp3/playlit.json
Hey @sciner, could you explain a bit more what you are trying to do?
From what I can tell, your existing step one should work already. Are you looking for a way to export the current Webamp playlist?
I propose to remove the playlist from the code to an external file.
Are you suggesting that we do this on the demo site, or are you looking for a way to do this with your own project?
Yes, I propose to do it on the demo site. Is it bad?
What would we gain by storing the playlist in a json file?
- Separation of logic from data
- The ability to download a playlist from any other site without having to edit the configuration file
- The playlist is in the configuration file, although it is not a configuration item.
You're correct that it would probably be a little bit cleaner to at least move the playlist to its own file (.js might be just as good as json).
Currently it's very tricky to setup a server to serve media files with the correct CORs headers so that Webamp can correctly read them. Because of this, I have not publicly exposed features that allow users to provide URLs to external media files. I suspect it would create a large support burden for us, and that very few people would actually have the combination of control of their server and technical know-how to set it up correctly.
Would you like to open a pull request to move the playlist out into its own file? I don't think I currently have bandwidth to take on a cleanup task like this, but if your interested in doing it, I'd gladly merge the pull request.
hi, i'm looking for something similar for a little project of mine, basically have a very slimmed downed version of webamp in a bash for loop that inserts the name of the json file as the playlist inside each html page
is this possible or something that might be in the future plans for this project?
sorry for commenting on this few years old issue but i figured it's better than opening a duplicate
edit: i ended up manually adding the links to the pages, kind of hard to keep updated but at least i've came up with a way to do it efficiently, still would appreciate such an option but it's not a priority for me anymore