hugosenari / mpris2

mpris2 python usable definition
26 stars 3 forks source link

Does not work for multiple players #3

Closed Unrud closed 9 years ago

Unrud commented 9 years ago
from mpris2 import Player
p1 = Player(dbus_interface_info={'dbus_uri': "org.mpris.MediaPlayer2.parole"})
p2 = Player(dbus_interface_info={'dbus_uri': "org.mpris.MediaPlayer2.clementine"})
p2.PlayPause() # controls parole not clementine

Problem:

class Player(Interfaces):
    @DbusInterface(Interfaces.PLAYER, Interfaces.OBJECT_PATH)
    def __init__(self):
        pass
    @DbusMethod
    def PlayPause(self):
        pass

DbusInterface and DbusMethod are only called once when the class object is created and the same instances of DbusInterface and DbusMethod are used for all instances of Player.

hugosenari commented 9 years ago

Thank you, I never tested this case before.

I created a branch to fix this issue, can you say if this resolve your problem?

Tested here with vlc and gmusicbrowser.

Unrud commented 9 years ago

It works, thank you.