add support for mpd

Bug #579489 reported by JaVaEs
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Zeitgeist Data-Sources
Confirmed
Wishlist
Unassigned

Bug Description

I think support for the music player daemon should be included like it already is for other music players.

Tags: wishlist
Revision history for this message
Markus Korn (thekorn) wrote :

Hi JaVaEs,
I've never used mpd, and I have close to zero ideas how this player works. And after looking at their wiki/source-code I've no clue how we can hook into mpd to be notified when a song is played/skipped/stopped/...

If you or anyone else has an idea, or maybe some sample code please post them here.

Thanks,
Markus

Changed in zeitgeist-dataproviders:
importance: Undecided → Wishlist
status: New → Incomplete
Revision history for this message
JaVaEs (jan-vanesdonk) wrote :

Thanks for the quick answer. MPD is a daemon which can be handled by different clients for creating playlists, skipping and other music controls. Well Conky can provide real time information about the status of the MPD. The only thing needed would be the current track. I took a quick look at Conky's source (i have only a little programming skills). Conky seems to connect directly as a client to MPD and requests the status. There is a MPD client called Sonata which is written in Python, that could help to implement it to Zeitgeist.

Best Regards
Jan

Markus Korn (thekorn)
Changed in zeitgeist-dataproviders:
status: Incomplete → Confirmed
Revision history for this message
pgun (pietergunnink) wrote :

Hi guys

I have written a data source for MPD, it's just a litte python script that is running itself every 5 seconds, checking for a song and sending it to zeitgeist. It's not perfect, not at all. I still need to figure out what it's going to happen if the zeitgeist or MPD daemon are not running, and it doesn't even keep track on your previous song, but it's a start. Does anyone know a good place to post it?

Pieter

Revision history for this message
pgun (pietergunnink) wrote :

I uploaded the wrong version, here is a working one:

Revision history for this message
Omar Campagne (ocampagne) wrote :

As a heavy mpd user, I thank your efforts :)

I didn't know where to file a bug against YOUR extension :) Tell me if you want somewhere else.

The plugin stores the now playing song into zeitgeist, but fails about 5 seconds later with:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/threading.py", line 736, in run
    self.function(*self.args, **self.kwargs)
  File "./mpd_plug.py", line 100, in make_call
    if self.zeit & zeit_song: #hoerah, we have a connection. Let's send sth
TypeError: unsupported operand type(s) for &: 'instance' and 'dict'

I can be your guinea pig if you want. Just poke me.

Revision history for this message
pgun (pietergunnink) wrote :

Hi Omar

It's now working, as I can see, I have uploaded it into my personal branch here on launchpad, and one in the zeitgeist-datasource.

Just use the command bzr branch lp:~pietergunnink/+junk/mpd-datasource, and install bazaar if you haven't already. Or just download it from here: http://bazaar.launchpad.net/~pietergunnink/+junk/mpd-datasource/files

Revision history for this message
Omar Campagne (ocampagne) wrote :

Thanks :) It works now.

Your path to the music is hardcoded into the file. Therefore, g-a-j shows that the file played was under /pieter/Muziek/.

I found other issues, but anyway, this is experimental and sure you are working on the rough edges..

Cheers for the work.

Revision history for this message
Omar Campagne (ocampagne) wrote :

pgun, you ask where to post it. User forums and, moreover, webupd8.org and omgubuntu. They are following with interest the whole zeitgeist thing, and have many readers.

Revision history for this message
Bidossessi Sodonon (bidossessi-sodonon) wrote :

The plugin here is really a daemon that polls mpd and writes new entries to zeitgeist.

It's convenient for me because I don't use any graphical client but mpc or Synapse, through a plugin I wrote that's currently under review. I add it to my autosatrt.sh openbox script, and it works great.

I have reworked the above-mentionned zeitgeist mpd plugin. The code's still not very clean, but it's now more crash-resistant.

I'd like to know if there's a proper way to structure python dataproviders, since I could'nt find any reference python.

Then I could get on to reformatting the code and making it a proper daemon. For now this works-for-me :)

Revision history for this message
pgun (pietergunnink) wrote :

I don't know wether there is a python plugin structure or not, I think it would be useful for every plugin that uses some sort of daemon. That way zeitgeist could easily control what plugin runs. You could try to fill a bug report somewhere about this, or connect Seif somehow.

About your rewrite: I haven't had the time to check it out completely, but it looks alright to me. If you could make it real daemon: thank you very much, because I have no idea on how to do that.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.