full listings » Playback


MPRIS thesmyth

Adds support for the MPRIS media player communication/control protocol


Description

This is both 32 and 64-bit compatible.

This extensions provides an MPRIS interface for controlling Songbird through the Linux DBUS.
This allows for changing tracks, volume and position, prev/next, play/pause/stop, as well as allows for retrieval of metadata on songs.

This supports almost all MPRIS functionality, except for:
* AddTrack method
* DelTrack method
* GetCaps method just says everything works
* CapsChange signal not implemented
* TrackListChange signal not implemented
* Metadata retrieval from external sources like Musicbrainz and Amazon

If you want them implemented, leave a comment!

Uses
This will allow query/control with anything using the MPRIS protocol.
For example:

  • Pidgin MusicTracker (Here)
  • AMSN Music plugin (Here)
    * May need to install libqt4-dbus for the program qdbus
    * If you get extra info in your status, see my response to the user siabost in the comments
  • Panflute, Gnome music applet, as of v0.6 (Here)
  • mpris-remote, command line tool (Here)
  • CoverGloobus, coverart/lyrics display (Here)
  • CairoDock music applet, as of revision 1548 (Here)

Sample Code

#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
object = bus.get_object('org.mpris.songbird', '/Player')
stat = object.GetStatus()
if stat[0] == 0:
  print "Playing"
elif stat[0] == 1:
  print "Paused"
else:
  print "Stopped"
  
data = object.GetMetadata()
print data['title']
print data['artist']

Source Code
The code is up on GitHub here.
http://github.com/loganfsmyth/mpris-songbird




Release Notes

Quick release to up the version number maximum to support Songbird 1.4.
I didn't have to recompile anything, just upped the version and everything seems to be working. If you have issues, please post.




Comments

(75)


Slate8
Slate8

Nice! I take it this will open up a load of possibilities for interaction between songbird and other apps? Have managed to see the DBUS messages emmitted by Songbird with "dbus-monitor".

Has anyone got Songbird talking to another app? I tried the Pidgin "MusicTracker" and "Now Playing" plugins, but no joy.

Would be cool to have a panel applet for gnome that can control Songbird over MPRIS.

Anyone got anything cool going?

9 months ago
GeekShadow
GeekShadow

sweet, but you are not oblige to create 2 extensions for 32 and 64, one extension can handle these 2 platforms

9 months ago
thesmyth
thesmyth

@Slate8 In the plugin options, what player did you choose? You have to choose Automatic.

@GeekShadow Ahh, I hadn't really thought about because I'd seen other extensions uploaded as 2 separate extensions. I see now that there are platform subdirs. I'll probably upload a new combined version in a bit. Thanks for the info.

9 months ago
Slate8
Slate8

