Amarok/Archives/Amarok 1.4/User Guide/Submit your amaroK database to musicmobs


Similar to Audioscrobbler but with a different focus, there is the site, which has at the moment only plugins for a few players available. With the following script you can upload your Amarok database to musicmobs. You will need a musicmobs account to do so.


The Musicmobs XML-RPC API is depricated. The new, supported API is the REST interface seen here:

[ Musicmobs REST API]

This API also supports playlist syncing.


For this script you need a recent version of Python, the SQLite libraries / command client (Version 3.2) and the APSW module for Python installed.

The script

Save this file as

# amaroK to musicmobs scripts
# (C) 2005 by Titus Stahl <[email protected]>
# Licensed under the GPL Version 2 and above
import apsw,sys 
import xmlrpclib
def submit(file, username, password):
	artists = {}
	albums = {}
	genres = {}
	#Fetch artists

	for aid,aname in cursor.execute("select id, name from artist"):
		artists[aid] = aname
	for aid,aname in cursor.execute("select id, name from album"):
    		albums[aid] = aname
	for aid,aname in cursor.execute("select id, name from genre"):
    		genres[aid] = aname

	s = ""
	for title, album, artist, genre, score, counter in cursor.execute("select tags.title, tags.album, tags.artist, tags.genre, statistics.percentage, statistics.playcounter FROM tags, statistics WHERE tags.url = statistics.url"):
		if score <= 20:
			score = 20
		if 20 < score <= 40:
			score = 40
		if 40 < score <= 60:
			score = 60
		if 60 < score <= 80:
			score = 80
		if score > 80:
			score = 100
		s += artists[artist] +"\t" + title + "\t"+str(counter)+"\t"+albums[album]+"\t"+str(score)+"\n" 
		#print s
	bs = s.encode('ascii', 'ignore').encode('base64')
	server = xmlrpclib.ServerProxy("")
	print "OK"
		res = server.musicmobs.updateProfile(username, password, bs)
	except xmlrpclib.ProtocolError:
		print " plugin: Could not submit tracks (Network Error)" 
		print "XML-RPC ERROR: Check your credentials"
if __name__ == "__main__":
	if len(sys.argv) < 4:
		print "Usage: /path/to/your/collection.db username password"


If you mark the file as executable and move it somewhere into your path, you can update your metadata as follows: /path/to/your/collection.db username password

For example: ~/.kde/share/apps/amarok/collection.db username password

If you want your profile to be updated regularly, consider a cron job.

This page was last edited on 7 December 2012, at 17:23. Content is available under Creative Commons License SA 4.0 unless otherwise noted.