Move generic saving / loading functions
These belong under path/
This commit is contained in:
parent
751af55575
commit
42948165a3
|
@ -1,7 +1,7 @@
|
||||||
# Bryan Schumaker (8/7/2010)
|
# Bryan Schumaker (8/7/2010)
|
||||||
|
|
||||||
__all__ = [ "audio", "sources",
|
__all__ = [ "audio", "sources",
|
||||||
"data", "event", "map", "path", "plugin"]
|
"event", "map", "path", "plugin"]
|
||||||
|
|
||||||
__major__ = 1
|
__major__ = 1
|
||||||
__minor__ = 2
|
__minor__ = 2
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import os
|
import os
|
||||||
import tagpy
|
import tagpy
|
||||||
import libsaria
|
import libsaria
|
||||||
|
import libsaria.path.files
|
||||||
import string
|
import string
|
||||||
from track import Track
|
from track import Track
|
||||||
splitext = libsaria.path.splitext
|
splitext = libsaria.path.splitext
|
||||||
|
@ -52,7 +53,7 @@ def load():
|
||||||
global index
|
global index
|
||||||
global tracks
|
global tracks
|
||||||
global sources
|
global sources
|
||||||
objects = libsaria.data.load("library", ".lib")
|
objects = libsaria.path.files.load("library", ".lib")
|
||||||
if objects == None or len(objects) != 5:
|
if objects == None or len(objects) != 5:
|
||||||
reset()
|
reset()
|
||||||
return
|
return
|
||||||
|
@ -61,7 +62,7 @@ def load():
|
||||||
|
|
||||||
def save():
|
def save():
|
||||||
global sources
|
global sources
|
||||||
libsaria.data.save( (sources, tracks, fs_tree, tag_tree, index),
|
libsaria.path.files.save( (sources, tracks, fs_tree, tag_tree, index),
|
||||||
"library", ".lib")
|
"library", ".lib")
|
||||||
|
|
||||||
def walk():
|
def walk():
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import random as rand
|
import random as rand
|
||||||
|
|
||||||
import libsaria
|
import libsaria
|
||||||
|
import libsaria.path.files
|
||||||
from libsaria.sources import library
|
from libsaria.sources import library
|
||||||
call = libsaria.event.call
|
call = libsaria.event.call
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ def load():
|
||||||
global song_list
|
global song_list
|
||||||
global song_set
|
global song_set
|
||||||
global visible
|
global visible
|
||||||
song_list = libsaria.data.load("playlist", ".list")
|
song_list = libsaria.path.files.load("playlist", ".list")
|
||||||
if song_list == None:
|
if song_list == None:
|
||||||
reset()
|
reset()
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Bryan Schumaker (11/06/2010)
|
# Bryan Schumaker (11/06/2010)
|
||||||
|
|
||||||
from libsaria import data
|
from libsaria.path import files
|
||||||
from libsaria.path import sep
|
from libsaria.path import sep
|
||||||
|
|
||||||
class Tree(dict):
|
class Tree(dict):
|
||||||
|
@ -227,15 +227,15 @@ class PersPrefTree(PrefTree):
|
||||||
def init_pref(self, pref, value):
|
def init_pref(self, pref, value):
|
||||||
PrefTree.init_pref(self, pref, value)
|
PrefTree.init_pref(self, pref, value)
|
||||||
if self.file != None:
|
if self.file != None:
|
||||||
data.save(self, self.file, ".tree")
|
files.save(self, self.file, ".tree")
|
||||||
|
|
||||||
def set_pref(self, pref, value):
|
def set_pref(self, pref, value):
|
||||||
PrefTree.set_pref(self, pref, value)
|
PrefTree.set_pref(self, pref, value)
|
||||||
if self.file != None:
|
if self.file != None:
|
||||||
data.save(self, self.file, ".tree")
|
files.save(self, self.file, ".tree")
|
||||||
|
|
||||||
def get_pref_tree(file):
|
def get_pref_tree(file):
|
||||||
tree = data.load(file, ".tree")
|
tree = files.load(file, ".tree")
|
||||||
if tree == None:
|
if tree == None:
|
||||||
tree = PersPrefTree(file)
|
tree = PersPrefTree(file)
|
||||||
return tree
|
return tree
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import ocarina
|
import ocarina
|
||||||
libsaria = ocarina.libsaria
|
libsaria = ocarina.libsaria
|
||||||
gtk = ocarina.gtk
|
gtk = ocarina.gtk
|
||||||
data = None
|
files = None
|
||||||
|
|
||||||
TARGET_TYPE_URI_LIST = 80
|
TARGET_TYPE_URI_LIST = 80
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ def resized(widget, geom):
|
||||||
|
|
||||||
|
|
||||||
def dnd_receive(widget, context, x, y, selection, type, time):
|
def dnd_receive(widget, context, x, y, selection, type, time):
|
||||||
global data
|
global files
|
||||||
if data == None:
|
if files == None:
|
||||||
from libsaria import data
|
from libsaria.path import files
|
||||||
if type == TARGET_TYPE_URI_LIST:
|
if type == TARGET_TYPE_URI_LIST:
|
||||||
uri = selection.data.strip('\r\n\x00')
|
uri = selection.data.strip('\r\n\x00')
|
||||||
import os
|
import os
|
||||||
for file in uri.split():
|
for file in uri.split():
|
||||||
file = file[7:]
|
file = file[7:]
|
||||||
data.universal_open(file)
|
files.universal_open(file)
|
||||||
|
|
Loading…
Reference in New Issue