2010-08-07 12:55:23 -04:00
|
|
|
# Bryan Schumaker (8/7/2010)
|
|
|
|
|
2010-10-08 13:09:42 -04:00
|
|
|
import libsaria
|
2010-08-07 12:55:23 -04:00
|
|
|
from libsaria import path
|
2011-05-06 22:36:33 -04:00
|
|
|
from libsaria import version
|
2010-08-15 01:05:37 -04:00
|
|
|
plugin = None
|
2010-12-27 12:06:22 -05:00
|
|
|
export = None
|
2010-08-07 12:55:23 -04:00
|
|
|
|
2010-11-01 08:22:38 -04:00
|
|
|
dev = ""
|
2011-05-06 22:36:33 -04:00
|
|
|
if version.__dev__ == True:
|
2010-11-01 08:22:38 -04:00
|
|
|
dev = "-dev"
|
|
|
|
|
2010-12-27 12:06:22 -05:00
|
|
|
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)
|
2010-08-07 12:55:23 -04:00
|
|
|
|
2010-12-27 12:06:22 -05:00
|
|
|
def open_music(file):
|
|
|
|
try:
|
2011-06-09 08:35:02 -04:00
|
|
|
libsaria.sources.cur_id = None
|
2011-05-26 09:18:43 -04:00
|
|
|
libsaria.controls.load(file)
|
2011-06-09 08:35:02 -04:00
|
|
|
libsaria.controls.play()
|
2010-12-27 12:06:22 -05:00
|
|
|
except Exception, e:
|
|
|
|
print e
|
|
|
|
|
|
|
|
mapping = {".py":open_plugin, ".xml":open_xml}
|
2010-08-15 01:05:37 -04:00
|
|
|
def universal_open(file):
|
2010-11-09 13:55:14 -05:00
|
|
|
file = file.replace("%20", " ")
|
|
|
|
file = file.replace("%22", "\"")
|
2010-09-13 19:32:13 -04:00
|
|
|
if path.is_dir(file):
|
2011-05-21 07:16:00 -04:00
|
|
|
libsaria.sources.make_library(file)
|
2010-10-21 07:55:21 -04:00
|
|
|
return
|
2010-12-27 12:06:22 -05:00
|
|
|
base, ext = path.splitext(file)
|
|
|
|
func = mapping.get(ext, open_music)
|
|
|
|
func(file)
|