PLUGIN: wm_tweaks.py

This plugin will change the window title and icon whenever a song
changes.
This commit is contained in:
Bryan Schumaker 2010-10-30 13:42:45 -04:00
parent adc3af3779
commit b2c5ad96cb
1 changed files with 30 additions and 0 deletions

30
plugins/wm_tweaks.py Normal file
View File

@ -0,0 +1,30 @@
# Bryan Schumaker (10/30/2010)
import ocarina
libsaria = ocarina.libsaria
lib_find_id = libsaria.collection.lib_find_id
lib_get_attr = libsaria.collection.lib_get_attr
invite = libsaria.event.invite
def reset(*args):
ocarina.set_window_icon("images/ocarina.png")
ocarina.set_window_title(ocarina.__vers__)
def tweak_icon(file):
if file != None:
ocarina.set_window_icon(file)
def tweak_title(filepath):
if filepath != None:
id = lib_find_id(filepath)
title = lib_get_attr(id, "title")
ocarina.set_window_title(title)
def start():
invite("PRELOAD", reset)
invite("POSTLOAD", tweak_title)
invite("POSTGETART", tweak_icon)
def stop():
pass