@thesmyth Ahh yes, have installed the Pidgin MusicTracker plugin (http://code.google.com/p/pidgin-musictracker/) and chose "Auto-detect" for the player and it seems to work. The only reason I thought it wasn't is because there's no way that I can see my now playing status. I only found out it was working by typing /nowplaying into a conversation window or by asking my contacts what my status was. Guess this is a limitation of Pidgin / MusicTracker but I don't see how I know what is being set for my now playing status.

Great plugin so thanks for the hard work. Looking forward to playing around with this a lot more.

9 months ago
stratocastom
stratocastom

@Slate8

If you go into musictracker and choose MPRIS, it should work. Does for me anyhow ^_^

9 months ago
stratocastom
stratocastom

Ahh nevermind just saw your post, seems it was working after all ¬_¬

9 months ago
thesmyth
thesmyth

Glad to see it's working :)

9 months ago
chi_square
chi_square

coolest thing ever

9 months ago
NdrU
NdrU

Great addon, but there are some problems:

1. If you pause a song and then try to resume, it starts playing from beginning. I tried this with two different command line scripts.

2. Doesn't work with gajim (the main reason I was looking for a dbus addon for songbird). After changing a track, the tune icon in gajim flashes for a short time but almost instantly disappears. Might be a bug in gajim, though.

8 months ago
thesmyth
thesmyth

@NdrU
You are right about "play" going back to the beginning. I wasn't really sure how the spec was meant to be implemented. I made the behavior the same as Audacious MPRIS.
To toggle between play/pause without going back to the beginning, run the "pause" command again. It will go back and forth.

As for gajim, I'll take a look when I get the chance. Not sure when that will be.

8 months ago
artanicus
artanicus

arguments to dbus_connection_send_with_reply_and_block() were incorrect, assertion "(error) == NULL || !dbus_error_is_set ((error))" failed in file dbus-connection.c line 3301.
This is normally a bug in some application using the D-Bus library.

Gentoo, dbus-1.2.3. Any good ideas?

8 months ago
thesmyth
thesmyth

@artanicus
1. Are you on running 32 or 64 bit?
2. Does the extension still work?

I noticed that at one point on my 32-bit VM, and then promptly forgot because it wasn't showing up on my main system, which is 64-bit, and because the extension still worked right even with that error coming up.

8 months ago
opu.e
opu.e

@thesmyth

With your plugin Songbird crashes always when I double-click on a track or press next/prev on my keyboard! :'(

I tested it under Songbird 1.2 and 1.3b1, always the same. (Ubuntu 9.04 with KDE4 and Gnome).

Any suggestions?

7 months ago
thesmyth
thesmyth

@opu.e
That's weird. I run 9.04 Gnome too. 32 or 64 bit Ubuntu? Did you compile songbird from source or did you just use the deb from GetDeb.net. If you compiled from source, can you tell me what build version ( Help > About Songbird... )?

Things to do:
1. Start songbird from the command line and see if any error messages get printed out when it crashes.
2. Try creating a new profile profile by running "songbird -ProfileManager" and install the extension there. It is possible that it is conflicting with another plugin somehow.

I think I'll try to add a debug mode that will print out more info, but not sure when I'll have time.

7 months ago
verdi
verdi

same thing here. Linux tbird-x4 2.6.30-gentoo-r2 #1 SMP PREEMPT Sun Jul 19 18:47:23 CEST 2009 x86_64 AMD Phenom(tm) II X4 940 Processor AuthenticAMD GNU/Linux on gcc 4.3.2 and dbus 1.2.3-r1. With the extension installed songbird randomly crashes, no logs in console, and no indication of what's running. i've got the following addons installed:

  • AmazonFetcher
  • Details Pane
  • Discogs Fetcher
  • DOM Inspector
  • FocusTrack
  • Javascript Debugger
  • Last.fm
  • LyricMaster
  • NowPlaying List
  • SHOUTcast Radio
  • YABS

without the extension it runs all fine, with it randomly crashes on track change, play or other functions.

7 months ago
opu.e
opu.e

@thesmyth

Sorry for my late answer, Im running K/Ubuntu 64bit with Songbird from Getdeb.net
I tested it on a clean install without any plugin (same with Songbird 1.2 and 1.3b1).

The console gives nothing back to me if it crashes. So I have no error-messages for you :-(

But sometimes it crashes when I double-click on a track to start playing it. So I think there is something corrupt generating the dbus-output for other applications. Is there anything parsed?

cheers

7 months ago
thesmyth
thesmyth

@opu.e and @verdi
Thanks for the info guys, obviously there is something up with the code to send the signals out. I'm going to try to add a debug feature tonight to print out more data about what it's doing before it crashes.

Please check back in a day or two and hopefully I'll have a new version up by then.

Thanks for taking the time to reply!

7 months ago
thesmyth
thesmyth

@artanicus
The assert error should be fixed. Finally took the time to figure out the cause.

@opu.e and @verdi
The new version has a debug mode that should print out tons of info to the command line when enabled. Thanks for the help!

7 months ago
opu.e
opu.e

@thesmyth
How do I use the debug-mode?

If I start songbird through the terminal, nothing happens and songbird crashes still stilent as before. Also "songbird --debug" didn't help.

7 months ago
thesmyth
thesmyth

@opu.e
Tools > Addons... Then click preferences and enable the check box

7 months ago
opu.e
opu.e

@thesmyth

Got it, thanks. My output when changing a track untill it crashed:
http://paste.ubuntuusers.de/395938/
http://paste.ubuntuusers.de/395937/

Remarkable: the output at line 7 and 21 ;-)

But "comment" and "title" seems to be clean/right. :-\
If it helps I can send you these two tracks.

7 months ago
thesmyth
thesmyth

If you could send me one of them, it'd definitely be helpful. My email is just my username @gmail.com

I was wondering if the issue was related to special characters. I had problems in initial development because I wasn't accounting for UTF characters, but I thought that I'd fixed that. More testing material would definitely be helpful though.

Thanks.

7 months ago
opu.e
opu.e

OK, I'll send you a few links. But I have to say that songbird crashes kind of randomly, that means that it crashed not every time I started playing/changing tracks with these files!

cheers

7 months ago
thesmyth
thesmyth

Okay, cool. One last question, what locale is your computer set to? You can run "locale" and just give me the first line or something.

7 months ago
thesmyth
thesmyth

@opu.e
I set up a virtual machine with a different locale and was finally able to replicate the problem. I think that is should work now.

Thanks a ton for the debug output, it helped a ton.

7 months ago
opu.e
opu.e

I'am german, it's all set to de_DE. (UTF-8). Same with Songbird.

Thanks so much for your help!

7 months ago
opu.e
opu.e

Hello, I tested the new version today and it worked the whole time without any problem! =)

Thanks a lot!

7 months ago
Slate8
Slate8

I too was getting the random crashing issue and am happy to say this new version seems to have fixes things. Wish I could have joined in the error reporting but been very busy recently.

Thanks for all the hard work put into geting this sorted, very much appreciated and great add-on.

7 months ago
verdi
verdi

wonderful. i'm having some problems with kde4 style dbus calls, but manual dbus-send calls work just great. no crashes as far as i can see. thank you very much.

7 months ago
thesmyth
thesmyth

Thanks guys. It's been bugging me that it hasn't been working, so I'm glad I finally got time to look into it.

The assert error was just because I forgot to initialize a struct :(

The random crashing was way more annoying though. The way that I was converting from UTF16 to a UTF8 char array was wrong. It worked fine in my locale, en_US, but as soon as I started testing with de_DE, it crashed left and right. The Mozilla docs are really hard to navigate when you have no idea what you are even looking for :P

7 months ago
thesmyth
thesmyth

Random question:

What software are you guys using this extension with?

7 months ago
opu.e
opu.e

Actually I'am using the Plugin only to make my MediaKeys working under KDE, because the MMKeys-Addon works only for Gnome.

@Slate8
What problems do you have with kde4 style dbus calls? I'am asking because I tried to add the commands to some key-combination through the system-settings in KDE4. But it didn't work:
"Interface 'org.freedesktop.mediaplayer' not available in object /Player at org.mpris.songbird:
org.freedesktop.DBus.Error.UnknownInterface (Interface 'org.freedesktop.mediaplayer' was not found)"

But if I try it in the console with "dbus-send --type=method_call --dest=org.mpris.songbird /Player org.freedesktop.MediaPlayer.Pause" it works well. :-\

7 months ago
Slate8
Slate8

@opu.e I think you must have meant to direct your question to @verdi - I am Gnome all the way :)

@thesmyth I am only using it for the MusicTracker plugin in Pidgin. Works great! Would love to hear of other uses.

7 months ago
opu.e
opu.e

Ooops, yeah. Sorry :-p

7 months ago
thesmyth
thesmyth

@opu.e Thanks again for the helpful debug info. I think KDE dbus messages should work now.

@Slate8 I figured it was mostly Musictracker people using it. I keep meaning to write a plugin for AWN to control songbird, but no idea if I'll ever get around to it, since my keyboard has multimedia buttons anyway. :P

7 months ago
verdi
verdi

@opu.e yes i think i get the same behaviour. the fix is pretty easy. most players expect a org.freedesktop.MediaPlayer.Next style command. With this plugin a simple Next call does the trick.

@thesmyth There's two more issues of implementations: could you code it so that pause/play is one command? also on a fresh start the play command won't do anything until you hit play the first time. would there be a way to change that?

