Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 68 lines (56 sloc) 2.013 kb
#!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
banshee = {
'DBusCommandService': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/DBusCommandService"),
'SourceManager': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/SourceManager"),
'PlayQueue': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/SourceManager/PlayQueue"),
'PlayerEngine': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlayerEngine"),
'PlaybackController': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlaybackController"),
'CollectionIndexerService': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/CollectionIndexerService"),
'ClientWindow': bus.get_object("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/ClientWindow")
}
def findBansheeObject(str):
for group in banshee:
if group.lower() == str.lower():
return group
None
def findBansheeSubobject(object, str):
group = findBansheeObject(object)
methodName = str[0].capitalize() + str[1:] # TODO: Actually search for the object name...
method = getattr(banshee[group], methodName)
return method
line = ''
found = False
while line != 'exit':
try:
line = raw_input(">> ")
except KeyboardInterrupt:
print "\nExiting..."
exit()
if ' ' in line:
words = line.split(' ')
else:
words=[line]
if line == "exit":
exit
elif len(words) > 1:
try:
method = findBansheeSubobject(words[0], words[1])
print method()
except Exception as e:
print "Error: ", type(e).__name__, "(", e, ")"
elif len(words) == 1:
for group in banshee:
try:
method = findBansheeSubobject(group, words[0])
print method()
found = True
break
except Exception as e:
pass
if not found:
print "Error: Command not found"
found = False
else:
print "Not enough args"
Jump to Line
Something went wrong with that request. Please try again.