74 lines
1.6 KiB
Python
74 lines
1.6 KiB
Python
# Bryan Schumaker (4 / 20 / 2011)
|
|
|
|
import gtk
|
|
import gobject
|
|
|
|
import libsaria
|
|
import queue
|
|
from ocarina import body
|
|
from ocarina import settings
|
|
from ocarina.body import footer
|
|
from libsaria import callbacks
|
|
import window
|
|
import playlist
|
|
import library
|
|
|
|
def on_play():
|
|
footer.on_play()
|
|
callbacks.on_play = on_play
|
|
|
|
def on_pause():
|
|
footer.on_pause()
|
|
callbacks.on_pause = on_pause
|
|
|
|
def on_load(file, attrs):
|
|
footer.on_load(attrs)
|
|
queue.refresh()
|
|
body.cur_page_goto()
|
|
window.set_icon(attrs["art"])
|
|
callbacks.on_load = on_load
|
|
|
|
def on_like(like):
|
|
footer.on_like(like)
|
|
callbacks.on_like = on_like
|
|
|
|
|
|
# A bit of a hack to force setting album art in the main thread
|
|
# Basically, I create a new signal and trigger it when new album
|
|
# art arrives
|
|
gobject.signal_new("get_art", gobject.GObject, gobject.SIGNAL_RUN_LAST,
|
|
gobject.TYPE_NONE,
|
|
(gobject.TYPE_INT, gobject.TYPE_STRING))
|
|
|
|
def on_get_art_helper(obj, id, path):
|
|
if id == libsaria.sources.get_cur_id():
|
|
#footer.set_art(path)
|
|
#window.set_icon(path)
|
|
pass
|
|
|
|
on_get_art_obj = gobject.GObject()
|
|
on_get_art_obj.connect("get_art", on_get_art_helper)
|
|
|
|
def on_get_art(path, id):
|
|
on_get_art_obj.emit("get_art", id, path)
|
|
callbacks.on_get_art = on_get_art
|
|
|
|
def on_load_playlist():
|
|
playlist.refresh()
|
|
callbacks.on_load_playlist = on_load_playlist
|
|
|
|
def library_updated():
|
|
library.refresh()
|
|
settings.library.refresh()
|
|
callbacks.on_library_updated = library_updated
|
|
|
|
def on_queue_changed():
|
|
queue.refresh()
|
|
callbacks.on_queue_changed = on_queue_changed
|
|
|
|
def on_refilter():
|
|
queue.refilter()
|
|
playlist.refilter()
|
|
library.refilter()
|
|
callbacks.on_refilter = on_refilter
|