Library play_id()
I have moved over the play_id function to the library module.
This commit is contained in:
parent
58ad3c7a9d
commit
3cece3826f
|
@ -15,10 +15,10 @@ QUEUE = 2
|
|||
|
||||
import lens
|
||||
import library
|
||||
#library = lens.Library()
|
||||
playlist = lens.Playlist()
|
||||
|
||||
file_to_id = library.file_to_id
|
||||
play_id = library.play_id
|
||||
get_attr = library.get_attr
|
||||
reset = library.reset
|
||||
inc_score = library.inc_score
|
||||
|
@ -40,13 +40,6 @@ def new_source(path, bg=True):
|
|||
return 0
|
||||
return call("NEWSOURCE", library.scan, path)
|
||||
|
||||
def lib_play_id(id):
|
||||
global cur_lib_id
|
||||
cur_lib_id = id
|
||||
filepath = library.get_attr(id, "filepath")
|
||||
libsaria.music.load(filepath)
|
||||
libsaria.music.play()
|
||||
|
||||
def lib_get_cur_id():
|
||||
global cur_lib_id
|
||||
return cur_lib_id
|
||||
|
@ -106,7 +99,7 @@ def choose_next():
|
|||
else:
|
||||
next = playlist.next_id(cur_lib_id)
|
||||
if next != None:
|
||||
return call("NEXT", lib_play_id, next)
|
||||
return call("NEXT", play_id, next)
|
||||
|
||||
def change_score():
|
||||
prcnt = libsaria.music.get_progress()
|
||||
|
|
|
@ -93,5 +93,11 @@ def inc_count(id):
|
|||
rec.count += 1
|
||||
save()
|
||||
|
||||
def play_id(id):
|
||||
libsaria.collection.cur_lib_id = id
|
||||
filepath = get_attr(id, "filepath")
|
||||
libsaria.music.load(filepath)
|
||||
libsaria.music.play()
|
||||
|
||||
def is_visible(id):
|
||||
return True
|
||||
|
|
|
@ -56,7 +56,7 @@ def universal_open(file):
|
|||
try:
|
||||
id = libsaria.collection.file_to_id(file)
|
||||
if id:
|
||||
libsaria.collection.lib_play_id(id)
|
||||
libsaria.collection.play_id(id)
|
||||
else:
|
||||
libsaria.music.load(file)
|
||||
except Exception,e:
|
||||
|
|
|
@ -100,7 +100,7 @@ class Library(Collection):
|
|||
|
||||
def select_row(self, row):
|
||||
collection.change_score()
|
||||
collection.lib_play_id(row[0])
|
||||
collection.play_id(row[0])
|
||||
collection.inc_score(row[0], 1)
|
||||
|
||||
def filter(self, text):
|
||||
|
@ -144,7 +144,7 @@ class Playlist(Collection):
|
|||
|
||||
def select_row(self, row):
|
||||
collection.change_score()
|
||||
collection.lib_play_id(row[0])
|
||||
collection.play_id(row[0])
|
||||
collection.inc_score(row[0], 1)
|
||||
|
||||
def filter(self, text):
|
||||
|
|
Loading…
Reference in New Issue