直接通过command line 似乎有bug.只能通过dbus

import dbus,sys,subprocess
import commands
bus = dbus.SessionBus()
banshee = bus.get_object ("org.bansheeproject.Banshee", "/org/bansheeproject/Banshee/PlayerEngine")
engine_interface=dbus.Interface (banshee, "org.bansheeproject.Banshee.PlayerEngine")
album=engine_interface.GetCurrentTrack()['album']
artist=engine_interface.GetCurrentTrack()['artist']
title=engine_interface.GetCurrentTrack()['name']

if len(sys.argv) == 2: 
    engine_interface.SetRating (dbus.Byte (int(sys.argv[1])))
    subprocess.call(["notify-send","Rate to: "+str(sys.argv[1]),artist+"\n"+title])
    
else:
    subprocess.call(["notify-send","Rate to: 0",artist+"\n"+title])
    engine_interface.SetRating (dbus.Byte (0))

使用:

>python bansheerating.py [1/2/3/4/5]

我是直接用easystroke的手势来运行的。