星期五, 7月 04, 2008

[Boo]Play automatically after Banshee launched

I use the BooScript extension which was introduced in previous post to make Banshee play automatically.
When BooScript extension is loaded, the extension will check the scripts. If there are scripts, it will compile them and execute. At this moment, lots of things are not initialized yet, so we have to add code to Application.ClientStarted. And application will execute our code after everything is initialized.


import System
import System.IO
import Banshee.ServiceStack

def OnClientStarted( client as Client ):
Hyena.Log.Information( "engine is playing now..." )
ServiceManager.PlayerEngine.Play()

Hyena.Log.Information( "autoplay script is loaded." )

Banshee.ServiceStack.Application.ClientStarted += OnClientStarted


The script is very simple, I will add the functions to save the current track and to play the saved track automatically.

沒有留言: