This forum has been archived. All content is frozen. Please use KDE Discuss instead.

External query to get Amarok ratings

Tags: None
(comma "," separated)
pgunn
Registered Member
Posts
1
Karma
0
Hello,
I am attempting to write a perl script that can talk to Amarok (I don't particularly care about the method it uses - dcop, bus-send, whatever), extracting each track in the collection's filename, title, album, and rating. There are examples of people doing this with Amarok 1.x on the web, but I was unable to find examples for 2.x. I am willing to write a SQL query if I can get Amarok to execute SQL on my behalf (I saw some examples of people starting another mysqld instance to do this, but that's an ugly solution and might result in corruption if the mysql-embedded instance and the mysqld hit the data at the same time, e.g. if amarok is running).

Any advice would be appreciated - I am not interested in running anything in the GUI of amarok to get this, but am willing to have amarok running for whatever solution is possible. Thanks.
User avatar
Dieter Schroeder
Registered Member
Posts
714
Karma
7
OS
If you don't want to run mysqld, it will be hard to query Amarok with an external script.
-Dcop is dead for KDE4
-Dbus methods for querying the database directly don't exist (yet)
[EDIT]There were methods on the collection, but seems they vanished again[EDIT]
But you can try this (all dbus):
Load the complete collection into the playlist (couldn't find a method for that)
Get the length of the tracklist
numTracks=qdbus org.mpris.amarok /TrackList GetLength
will return number of tracks
Loop over all tracks
for i=0,iqdbus org.mpris.amarok /TrackList GetMetadata $i
will return metadata
extract the infos you need.
Now do it in perl ;-)
Of course this is just a mockup.
Accessing the collection per dbus would be way better.
And if you do only a read on the db, I would prefer querying it directly.

m0nk

Last edited by Anonymous on Sat Jul 11, 2009 11:41 am, edited 1 time in total.


If men could get pregnant, abortion would be a sacrament.


Bookmarks



Who is online

Registered users: Bing [Bot], gfielding, Google [Bot], markhm, Sogou [Bot], Yahoo [Bot]