Description:

AmarokMPC is an Amarok script for synchronising the localy played music with an instance of the Music Player Daemon (MPD, http://www.musicpd.org).
This task and usecase is somewhat limited:
If you have the same music on different computers (e.g. mounted with nfs) and want to play the same music on both computers at the same time, then this script might help you.

Amarok 2.0 will get a Ampache service which seems to do the same stuff. Currently no development will be done on my side, you are free to take over.

The current playlist is transfered from Amarok to mpd and synchronised including events like play, stop, skip, pause. Technically it works by translating the local paths to the remote equivalents to handle different mount points.

This script comes in handy when changing places while listening to music. You can now listen to your Amarok as long as a server with MPD and a same set of music is around.

Short Usage:
Set server address in configure dialogue first and wait for the "connected to ..." message. Then you can use the context menu from the Amarok playlist to start/stop MPD. See README for more information.

Changelog:

10 years ago

2007.01.14 (0.1):
initial release

2007.01.15 (0.11):
fix issue with remotely non available file

2007.01.30 (0.2):
* don't autoconnect on very first load, let user check settings first, new options for startup/shutdown
* check if tracks could be added to server, handle missing same as local tracks: skip locally
* menu for starting and stopping synchronisation, no need for starting/stopping skript for this
* menu for updating the mpd server
* interfere less with server, if we already stopped playing

6 years ago

kleofas

I'm working on a port, probably'll be done this week.

Report

6 years ago

wodka

Hi, is the amarok 2 port finished? If yes, where can i download it?
If not, how can i help?

Report

6 years ago

kleofas

No... it's not done because of my academic exams back then and after that I got a job to build a call center app, which I'm still working on, so basically it's deferred for me.

Report

7 years ago

berot3

is amarok 2-support coming? can some1 port it? plsplspls

Report

8 years ago

actionshrimp

I updated to Ubuntu Hardy, and amarokMPC broke, giving an error on line 41, due to changes in python-XML. Apparently it interferes with some core python XML modules.

There's an easy enough fix though, you just reinstall the python-xml package, and they get put in something like /usr/lib/python2.5/site-packages/oldxml

Then edit amarokmpc.py and find line 41, which is

from xml.dom.ext.reader import Sax2

and add this as a new line just before that:

sys.path.append('/usr/lib/python%s/site-packages/oldxml' % sys.version[:3])

This lets the script know where to find the files. Hope this helps someone else!

Report

9 years ago

hacim

I got the script to run fine in amarok, and it connects to my mpd server. I've got the context menu in my playlist which gives me the option of syncing my playlists, etc. but no matter what I do, nothing seems to happen. If I try to play something in amarok, it plays in amarok, not in mpd, am I not clear on what this is supposed to do?

Report

9 years ago

chrisKA

You have to have your music both in amarok and in mpd. When syncing mpd is only told to play the same as amarok. Therefore the script has to know how it can find the local track in mpd: you have to tell it how the local paths are mapped to the paths on the server with mpd.

Mail me if you have any questions. I'm not checking kde-apps regularly.

Report

9 years ago

rickcox

I had a problem with this working with Amarok 1.4.7. I found this was due to the current.xml playlist file not haveing a filename field. To fix I replaced the getCurrentPlaylist function / definition with the following (taken from a transcode script) with changes in bold:

Quote:

def getCurrentPlaylist(playlistPath):
# create Reader object
reader = Sax2.Reader()
# parse the document
file = codecs.open(playlistPath, encoding='utf-8')
doc = reader.fromStream(playlistPath)
playlist = []
playlistElem = doc.getElementsByTagName('playlist')[0]
for itemElem in playlistElem.getElementsByTagName('item'):

filename = itemElem.getAttribute("url")
filename = filename.replace("file://", "").replace("file:", "")
filename = filename.replace("%20"," ").replace("%27","'").replace("%26","&").replace("%23","#").replace("%2B","+").replace("%3D","=").replace("%3F","?").replace("%5B","[").replace("%5D","]").replace("%25","%").replace("%3A",":")

playlist.append(filename)

return playlist

Report

9 years ago

chrisKA

Thanks for the fix. I don't have any time though to incorporate that into a new version as I'm pretty busy right now. Currently I have no use for this script, so I probably won't make any fixes in the very near future. Soon as I have my system back I'll keep on going again.

Report

9 years ago

rickcox

While I'm no Python expert I realize my instructions may have been confusion to someone completely unfamiliar with programming. To save you the hassle of having to search and find the fix, here is my updated file.

DISCLAIMER:
I haven't used this for a while and haven't tested it on any newer versions of Amarok. Let me know if it works for you.

Link:
http://www.filedropper.com/amarokmpc

Report

8 years ago

rickcox

I guess the link doesn't work. Try this instead:

http://www.kde-apps.org/content/show.php?content=78111

Report

9 years ago

finferflu

Well, thanks for your tips it is now working (thanks a lot!), but I've got another problem: whenever I play something I can hear it played back twice with something like 1 second of delay, this is unbearable.
Do you know what may be causing this?

Thank you

Report

9 years ago

triptol

I guess you have Amarok and MPD on the same machine. So what you will hear is one time the music coming from Amarok (the first) and the second one comes from MPD. MPD starts a little later, since the command to start comes with a small delay from Amarok.

So just turn down the volume in Amarok.

Report

9 years ago

ptifeth

What we really need here is a dummy playback engine, don't we ?

Report

9 years ago

triptol

BTW, this completely rocks!

I now have my (very fat) Amarok Client to control MPD.

I use my Laptop without tone, as the most luxury remote control one could think of. I still have all the features I'm used to. Tried a couple of other MPD clients and although they all have nice features (gmpc and MPD WebAMP) none of them comes close to Amarok.

Thanks. Really enjoy this script.

Report

9 years ago

triptol

I had a little hard time getting the path mapping correct. By default it says /:/, so I thought this must be client:server. Or the other way around, but I was right.

So both my client and server use the same mount point. I thought that is enough. It turns out to be that is not the case, since MPD has the path relative to the music root directory, whereas Amarok stores the whole path.

So if you're setup is like this:
NFS Mount point:
/mnt/music_server/music/[collection]

mpd.conf has:
music_directory=/mnt/music_server/music

This means that the MPD collection will start at the collection point, without a slash at the beginning!

Example:
/mnt/music_server/music/R/Radiohead/OK\ Computer/01\ -\ Airbag.flac

Amarok would use this path to refer to the file, whereas MPD would only use: R/Radiohead/OK\ Computer/01\ -\ Airbag.flac

Since the replace syntax was client:server, or replace_client_string:with_server_string it will look like this in this case:

/mnt/music_server/music/:

Nothing after the colon, trust me ;-)

