libsaria: Add in play count dattr
I want to track how often songs are played. This patch gives me the ability to do that.
This commit is contained in:
parent
49f7829706
commit
0a644752a4
|
@ -14,8 +14,7 @@ attrs.load_dattrs()
|
|||
cur_id = None
|
||||
|
||||
def inc_count():
|
||||
# This will eventually increment a play count...
|
||||
pass
|
||||
attrs.inc_count(get_attrs("id")[0])
|
||||
|
||||
def find_attrs(file, *attrs):
|
||||
if file == None:
|
||||
|
@ -31,6 +30,8 @@ def find_attrs(file, *attrs):
|
|||
res.append(id)
|
||||
elif attr == "like":
|
||||
res.append(attrs.get_dattr(id, "like"))
|
||||
elif attr == "count":
|
||||
res.append(attrs.get_count(id))
|
||||
else:
|
||||
res.append(get(attr))
|
||||
return res
|
||||
|
|
|
@ -8,6 +8,7 @@ library_lock = threading.Lock()
|
|||
lock_library = library_lock.acquire
|
||||
unlock_library = library_lock.release
|
||||
get_dattr = attrs.get_dattr
|
||||
get_count = attrs.get_count
|
||||
|
||||
# Map directory -> dict()
|
||||
lib_dict = None
|
||||
|
@ -66,6 +67,8 @@ def get_attrs(id, *attrs):
|
|||
res.append(id)
|
||||
elif attr == "like":
|
||||
res.append(get_dattr(id, attr))
|
||||
elif attr == "count":
|
||||
res.append(get_count(id))
|
||||
else:
|
||||
res.append(get(attr))
|
||||
unlock_library()
|
||||
|
|
Loading…
Reference in New Issue