Adding tracks to the playlist from within a script

Martin Höher martin at rpdev.net
Sat Dec 4 13:24:19 CET 2010


Hi @all!

I hope I chose the correct list for asking this kind of questions.

Some time ago I started developing a plugin for Amarok. This plugin sometimes 
adds tracks from the local collection to the playlist. Generally, this works 
well.
To get the paths, I currently do the following:
I lookup a track in the tracks table, then I use the url field to make a lookup 
in the urls table where I use the rpath field as the track's path. In my case, 
the rpath entries look like "./home/martin/Music/Artist/Album/Trackname.ogg".
Currently (I'm using Amarok from Git) I have to
* remove the leading dot
* add the "file://" prefix
Passing this (as a QUrl) to Amarok.Playlist.addMedia works.
However, just some weeks back this didn't work, i.e. I had to pass the rpath 
field as-is to addMedia.

Now, I just wonder whether I do the lookup of the track URLs correctly or 
whether there are methods to find out the accepted URL format of the addMedia 
method...

Thank you in advance for your answers!

Regards,
Martin Höher

-- 
http://www.rpdev.net/home/martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/amarok-devel/attachments/20101204/56420e94/attachment.sig 


More information about the Amarok-devel mailing list