Automating inserting songs into playlist

Need help? Post your questions here.

Moderator: moderators

Automating inserting songs into playlist

Postby voja » Fri Oct 22, 2021 10:31 am

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 :)
User avatar
voja
 
Posts: 3
Joined: Fri Oct 22, 2021 10:04 am

Re: Automating inserting songs into playlist

Postby J_T_W » Fri Oct 22, 2021 4:14 pm

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.
J_T_W
 
Posts: 93
Joined: Fri May 03, 2013 2:13 pm

Re: Automating inserting songs into playlist

Postby voja » Fri Oct 22, 2021 4:34 pm

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?
User avatar
voja
 
Posts: 3
Joined: Fri Oct 22, 2021 10:04 am

Re: Automating inserting songs into playlist

Postby J_T_W » Fri Oct 22, 2021 5:09 pm

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.
J_T_W
 
Posts: 93
Joined: Fri May 03, 2013 2:13 pm

Re: Automating inserting songs into playlist

Postby voja » Sat Oct 23, 2021 12:13 pm

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!
User avatar
voja
 
Posts: 3
Joined: Fri Oct 22, 2021 10:04 am


Return to Help

Who is online

Users browsing this forum: No registered users and 23 guests