Report

9 years ago

chrisKA

Sorry for this inconvenience. Indeed not that easy. I am always open for any suggestions.

Report

9 years ago

finferflu

Hi, thanks for your script.
However whenever I try to run it, I get the following error message:

Traceback (most recent call last):
File "/home/user/.kde/share/apps/amarok/scripts/amarokmpc/amarokmpc.py", line 41, in ?
from xml.dom.ext.reader import Sax2
ImportError: No module named ext.reader

I guess I have to install something extra, but what?

Thank you!

Report

9 years ago

triptol

You need to install pyxml. Under Ubuntu that would be: sudo apt-get install python-xml.

After that you will probably need to install py-libmpdclient (which can be found here: http://incise.org/index.cgi/py-libmpdclient2). On my system I needed the python-dev packages. Just unpack it, untar it and run

sudo python setup.py install

Don't forget to configure the script after you start it ;-)


Report

Supporters

Recent Donations

Be the first to donate
Filename Version Description Filetype Packagetype License Downloads Date Filesize Install
Score 50%
50.00 Likes
50 Dislikes

0 Supporters for AmarokMPC:

Recent Donations:

Be the first to donate
show all
Details
version
0.2
updated Jan 30 2007
added Jan 14 2007
downloads
page views 287
support chrisKA
For The Product
AmarokMPC
5 - 10 - 25 - 50 - 100 - 200 - 500