43 lines
834 B
Python
43 lines
834 B
Python
# Bryan Schumaker (8/7/2010)
|
|
|
|
import libsaria
|
|
from libsaria import path
|
|
from libsaria import version
|
|
plugin = None
|
|
export = None
|
|
|
|
dev = ""
|
|
if version.__dev__ == True:
|
|
dev = "-dev"
|
|
|
|
def open_plugin(file):
|
|
global plugin
|
|
if plugin == None:
|
|
from libsaria import plugin
|
|
plugin.install(file)
|
|
|
|
def open_xml(file):
|
|
global export
|
|
if export == None:
|
|
import export
|
|
export.import_xml(file)
|
|
|
|
def open_music(file):
|
|
try:
|
|
libsaria.sources.cur_id = None
|
|
libsaria.controls.load(file)
|
|
libsaria.controls.play()
|
|
except Exception, e:
|
|
print e
|
|
|
|
mapping = {".py":open_plugin, ".xml":open_xml}
|
|
def universal_open(file):
|
|
file = file.replace("%20", " ")
|
|
file = file.replace("%22", "\"")
|
|
if path.is_dir(file):
|
|
libsaria.sources.make_library(file)
|
|
return
|
|
base, ext = path.splitext(file)
|
|
func = mapping.get(ext, open_music)
|
|
func(file)
|