# Bryan Schumaker (8/7/2010)

__major__ = 4
__minor__ = 5
__bug__   = 0
__dev__   = False

__vstr__  = "%s.%s" % (__major__, __minor__)
if __bug__ > 0:
	__vstr__ = "%s.%s" % (__vstr__, __bug__)
if __dev__ == True:
	__vstr__ += "-dev"
__vers__ = "Libsaria %s" % __vstr__

import prefs
import audio

import path
from path.cache import Cache

# The cache is also saved across sessions
cache = Cache()

#plugin   = None
lastfm   = None
controls = None


# Initialize helpful variables
def init():
	global lastfm
	global controls

	import controls
	import sources
	from path import lastfm

	sources.library.init_bg()
	sources.playlist.init_bg()
	sources.queue.init_bg()
	controls.init()


def startup():
#	global plugin
#	import plugin

	controls.init2()
#	plugin.load_all()
	prefs.enable_save()
	parse_user_input()
	sources.playlist.startup()


def shutdown():
	audio.shutdown()
##	import plugin
##	plugin.quit()


def parse_user_input():
	import sys
	for item in sys.argv[1:]:
		path.files.universal_open(item)
init()