7 months ago
opu.e
opu.e

@verdi
Great, thank you =)

7 months ago
Slate8
Slate8

@thesmyth if you like AWN, check out Cairo-Dock - its very pretty and easier to use in comparison http://www.cairo-dock.org/ww_page.php?p=Accueil&lang=en

7 months ago
koxmoz
koxmoz

2 questions·!·!·!·

a) Does it work in 64 bit?

b)why this does not work?

=========================
#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
object = bus.get_object('org.mozilla.songbird', '/org/mozilla/songbird')
print object.getStatus()
print object.getTitle()
print object.getArtist()
==========================

I am trying to use the plugins "music" for amsn
ideas???

6 months ago
thesmyth
thesmyth

@koxmoz
a) Read the first line of the description :P Yes does.

b) That code looks like it is for DBusBird, not MPRIS. Here is the code you should use:
========
#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
object = bus.get_object('org.mpris.songbird', '/Player')
print object.GetStatus()
data = object.GetMetadata()
print data['title']
print data['artist']
=====

I'm not sure what "status" you were looking for, but you can find a reference here:
http://wiki.xmms2.xmms.se/wiki/MPRIS#GetStatus

6 months ago
obsoe
obsoe

According to the MPRIS standard the meta data's location entry should be an URL. The location returned by this AddOn indeed starts with file:// but special characters (space, German umlauts, ...) are not escaped.

Now it's like this:
file:///path/to somewhere/reläx.mp3

But it should be like this:
file:///path/to%20somewhere/rel%C3%A4x.mp3

This is not a serious bug, but MPRIS clients may expect/require the second form.

PS: We are utilizing your add on as part of the remote control project Remuco.

5 months ago
obsoe
obsoe

Project link in previous post is broken. Fixed: Remuco.

5 months ago
Tomservo
Tomservo

Is the source code available? Your site mentions it briefly, but I don't see where. It's to make a compile for OpenSolaris.

4 months ago
siabost
siabost

Hi,

I'm on Ubuntu 9.10 with Songbird 1.2 from Getdeb.

Has anyone got aMSN (0.98.1) to show title of song playing in Songbird? Used to have it with the Songbird add-on Dbusbird but that's not been updated for 1.2.

I've tried various options in the aMSN Music plugin configuration but with no luck so far.

Thanks in advance for any pointers.

4 months ago
thesmyth
thesmyth

@Tomservo
Sorry, I've been super busy and just never got around to posting it anywhere, my bad. I'll try to post it as soon as I get a chance. :P

@siabost
I just upgraded and tested it. First off, it looks like you need to install the libqt4-dbus package via apt/Synaptic. However, it looks like the output is still a bit weird.
Run this command only once

sudo sed -i 's/$res/"$res"/g' /usr/share/amsn/plugins/music/infompris 

