Track play count
The play count is incremented under two conditions. 1) The track finishes playing. 2) The user skips to the next track, but the current track has played more than 75%
This commit is contained in:
parent
6d7b08f921
commit
5835f55eb2
|
@ -44,6 +44,11 @@ def lib_get_attr(id, attr):
|
|||
if id >= 0:
|
||||
return library.get_attr(id, attr)
|
||||
|
||||
def lib_inc_count(id):
|
||||
global library
|
||||
if id >= 0:
|
||||
library.inc_count(id)
|
||||
|
||||
def lib_play_id(id):
|
||||
global cur_lib_id
|
||||
cur_lib_id = id
|
||||
|
@ -101,7 +106,7 @@ def plist_filter(text):
|
|||
def plist_refresh():
|
||||
return call("PLISTREFRESH")
|
||||
|
||||
def plist_next(arg=None):
|
||||
def choose_next():
|
||||
global playlist
|
||||
global cur_lib_id
|
||||
if libsaria.prefs["random"] == True:
|
||||
|
@ -109,7 +114,16 @@ def plist_next(arg=None):
|
|||
else:
|
||||
next = playlist.next_id(cur_lib_id)
|
||||
if next != None:
|
||||
lib_play_id(next)
|
||||
libsaria.event.invite("POSTEOS", plist_next)
|
||||
return call("NEXT", lib_play_id, next)
|
||||
|
||||
def plist_next():
|
||||
prcnt = libsaria.music.get_progress()
|
||||
if prcnt > 75:
|
||||
lib_inc_count(cur_lib_id)
|
||||
|
||||
def catch_eos(arg=None):
|
||||
lib_inc_count(cur_lib_id)
|
||||
choose_next()
|
||||
libsaria.event.invite("POSTEOS", catch_eos)
|
||||
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ class Library(collection.Collection):
|
|||
save(badfiles, "badfiles", "")
|
||||
self.disp()
|
||||
|
||||
def inc_count(self, id):
|
||||
rec = self.records.get(id, None)
|
||||
if rec:
|
||||
rec.count += 1
|
||||
|
||||
def update(self, path):
|
||||
global badfiles
|
||||
FileRef = libsaria.collection.FileRef
|
||||
|
|
Loading…
Reference in New Issue