Page 1 of 1

Automating inserting songs into playlist

PostPosted: Fri Oct 22, 2021 10:31 am
by voja
I want to make a script that will take my recently "loved" tracks from LastFM and add them to a playlist of liked songs. I already have the LastFM part figured out, I just don't know of a good way to make queries to the database in the background.
I tried making queries with https://mysubsonic.com/db.view?query=, but that required the browser and I wouldn't work well in the background, and I've tried using hsqldb-sqltool to access the database directly, but this somehow corrupted my database.
If anyone has an idea of how I could access the database without the browser or some other approach to this, it would be greatly appreciated :)

Re: Automating inserting songs into playlist

PostPosted: Fri Oct 22, 2021 4:14 pm
by J_T_W
You might find it simpler to not directly interact with the Subsonic DB, but rather have your script build playlist files within a directory configured within Subsonic to automatically import from. That would give you more "permanent" playlists that doesn't rely on the stability of the Subsonic DB, and which are easier to port when you move off of Subsonic to something like Airsonic Advanced or Navidrome.

Re: Automating inserting songs into playlist

PostPosted: Fri Oct 22, 2021 4:34 pm
by voja
J_T_W wrote:You might find it simpler to not directly interact with the Subsonic DB, but rather have your script build playlist files within a directory configured within Subsonic to automatically import from. That would give you more "permanent" playlists that doesn't rely on the stability of the Subsonic DB, and which are easier to port when you move off of Subsonic to something like Airsonic Advanced or Navidrome.


That's what I wanted to do originally, I wanted to just add files to a playlist file (like .m3u or something), but I couldn't figure out where Subsonic stored those files or where they're imported from. Could you explain further?

Re: Automating inserting songs into playlist

PostPosted: Fri Oct 22, 2021 5:09 pm
by J_T_W
Create any standard M3U or M3U8 file without any additional info short of the path to the file to include. Make sure the path to the file has the same root as what you've configured in Subsonic (Settings/Media Folders/[Folder root]) or it won't be found. Save the playlist to any accessible location. Within Subsonic, go to Settings/General and specify that path in the "Import playlists from" field. That's pretty much it. They playlists are scanned whenever the media folders are scanned. I've personally had mixed results when a previously scanned playlist is updated within the file (sometimes updates in Subsonic, sometimes not) but always good luck when a new playlist is added. Don't add new songs from the GUI into any imported playlist as that will sever the link.

Re: Automating inserting songs into playlist

PostPosted: Sat Oct 23, 2021 12:13 pm
by voja
J_T_W wrote:Create any standard M3U or M3U8 file without any additional info short of the path to the file to include. Make sure the path to the file has the same root as what you've configured in Subsonic (Settings/Media Folders/[Folder root]) or it won't be found. Save the playlist to any accessible location. Within Subsonic, go to Settings/General and specify that path in the "Import playlists from" field. That's pretty much it. They playlists are scanned whenever the media folders are scanned. I've personally had mixed results when a previously scanned playlist is updated within the file (sometimes updates in Subsonic, sometimes not) but always good luck when a new playlist is added. Don't add new songs from the GUI into any imported playlist as that will sever the link.


I can't believe I didn't notice that -_-. Thank you so much!