Playlist Export Script

Third-party modifications and add-ons, Apps and Clients

Moderator: moderators

Playlist Export Script

Postby flat-herc » Tue Aug 20, 2013 5:30 pm

Hi,
i've build a small Java Application to export all my Subsonic playlists to m3u files on my fileshare. Seen that many guys are searching for such a script so i've attached the code. If you call the Script via Console without Parameters, you'll get a small help. Some parts of the code are dirty hack, but it works ;) In line 57 i'm just modifying the path, as the path is different when i access the playlist via fileshare. I've outcommented this part but you can edit it as you want to.

Greetings
flat-herc
Last edited by flat-herc on Tue Aug 20, 2013 10:41 pm, edited 1 time in total.
flat-herc
 
Posts: 4
Joined: Tue Aug 20, 2013 5:21 pm

Re: Playlist Export Script

Postby daneren2005 » Tue Aug 20, 2013 5:51 pm

I'm going to have to try this on a daily cron job. Thanks for sharing!
Developer of DSub for Android
daneren2005
 
Posts: 1709
Joined: Fri Jul 06, 2012 7:52 pm

Re: Playlist Export Script

Postby flat-herc » Tue Aug 20, 2013 10:39 pm

Pretty much the same what i'am doing with it. I'm using a Cron Job to serve my DLNA Server with the playlist files.

Had some issues with Character Encoding (as always :evil: ). Fixed it in the attached file.
flat-herc
 
Posts: 4
Joined: Tue Aug 20, 2013 5:21 pm

Re: Playlist Export Script

Postby Jägs » Thu Oct 31, 2013 1:15 am

Pardon my ignorance, but how does one "run" this? I tried doing:

Code: Select all
java SubsonicPlaylistExporterWeb.java


but I received an error:

Code: Select all
Exception in thread "main" java.lang.NoClassDefFoundError: SubsonicPlaylistExporterWeb/java
Caused by: java.lang.ClassNotFoundException: SubsonicPlaylistExporterWeb.java
   at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: SubsonicPlaylistExporterWeb.java. Program will exit.


What am I doing wrong? I'm running Subsonic on Ubuntu 13.04, if that helps.
Jägs
 
Posts: 109
Joined: Wed Apr 06, 2011 9:52 pm

Re: Playlist Export Script

Postby flat-herc » Mon Nov 04, 2013 10:37 pm

You have to compile it first with:
Code: Select all
javac SubsonicPlaylistExporterWeb.java


Then you can run it with
Code: Select all
java SubsonicPlaylistExporterWeb
flat-herc
 
Posts: 4
Joined: Tue Aug 20, 2013 5:21 pm

Re: Playlist Export Script

Postby Jägs » Tue Nov 05, 2013 1:55 am

Brilliant! It worked! I am now happily rebuilding playlists, hopefully for the last time. Thanks!
Jägs
 
Posts: 109
Joined: Wed Apr 06, 2011 9:52 pm

Re: Playlist Export Script

Postby tsquillario » Fri Dec 27, 2013 2:23 am

Thanks for this! Trying to get my playlists into XBMC.
Jamstash Developer
Chrome App - https://chrome.google.com/webstore/detail/jccdpflnecheidefpofmlblgebobbloc
Beta Site - http://beta.jamstash.com
GitHub Project - https://github.com/tsquillario/Jamstash
User avatar
tsquillario
 
Posts: 206
Joined: Thu Jun 30, 2011 5:10 pm
Location: State College, PA

Re: Playlist Export Script

Postby unimatrix27 » Sun Jan 12, 2014 4:50 pm

Hi,

how exactly do i give as argument the username/password? i have tried this:

java SubsonicPlaylistExporterWeb "http://192.168.2.2:4040/db.view?query=" myuser:mypass .

but I always get 401 error (no access)

i also wonder how the playlist is sorted. i have executed the query to db.view manually with the browser but the order of songs is not according to what i get in the subsonic user interface or the Android APP.
unimatrix27
 
Posts: 5
Joined: Sun Jan 12, 2014 9:58 am

Re: Playlist Export Script

Postby flat-herc » Sun Jan 12, 2014 5:55 pm

The user:pass has to be in Base64. You can encode your username:Password String here: http://www.base64encode.org/
Haven't had any trouble with the sorting yet. The Sorting is just done by an ID within the Query at line 70.
flat-herc
 
Posts: 4
Joined: Tue Aug 20, 2013 5:21 pm

