Last active
April 2, 2018 18:59
-
-
Save melvyniandrag/e170ef11aaad0336abb4f61596666c6a to your computer and use it in GitHub Desktop.
Control vlc over dbus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
import dbus.mainloop.glib | |
import time | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
bus=dbus.SessionBus() | |
obj = bus.get_object("org.mpris.MediaPlayer2.vlc", | |
"/org/mpris/MediaPlayer2") | |
print(dir(obj)) | |
vlc = dbus.Interface(obj, "org.mpris.MediaPlayer2.Player") | |
print(dir(vlc)) | |
pause = vlc.get_dbus_method( "Pause" ) | |
pause() | |
time.sleep(3) | |
play = vlc.get_dbus_method( "Play" ) | |
play() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
import dbus.mainloop.glib | |
import time | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
bus=dbus.SessionBus() | |
obj = bus.get_object("org.mpris.MediaPlayer2.vlc", # bus name. The app you want to talk to | |
"/org/mpris/MediaPlayer2") # object path | |
print(dir(obj)) | |
vlc = dbus.Interface(obj, "org.mpris.MediaPlayer2.Player") #org.mpris.MediaPlayer2.Player is an interface, a named group of methods. | |
print(dir(vlc)) | |
pause = vlc.get_dbus_method( "Pause" ) | |
pause() | |
time.sleep(3) | |
play = vlc.get_dbus_method( "Play" ) | |
play() | |
obj = bus.get_object("im.pidgin.purple.PurpleService", # bus name. The app you want to talk to | |
"/im/pidgin/purple/PurpleObject") # object path | |
print(dir(obj)) | |
vlc = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") #org.mpris.MediaPlayer2.Player is an interface, a named group of methods. | |
print(dir(vlc)) | |
pause = vlc.get_dbus_method( "PurpleAccountAddBuddy" ) | |
pause(1, 11) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment