Stop using file_to_id
We should now use file_id located in libsaria.path
This commit is contained in:
parent
fbfc5738c6
commit
3eeb35d81c
|
@ -9,7 +9,7 @@ add_child = xml.add_child
|
||||||
add_text = xml.add_text
|
add_text = xml.add_text
|
||||||
get_attrs = library.get_attrs
|
get_attrs = library.get_attrs
|
||||||
set_attr = library.set_attr
|
set_attr = library.set_attr
|
||||||
file2id = library.file_to_id
|
file2id = path.file_id
|
||||||
lib_file = "library"
|
lib_file = "library"
|
||||||
vers = "%s.%s" % (libsaria.__major__, libsaria.__minor__)
|
vers = "%s.%s" % (libsaria.__major__, libsaria.__minor__)
|
||||||
if libsaria.__dev__ == True:
|
if libsaria.__dev__ == True:
|
||||||
|
|
|
@ -59,10 +59,7 @@ def universal_open(file):
|
||||||
backup.restore(file)
|
backup.restore(file)
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
id = libsaria.sources.file_to_id(file)
|
if libsaria.sources.library.play_id(id) == False:
|
||||||
if id:
|
|
||||||
libsaria.sources.play_id(id)
|
|
||||||
else:
|
|
||||||
libsaria.audio.load(file)
|
libsaria.audio.load(file)
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
print e
|
print e
|
||||||
|
|
|
@ -5,9 +5,9 @@ from libsaria import sources
|
||||||
from libsaria import web
|
from libsaria import web
|
||||||
from libsaria import xm
|
from libsaria import xm
|
||||||
|
|
||||||
file_to_id = libsaria.sources.file_to_id
|
file_id = libsaria.path.file_id
|
||||||
cache = libsaria.cache
|
cache = libsaria.cache
|
||||||
pref_attr = xm.find_preferred_attribute
|
pref_attr = xm.find_preferred_attribute
|
||||||
|
|
||||||
pref_sizes = ["extralarge", "large", "medium", "small"]
|
pref_sizes = ["extralarge", "large", "medium", "small"]
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ def get_artwork_id(id):
|
||||||
return get_artwork_tags(artist, album)
|
return get_artwork_tags(artist, album)
|
||||||
|
|
||||||
def get_artwork(filepath):
|
def get_artwork(filepath):
|
||||||
id = file_to_id(filepath)
|
id = file_id(filepath)
|
||||||
if id == None:
|
if id == None:
|
||||||
return
|
return
|
||||||
file = get_artwork_id(id)
|
file = get_artwork_id(id)
|
||||||
|
|
|
@ -13,7 +13,6 @@ prefs = None
|
||||||
import library
|
import library
|
||||||
import playlist
|
import playlist
|
||||||
|
|
||||||
file_to_id = library.file_to_id
|
|
||||||
play_id = library.play_id
|
play_id = library.play_id
|
||||||
get_attrs = library.get_attrs
|
get_attrs = library.get_attrs
|
||||||
reset = library.reset
|
reset = library.reset
|
||||||
|
|
|
@ -96,9 +96,6 @@ def get_locations():
|
||||||
for loc in locations:
|
for loc in locations:
|
||||||
yield loc
|
yield loc
|
||||||
|
|
||||||
def file_to_id(file):
|
|
||||||
return os.stat(file).st_ino
|
|
||||||
|
|
||||||
def artists():
|
def artists():
|
||||||
keys = tag_tree.keys()
|
keys = tag_tree.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
|
@ -181,12 +178,17 @@ def inc_count(id):
|
||||||
save()
|
save()
|
||||||
|
|
||||||
def play_id(id):
|
def play_id(id):
|
||||||
load_id(id)
|
loaded = load_id(id)
|
||||||
libsaria.controls.play()
|
if loaded == True:
|
||||||
|
libsaria.controls.play()
|
||||||
|
return loaded
|
||||||
|
|
||||||
def load_id(id):
|
def load_id(id):
|
||||||
|
if tracks.get(id, None) == None:
|
||||||
|
return False
|
||||||
libsaria.sources.cur_lib_id = id
|
libsaria.sources.cur_lib_id = id
|
||||||
libsaria.audio.load(get_attrs(id, "filepath")[0])
|
libsaria.audio.load(get_attrs(id, "filepath")[0])
|
||||||
|
return True
|
||||||
|
|
||||||
def filter(text):
|
def filter(text):
|
||||||
global visible
|
global visible
|
||||||
|
|
|
@ -6,20 +6,17 @@ gobject = ocarina.gobject
|
||||||
invite = ocarina.libsaria.event.invite
|
invite = ocarina.libsaria.event.invite
|
||||||
libsaria = ocarina.libsaria
|
libsaria = ocarina.libsaria
|
||||||
|
|
||||||
#update = None
|
get_time = None
|
||||||
get_time = None
|
get_attrs = None
|
||||||
get_attrs = None
|
file_id = None
|
||||||
file_to_id = None
|
|
||||||
|
|
||||||
def set_fns():
|
def set_fns():
|
||||||
#global update
|
|
||||||
global get_time
|
global get_time
|
||||||
global get_attrs
|
global get_attrs
|
||||||
global file_to_id
|
global file_id
|
||||||
#update = ocarina.libsaria.audio.get_progress
|
get_time = ocarina.libsaria.audio.get_time
|
||||||
get_time = ocarina.libsaria.audio.get_time
|
get_attrs = libsaria.sources.get_attrs
|
||||||
get_attrs = libsaria.sources.get_attrs
|
file_id = libsaria.path.file_id
|
||||||
file_to_id = libsaria.sources.file_to_id
|
|
||||||
invite("POSTSTART", set_fns)
|
invite("POSTSTART", set_fns)
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,7 +43,7 @@ class AttrLabel(gtk.Alignment):
|
||||||
|
|
||||||
def update(self, filepath):
|
def update(self, filepath):
|
||||||
global get_attrs
|
global get_attrs
|
||||||
id = file_to_id(filepath)
|
id = file_id(filepath)
|
||||||
if id != None:
|
if id != None:
|
||||||
text = str(get_attrs(id, self.attr)[0])
|
text = str(get_attrs(id, self.attr)[0])
|
||||||
if self.other:
|
if self.other:
|
||||||
|
|
|
@ -19,7 +19,7 @@ act_bar = gtk.HBox()
|
||||||
pages = dict()
|
pages = dict()
|
||||||
|
|
||||||
def change_title(filepath):
|
def change_title(filepath):
|
||||||
id = libsaria.sources.file_to_id(filepath)
|
id = libsaria.path.file_id(filepath)
|
||||||
(ttl, artst) = libsaria.sources.get_attrs(id, "title", "artist")
|
(ttl, artst) = libsaria.sources.get_attrs(id, "title", "artist")
|
||||||
title.set_text("%s by %s" % (ttl, artst))
|
title.set_text("%s by %s" % (ttl, artst))
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ def fetch_lyrics(file, artist, title):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_lyrics(filepath):
|
def set_lyrics(filepath):
|
||||||
id = libsaria.sources.file_to_id(filepath)
|
id = libsaria.path.file_id(filepath)
|
||||||
artist, title = libsaria.sources.library.get_attrs(id, "artist", "title")
|
artist, title = libsaria.sources.library.get_attrs(id, "artist", "title")
|
||||||
cached = cache[artist]
|
cached = cache[artist]
|
||||||
file = cached.get("%s.txt" % title, fetch_lyrics, artist, title)
|
file = cached.get("%s.txt" % title, fetch_lyrics, artist, title)
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
import ocarina
|
import ocarina
|
||||||
from ocarina import window
|
from ocarina import window
|
||||||
gdk = ocarina.gdk
|
gdk = ocarina.gdk
|
||||||
libsaria = ocarina.libsaria
|
libsaria = ocarina.libsaria
|
||||||
file_to_id = libsaria.sources.file_to_id
|
file_id = libsaria.path.file_id
|
||||||
get_attrs = libsaria.sources.get_attrs
|
get_attrs = libsaria.sources.get_attrs
|
||||||
invite = libsaria.event.invite
|
invite = libsaria.event.invite
|
||||||
|
|
||||||
|
|
||||||
def tweak_icon(file):
|
def tweak_icon(file):
|
||||||
|
@ -18,7 +18,7 @@ def tweak_icon(file):
|
||||||
|
|
||||||
def tweak_title(filepath):
|
def tweak_title(filepath):
|
||||||
if filepath != None:
|
if filepath != None:
|
||||||
id = file_to_id(filepath)
|
id = file_id(filepath)
|
||||||
title = get_attrs(id, "title")[0]
|
title = get_attrs(id, "title")[0]
|
||||||
else:
|
else:
|
||||||
title = ocarina.__vers__
|
title = ocarina.__vers__
|
||||||
|
|
Loading…
Reference in New Issue
Block a user