|
@@ -64,6 +64,8 @@ class Track:
|
|
|
label += ':' + player
|
|
|
if library_id:
|
|
|
label += ':' + library_id
|
|
|
+ elif library_id:
|
|
|
+ raise Exception((player, library_id))
|
|
|
for k, c in self._iface.get_free_ints(label):
|
|
|
player, library_id, register_ts_dec = k.split(':')[2:]
|
|
|
yield PlayCount(
|
|
@@ -93,6 +95,9 @@ class Track:
|
|
|
assert len(counts) == 1, counts
|
|
|
return counts[0]
|
|
|
|
|
|
+ def get_play_count_sum(self, player=None, library_id=None):
|
|
|
+ return sum(c.count for c in self._get_latest_play_counts(player, library_id))
|
|
|
+
|
|
|
def register_play_count(self, player, library_id, register_dt, play_count, tag_set_cb=None):
|
|
|
|
|
|
assert isinstance(register_dt, dt.datetime), register_dt
|
|
@@ -110,14 +115,16 @@ class Track:
|
|
|
raise Exception((current_count, play_count))
|
|
|
|
|
|
@classmethod
|
|
|
- def walk(cls, root_path, path_ignore_regex, ignored_cb, unsupported_cb):
|
|
|
+ def walk(cls, root_path, path_ignore_regex, ignored_cb=None, unsupported_cb=None):
|
|
|
for dirpath, dirnames, filenames in os.walk(root_path):
|
|
|
for filename in filenames:
|
|
|
track_path = os.path.join(dirpath, filename)
|
|
|
if path_ignore_regex.search(track_path):
|
|
|
- ignored_cb(track_path)
|
|
|
+ if ignored_cb is not None:
|
|
|
+ ignored_cb(track_path)
|
|
|
else:
|
|
|
try:
|
|
|
yield cls(track_path)
|
|
|
except NotImplementedError as e:
|
|
|
- unsupported_cb(track_path, e)
|
|
|
+ if unsupported_cb is not None:
|
|
|
+ unsupported_cb(track_path, e)
|