71 lines
1.2 KiB
Python
71 lines
1.2 KiB
Python
# Bryan Schumaker (8/7/2010)
|
|
|
|
__all__ = [ "audio", "sources",
|
|
"data", "event", "map", "path", "plugin"]
|
|
|
|
__major__ = 1
|
|
__minor__ = 2
|
|
__dev__ = True
|
|
__vers__ = "Libsaria %s.%s" % (__major__, __minor__)
|
|
if __dev__ == True:
|
|
__vers__ += "-dev"
|
|
|
|
import event
|
|
import path
|
|
from map import Map
|
|
from cache import Cache
|
|
|
|
# Variables are not saved across sessions, but preferences are
|
|
# The cache is also saved across sessions
|
|
vars = None
|
|
prefs = None
|
|
cache = Cache()
|
|
|
|
plugin = None
|
|
audio = None
|
|
lastfm = None
|
|
|
|
|
|
# Initialize helpful variables
|
|
def init():
|
|
global vars
|
|
global prefs
|
|
global audio
|
|
global lastfm
|
|
|
|
vars = Map()
|
|
prefs = Map("preferences")
|
|
import audio
|
|
import lastfm
|
|
|
|
event.start("POSTINIT")
|
|
|
|
|
|
# If a preference has not already been set, set pref[key] = value
|
|
def init_pref(key, value):
|
|
global prefs
|
|
if prefs.get(key, None) == None:
|
|
prefs[key] = value
|
|
|
|
def init_var(key, value):
|
|
global vars
|
|
if vars.get(key, None) == None:
|
|
vars[key] = value
|
|
|
|
|
|
def startup():
|
|
global plugin
|
|
import plugin
|
|
|
|
event.start("PRESTART")
|
|
audio.init()
|
|
plugin.load_all()
|
|
event.start("POSTSTART")
|
|
|
|
|
|
def shutdown():
|
|
event.start("PREQUIT")
|
|
import plugin
|
|
plugin.quit()
|
|
event.start("POSTQUIT")
|