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