Re: Playlist Export Script

Postby unimatrix27 » Mon Jan 13, 2014 6:13 am

Hi,

ok the base64 encoding I should have realized that...thanks!

THe sorting is still a problem for me. When I move a track in a playlist e.g. from the last position to the second last position in the subsonic webif, this is obviously saved somewhere by Subsonic, because when I then update this playlist on my Android APP, the move of the song is reflected there.

However reexporting the list from the DB does not reflect the new sorting. Not really a problem of your script because as far as I have compared the DB the new sorting is not part of it! So I really start to wonder where this info is saved :(

I also tried the REST APi functions, but the same problem there. Which is even more strange as I thought the android app is also using it. I will look into it further...
unimatrix27
 
Posts: 5
Joined: Sun Jan 12, 2014 9:58 am

Re: Playlist Export Script

Postby Octacon100 » Sat Feb 01, 2014 10:21 pm

Thanks for this, it really saved me a lot of effort!
Octacon100
 
Posts: 4
Joined: Wed Sep 12, 2012 6:49 pm

Re: Playlist Export Script

Postby Octacon100 » Sun Feb 23, 2014 3:26 pm

Hi,

I've been able to edit the playlist exporter so that it will work on windows, and so that the exported playlists will work in itunes and windows media player.

The playlists are now exported with the songs in the same order that they are in on your subsonic server. With some other cmd scripts, perl scripts and auto hot key scripts, you can import the exported playlists into itunes. If anyone is interested in that code, let me know and I'll upload it.

Hope it helps!
Octacon100
 
Posts: 4
Joined: Wed Sep 12, 2012 6:49 pm

Re: Playlist Export Script

Postby loubat » Tue Jul 08, 2014 6:08 pm

Octacon100 wrote:Hi,

I've been able to edit the playlist exporter so that it will work on windows, and so that the exported playlists will work in itunes and windows media player.

The playlists are now exported with the songs in the same order that they are in on your subsonic server. With some other cmd scripts, perl scripts and auto hot key scripts, you can import the exported playlists into itunes. If anyone is interested in that code, let me know and I'll upload it.

Hope it helps!

I'm totally inexperienced in java, and haven't done much command prompt work in years, I'm getting old! :) Ok, I'm getting errors when I try to run this from cmd, without the brackets inclduded:
java.io.IOException: Server returned HTTP response code: 401 for URL: http://192.168.2.5:4040/db.view?query=S ... 20PLAYLIST
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at SubsonicPlaylistExporterWeb.executeQuery(SubsonicPlaylistExporterWeb.java:108)
at SubsonicPlaylistExporterWeb.main(SubsonicPlaylistExporterWeb.java:43)

With brackets I get:
java.net.MalformedURLException: no protocol

which I'm guessing is because I shouldn't be using the bracket, lol. Pretty embarrassing that I can't remember something simple like that. Help me out here, I'm clueless. I'm sure it's something simple...

Edit: Interesting workaround, I can see the Subsonic server in Mediamonkey, then save the playlist as an m3u. It's all links to streams from subsonic, rather than actual filepaths. That works fine for Winamp, but Sonos won't play it, which is really what I'm looking for. It sees the playlist, but doesn't recognize that there's any music in it.
loubat
 
Posts: 7
Joined: Wed Aug 21, 2013 3:04 pm

Re: Playlist Export Script

Postby madhusker » Mon Aug 11, 2014 1:38 am

Looks like this is depreciated. :(

~/temp$ java SubsonicPlaylistExporterWeb "https://192.168.1.10:4141/subsonic/db.view?query=" YW5ksmV3:JGFzfDAx .
Exception in thread "main" java.lang.UnsupportedClassVersionError: SubsonicPlaylistExporterWeb : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: SubsonicPlaylistExporterWeb. Program will exit.
madhusker
 
Posts: 49
Joined: Tue Dec 27, 2011 2:38 am

Re: Playlist Export Script

Postby friendlyferret » Thu Nov 27, 2014 7:16 pm

Here's a friendly ammendment to the playlist exporter. This version accepts the username:password string in plaintext so that you don't have to encode it before you run the exporter. It requires Java 1.5 or greater.
friendlyferret
 
Posts: 5
Joined: Thu Nov 27, 2014 7:01 pm

Next

Return to Mods, Apps and Clients

Who is online

Users browsing this forum: No registered users and 14 guests