ocarina/libsaria/__init__.py

69 lines
1.1 KiB
Python

# Bryan Schumaker (8/7/2010)
__all__ = [ "collection", "music",
"data", "event", "map", "path", "plugin"]
__major__ = 1
__minor__ = 1
__dev__ = True
__vers__ = "Libsaria %s.%s" % (__major__, __minor__)
if __dev__ == False:
__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
music = None
lastfm = None
# Initialize helpful variables
def init():
global vars
global prefs
global music
global lastfm
vars = Map()
prefs = Map("preferences")
import music
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")
music.init()
plugin.load_all()
event.start("POSTSTART")
def shutdown():
event.start("PREQUIT")
event.start("POSTQUIT")