Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support creating playlists from m3u playlist files #34

Closed
davidbrenner opened this issue Jul 28, 2015 · 9 comments
Closed

Support creating playlists from m3u playlist files #34

davidbrenner opened this issue Jul 28, 2015 · 9 comments

Comments

@davidbrenner
Copy link

I'd like to be able to create playlists from .m3u files. I've written a very rough patch to do this on my own repo of supysonic here: c13b3ae. I just added a route to upload playlists to the frontend to implement it. The path for the uploads and the upload form are both hardcoded and ugly and the error handling is pretty awful, so it should probably be cleaned up before being pulled in. I can do that if there's interest in it.

One other issue related to error handling - due to the way the database is organized, multiple copies of the same song cannot be in the same playlist. I'm not sure how subsonic itself handles it, maybe that's consistent, but to me it's annoying. I'd like the option to have multiple of the same songs. I may end up changing this as well.

@davidbrenner
Copy link
Author

Any interest in having this as a feature? Should I try to clean it up or just continue using it for myself?

@spl0k
Copy link
Owner

spl0k commented Aug 17, 2015

It'll be difficult to get something that works.
The M3U format allows both absolute and relative paths. Relative paths require that the playlist file to be created in a well known location, such as one of the root music folders. Playlists with absolute paths would only work if they are created on the computer running the server or if the the server have the same directory structure as the computer we're uploading the playlist from.
Those are strong conditions which are unlikely to be met in the general case.

@spl0k spl0k closed this as completed Aug 17, 2015
@spl0k spl0k added the wontfix label Aug 17, 2015
@andrenam
Copy link
Contributor

Indeed, the general scenario does not always work like that.
Personally, I use supysonic and mpd both on the same server. I synchronize supysonic's playlist and mpd's playlist via a custom cronjob, but I realize that's not meant to be merged into the upstream version. :-)

@spl0k spl0k mentioned this issue Aug 26, 2018
@anarcat
Copy link

anarcat commented Apr 4, 2019

@andrenam how do you import playlists from a cronjob? i'd love to do that myself...

i looked at the database layout and couldn't make head or tails of it. for example, I just created a playlist from an album and supysonic created this in the MySQL database:

MariaDB [supysonic]> select id,tracks from playlist\G
*************************** 1. row ***************************
    id: ��PN�i@��Ƕ
                  �7
tracks: 7ccb5785-69e0-44e7-81d9-834c11d35028,561cc6be-0550-4a1e-be70-10591362819f,811c749a-9a7b-4a57-a69a-8f54e615337c,54a340d0-3d2b-46dd-832e-15e0555142ca,c1ad9e8e-c208-418c-a371-932f66ed81e7,0b9ccf41-ca25-486c-8de6-d657e0f6994b,11427740-2cff-4e20-a59a-babc9effd6f9,aa4db976-80c1-4129-bb08-fdd5beebddd9,fec80de3-5f6c-4213-b82c-256d4744023c,16cdf38d-2a48-41cc-bb9d-3383de4efa14,e18844bb-e7b8-4b33-956a-7293a6e61b0d,119386aa-fa5f-4da3-b661-50866d5e2dab

The first thing that surprised me are the BINARY fields like id here. But then I'm puzzled by the tracks column as well: those look like UUIDs but I can't find the same entries in the track table...

I was hoping I could just sync on-disk m3u playlists I generate from mpd into supysonic as well, so I would really like to see how @andrenam does their cronjob things. :)

@spl0k
Copy link
Owner

spl0k commented Apr 6, 2019

Primary keys are all UUIDs. Pony tends to store them as their binary representation, you'll have more luck making sense of them on PostgreSQL since it natively support this type. The tracks column here are the "human readable" UUIDs referencing entries on the track table. They're handled on the Python side. This is a comma-separated list string because I was too lazy at the time to define a proper many-to-many relation.

I don't know about @andrenam setup, but at that time Supysonic used storm rather than PonyORM, and storm stored UUIDs in a nicer representation than Pony does.

@anarcat
Copy link

anarcat commented Apr 6, 2019

oh wow, weird. binary UUIDs. :) i did not know this was a PostgreSQL thing... it might be worth outlining pgsql as the primary supported database if weird stuff like that happens in MySQL :) But it seems MySQL 8 (?!) has added support for UUIDs according to this post. And there seems to be a BIN_TO_UUID function I can use to do magic stuff with it, so it seems I might be able to get away with this without having to deploy a pgsql cluster.

In any case, I think it would be great to have something like what @davidbrenner proposed. His patch has some site-specific stuff embeded and would need a little cleaning up, but otherwise it seems sound to me.

Another thing to work on for me, I guess. :)

@andrenam
Copy link
Contributor

andrenam commented Apr 6, 2019

@anarcat: I can get back to you maybe next weekend, as I'm in the middle of moving houses.
Back in the day, I didnt touch the database directly but used python, imported the relevant supysonic modules and used that to store/add playlists. Maybe it was with storm...

@anarcat
Copy link

anarcat commented Apr 6, 2019 via email

@anarcat
Copy link

anarcat commented Apr 14, 2019

hello @andrenam ! how was the move? :) did you have time to look into this again? any code you can share with out would be very helpful... thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants