![]() ![]()
|
I just had a random idea.
I was thinking that it'd be pretty cool to post the information from Amarok's context playlist panel on my blog, kinda like I've seen others do with Winamp/XMMS. Does anyone know if this has been done before? If not, can you give me some information on any files I could look at parsing (ideally with PHP or Perl) with a view to creating a format to post to my website. I could set up a shell script to do this regularly. I believe Amarok keeps it's playlist information in a database? If so, what kind is it? Where is it? What tools could I use to read it? Cheers for any help, I've never tried anything like this before but it'd be pretty cool if I could get it to work. |
![]() KDE Developer ![]()
|
For simple things, you can use dcop. Using the program kdcop is a good way to familiarize yourself with how dcop works.
I think amaroK uses a sqlite database. I don't know how useful the database is for the kind of things you want to do, I don't think it keeps stuff like your current playlist in it, though I could be wrong.
Amarok Developer
|
![]() KDE Developer ![]()
|
There is a file at .kde/share/apps/amarok/current.xml that contains the playlist from the last time amaroK closed cleanly. Which I guess isn't that useful. The actually current playlist is probably kept totally in memory. Maybe a dcop call to save the current playlist would be useful.
I installed sqlite3 and confirmed that indeed that database wouldn't be useful for the current playlist. You could extract your favorite tracks from it. $ sqlite3 /tmp/collection.db .dump > /tmp/col.out $ grep CREATE /tmp/col.out CREATE TABLE directories (dir VARCHAR(100) UNIQUE,changedate INTEGER ); CREATE TABLE statistics (url VARCHAR(100) UNIQUE,createdate INTEGER,accessdate INTEGER,percentage FLOAT,playcounter INTEGER ); CREATE TABLE tags (url VARCHAR(100),dir VARCHAR(100),createdate INTEGER,album INTEGER,artist INTEGER,genre INTEGER,title VARCHAR(100),year INTEGER,comment VARCHAR(100),track NUMBER(4),sampler BOOLEAN ); CREATE TABLE album (id INTEGER PRIMARY KEY,name VARCHAR(100) ); CREATE TABLE artist (id INTEGER PRIMARY KEY,name VARCHAR(100) ); CREATE TABLE genre (id INTEGER PRIMARY KEY,name VARCHAR(100) ); CREATE TABLE year (id INTEGER PRIMARY KEY,name VARCHAR(100) ); CREATE TABLE images (path VARCHAR(100),name VARCHAR(100) ); CREATE INDEX url_stats ON statistics( url ); CREATE INDEX percentage_stats ON statistics( percentage ); CREATE INDEX playcounter_stats ON statistics( playcounter ); CREATE INDEX album_idx ON album( name ); CREATE INDEX artist_idx ON artist( name ); CREATE INDEX genre_idx ON genre( name ); CREATE INDEX year_idx ON year( name ); CREATE INDEX album_tag ON tags( album ); CREATE INDEX artist_tag ON tags( artist ); CREATE INDEX genre_tag ON tags( genre ); CREATE INDEX year_tag ON tags( year ); CREATE INDEX sampler_tag ON tags( sampler ); Post edited by: eean, at: 2004/11/08 01:00 Post edited by: eean, at: 2004/11/08 01:02
Amarok Developer
|
![]() Registered Member ![]()
|
Aha, sqlite? That *should* make it fairly easy to play around with.
I'm pretty sure the db keeps track of you most played (favourite) tracks. That's the kinda thing I'm looking for. Thanks for your thoughts, I could use dcop I guess -but I was kinda thinking of extracting some info from amaroks db with a perl or php script, then dumping that info to an xml file and using ssh to upload it to my website where I would parse it using PHP (probably rolled into a Wordpress plugin). Sounds complicated but in theory possible, I think! Like I say I've never tried anything like that before, so it should keep me amused for a bit. I'm off to find that database! |
![]() Registered Member ![]()
|
Thanks eean!
You've giving me some ideas to get started, I'll work on that xml file to start with and then look into extracting my favourite tracks from the db. I wish I knew more about dcop though, not sure how I would get amarok to save the current playlist? Will have to read up on it I guess! Cheers, |
![]() KDE Developer ![]()
|
yup, we're using sqlite3.
getting the favs is rather easy. please don't blame me, if there's an error in the following statement, this is just out of brain now.... it should show you your top10 fav songs. SELECT tags.title, artist.name, album.name FROM tags, artist, album, statistics WHERE artist.id = tags.artist AND album.id = tags.album AND statistics.url = tags.url ORDER BY statistics.percentage LIMIT 0, 10; regards, muesli |
Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]