Page 1 of 1

MythMusic Playlist import?

Posted: Sat Aug 16, 2014 9:02 am
by mtrax
Is it possible to import a playlist from another system ie I have all my favorite playlists set on WinAmp can I some how import this to MythMusic as I don't really want to repeat this process every time I update it .

Re: MythMusic Playlist import?

Posted: Sun Aug 17, 2014 9:03 am
by paulh
There is nothing built into MythMusic to do this. There are a few scripts around that can import playlists from iTunes not sure about WinAmp though. How does WinAmp store the playlist?

Re: MythMusic Playlist import?

Posted: Sun Aug 17, 2014 9:11 am
by mtrax
I think WinAmp can same playlist in the following formats: M3U, PLS, M3U8, but can you point to those iTunes scripts perhaps I can hack those to suit ..

Re: MythMusic Playlist import?

Posted: Sun Aug 17, 2014 10:28 am
by paulh
This is one linked to from the MythMusic wiki page I've no idea if it still works or if it ever worked :)
http://www.weezey.com/2008/05/itunes-pl ... in-mythtv/

Importing playlists from M3U or PLS files should be possible but wont be straight forward. The playlists in MythMusic are just a comma separated list of track id's stored in a row in the music_playlists table. The id's match the song_id stored in the music_songs table. You would have to read the playlist file and lookup the song_id for each track based on the title and/or the filename stored in the playlist file to construct the comma separated list of id's.

Re: MythMusic Playlist import?

Posted: Sun Aug 17, 2014 10:35 am
by mtrax
hmm perhaps there needs to be a exposed API for MythMusic for this situation..

So now looks like need to build one from scratch as that script is syncing files as well..

Re: MythMusic Playlist import?

Posted: Mon Aug 18, 2014 9:56 pm
by mtrax
Before I start any advice on how this script should read or write to the mythtv database?
Ie if I use perl do i need to use api or just use raw SQL?

Re: MythMusic Playlist import?

Posted: Tue Aug 19, 2014 11:20 pm
by mtrax
ok I have created a row in the db table music_playlists but it doesn't show in the mythtv Frontend?

Re: MythMusic Playlist import?

Posted: Wed Aug 20, 2014 10:17 am
by paulh
mtrax wrote:Before I start any advice on how this script should read or write to the mythtv database?
Ie if I use perl do i need to use api or just use raw SQL?
We generally advise against using raw SQL, there are plans to use an embedded database that would likely remove direct DB access anyway. Having said that there is no built in API to do what you want. The python bindings would be one way to go since they are the most complete and can be easily extended but you would have to speak to Raymond about that.

If I was doing it I would probably add something to the MythMusic plugin directly to import the playlists using the existing classes. There is stuff in there to parse the PLS and M3U playlists as well as create playlists and reload them etc the only bit missing is finding the song_id from the info in the playlist file.
mtrax wrote:
ok I have created a row in the db table music_playlists but it doesn't show in the mythtv Frontend?
At the moment if you change the playlist externally you would have to restart the frontend for the playlists to be reloaded.

Re: MythMusic Playlist import?

Posted: Fri Aug 22, 2014 9:39 pm
by stuartm
At some point I'm going to be expanding the Services API to include options for MythMusic. However I don't have a timeframe in mind.

Re: MythMusic Playlist import?

Posted: Fri Aug 22, 2014 9:43 pm
by mtrax
Great, I've completed my script and works well albeit using direct SQL to create playlist. So this will do me for now.

Just on a side note switching playlist is a bit non intuitive but I eventually found out how
Thanks
Paul

Re: MythMusic Playlist import?

Posted: Fri Aug 03, 2018 8:27 am
by timblayd
I would suggest to try "MusConv" tool.