Or if you want to do it manually, "sudo gedit /usr/share/amsn/plugins/music/infompris" and surround every instance of $res with a quote(") character.

4 months ago
siabost
siabost

Thanks thesmyth.

That worked. Shows perfectly the song being played with aMSN music plugin configured for Songbird MPRIS.

Ta.

4 months ago
nerdy_kid
nerdy_kid

sorry for a nube question, but i want to use KDE's Input Actions (in system settings) to set up global hotkeys for songbird. I have no idea how to, but i know it can be done easely.
Thanks

4 months ago
ehtetur
ehtetur

@thesmyth.. thanks for the addon.. it's working great!!!

Here's what I'm using, it's all 64-bit...
Ubuntu Satanic Edition 666.7 (aka v 9.10)
Pidgin 2.6.3
pidgin-musictracker 0.4.19

4 months ago
Skatol
Skatol

Hi,

I'm using Kubuntu 9.10 with Songbird 1.2 from Getdeb with mpris add-on.

I tried controlling Songbird through DBUS in console with:
dbus-send --print-reply --type=method_call --dest=org.mpris.songbird /Player org.freedesktop.MediaPlayer.Pause

That results in an error output:
Error org.freedesktop.DBus.Error.UnknownMethod: Method "Pause" with signature "" on interface "org.freedesktop.MediaPlayer" doesn't exist

What am I doing wrong?

4 months ago
Skatol
Skatol

Sorry for double-post, but I didn't find an option for editing my previouse comment.

In addition to console I tried the Python sample code. But I got an error, too:
Traceback (most recent call last):
  File "songbird-test", line 6, in <module>
    stat = object.GetStatus()
  File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "GetStatus" with signature "" on interface "(null)" doesn't exist

I don't know how to fix that problem. Please help me!

DBUS should work, because controlling Amarok in console with "dbus-send ..." is working.

4 months ago
thesmyth
thesmyth

@Skatol
Weird. I don't have Kubuntu, so it is kinda hard for me to test, but here's some stuff to try.

In Songbird, go to the Addons list and click Preferences and check debug mode. Then, if you open a terminal and start songbird from there, you should see some info about what it's doing when initializing.

Also, if you run dbus-monitor, does anything show up when you changes songs and the like?

It seems like it's not registering with the DBus properly or something.

Thanks.

4 months ago
Skatol
Skatol

Thanks thesmyth for your help! I've got it!

In the end it was my fault... After testing and trying around a long time I disabled all add-ons aside form mpris and it works! Problem was an outdated add-on. I used FireTray from here (I disabled the compability check in songbird so that I could use this "old" add-on - stupid idea...).

I didn't know that I can use add-ons from "mozilla.org" but installing the current version of FireTray (https://addons.mozilla.org/de/firefox/addon/4868) solved all my problems!

4 months ago
thesmyth
thesmyth

@TomServo It did take me a month, but I put the code up on GitHub.

If you have questions, feel free to post over there. If you do compile a binary for OpenSolaris, send it to me and I'll include it in the default stuff.

http://github.com/loganfsmyth/mpris-songbird

3 months ago
fcastillo
fcastillo

Are you going to update this version for the Songbird 1.4b3??? I really want to try this add on

3 months ago
thesmyth
thesmyth

I absolutely will, I just need to get some time to set up and try out 1.4b. I have no idea if it will require recompiling or not so I'll have to see if the APIs I'm have changes much. Hopefully I just have to update the supported version number.

I'll do it within a week or so. Depends on how the timing works out.

3 months ago
crisp
crisp

Hi,
I created a very basic python script (for use on linux) that uses lastfmsubmitd set up for use with libre.fm. If you launch this script after Songbird has started it will submit your songs to libre.fm.
I'm not experienced in python coding so this is a "hacked together" script, don't expect it to run very well. Maybe someone with more knowledge of python can create something better based on this idea.
You can find the script here.

3 months ago
lammoth123
lammoth123

love this addon, especially with the mpris-remote too. nice work

3 months ago
lammoth123
lammoth123

it would be nice if we could love the tracks(with the last.fm addon) too with this protocol, is it possible?

3 months ago
seanhodges
seanhodges

Hey, great add-on!

I would really like to see the AddTrack/DelTrack methods supported, so that Songbird can better integrate with my Android project, Tesla: http://tesla.seanhodges.co.uk

Currently, the playlist and collection browser functionality are incomplete for Songbird, due to the aforementioned missing methods. Is this something you have already started work on? Could you use some help with the implementing / testing?

3 months ago
thesmyth
thesmyth

@crisp
Cool! I don't use LastFM, but nice to see people coming fun uses for this!

@lammoth
Glad ya like it. I can't add something specific like that, but you can set song ratings using this, sooo if LastFM reads the ratings, you might be able to work out something?

@seanhodges
Cool project. I wish I had an Android phone :( I'm all for implementing AddTrack and such. It has mostly been an issue of deciding the proper behavior and getting some time.
Should adding a song add it to the library and start playing it, or make a new playlist with just songs added by the extension or what?

If you want to talk it over more, my email is just my username @gmail.com

3 months ago
veritasnoctis
veritasnoctis

This extension doesn't seem to work with Cairo Dock 2.1.2-1 in Ubuntu 9.10.

3 months ago
lammoth123
lammoth123

@thesmyth i guessed so, i am planning to learn coding to try and get this done over my vacations. lets see how it goes (ie integrating mpris and ratings with last.fm)

3 months ago
seanhodges
seanhodges

@thesmyth

I've just sent you an email, please let me know if you don't receive it!

2 months ago
theWolf
theWolf

I have the same problem veritasnoctis... I downloaded this add on hoping it would let the music applet to control songbird so I didn't have to change destops to change the track or stop and pause... This is the only Dbus support Addon that will work with my songbird. I appreacite any help. Thanks guys

about 1 month ago
theWolf
theWolf

For the record when I hit the music player to play or pause (Not skip track) then songbird gives me a notice a bubble above the icon saying whatever tab is selected on songbird. Also the music player as static all over it. Just saying that incase it helps...

about 1 month ago
memoryproblems
memoryproblems

I want to extend my deepest thanks for this plugin.

For months I'd been attempting to find a solution to use pidgim to show "Now Playing" from songbird. Tried with live-tweeter, no luck, tried various solutions, and it was not until I found this add-on that I could get it to actually work.

about 1 month ago
NintendoKilledAtari
NintendoKilledAtari

Thank you very much for this fantastic plugin. I rate it 5 stars. It works perfectly with Pidgin on Ubuntu 9.10.

about 1 month ago
thesmyth
thesmyth

Thanks for the comments guys! Glad to see people using it. :)

@veritasnoctis and @theWolf
I'll try to take a look. I've got some free..er time this coming week.

about 1 month ago
thesmyth
thesmyth

@veritasnoctis and @theWolf
It looks like Cairo-dock's Songbird support currently uses the DbusBird extension, which is why it fails. Unfortunately I don't think that extension is maintained anymore.

I might try to patch Cairo-dock, but not sure I'll have time.

27 days ago
shadyabhi
shadyabhi

I am using ubuntu 9.10 with Songbird 1.4.3.
Suppose, I run Songbird and then play a song. Now, If i query for the current track using dbus, I get the right output. If the tracks change by themselves, there is no problem. But, if i change the track myself by clicking on next track button in Songbird, the next time i query the current track using dbus, i get this error..

Traceback (most recent call last):
  File "./last.py", line 11, in <module>
    status = player_obj.GetStatus()
  File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "GetStatus" with signature "" on interface "(null)" doesn't exist

23 days ago
shadyabhi
shadyabhi

Oh, i forgot one thing. I am using 64 bit ubuntu 9.10

23 days ago
theWolf
theWolf

any help you give is appreciated thesmyth. I guess I will use Rhythmbox (Because it works with Cario dock) until you get the time to help. I will be losing all the cool add ons in Songbird, but I do a LOT of multitasking so being able to change the song without having to switch desktop or app is great. I don't know much about programing (other than apt-get and sudo) by the way where would I go to understand all this hardcore stuff? Anyway thanks once again.

22 days ago
boosh
boosh

hey thesmyth,
I just wanted to stop by and say thanks, iv'e been selfishly using it with CoverGloobus for a few months. so ya, thanks!

13 days ago
thesmyth
thesmyth

@shadyabhi If you want to get your issue worked out, email me at thesmyth [at] gmail. Send me the script you've been trying to use if you're still having issues.

@theWolf I figured out what I needed to do to patch Cairo-Dock. It turned out to be much simpler that expected, so hopefully I'll be able to get the patch into the official code soon.

@boosh Thanks! Always nice to hear people are using this :D

8 days ago
thesmyth
thesmyth

@theWolf My patch has been merged into CairoDock, so the music applet should work in the newest version. You'll probably have to install one of the weekly builds for now. https://launchpad.net/cairo-dock

5 days ago



Log in to Post a Comment


Download
Statistics
Downloads: 4,114

Average Rating:
5 out of 5  based on 6 ratings

Images: 0

Comments: 75

Last Updated: 3 months ago
Details
Name: MPRIS


Author: thesmyth

Version: 0.1.10 version history

Categories:


Log in to Add a Tag
Share
Embed:

Share: