File: cmus-updatepidgin.py

package info (click to toggle)
cmus 2.7.1%2Bgit20160225-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,848 kB
  • sloc: ansic: 35,866; sh: 1,548; makefile: 260; python: 159
file content (25 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/python
# -*- coding: utf-8 -*-

import dbus
import sys

args = {}

for n in range(1, len(sys.argv) - 1, 2):
	args[sys.argv[n]] = sys.argv[n + 1]

print args

bus = dbus.SessionBus()

obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
pidgin = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")

current = pidgin.PurpleSavedstatusGetCurrent()
status_type = pidgin.PurpleSavedstatusGetType(current)
saved = pidgin.PurpleSavedstatusNew("", status_type)
pidgin.PurpleSavedstatusSetMessage(saved, "♪ %s - %s" % (args["artist"], args["title"]))
pidgin.PurpleSavedstatusActivate(saved)