mirror of
https://github.com/beetbox/beets.git
synced 2026-02-23 07:44:38 +01:00
mpdstats: reload item before calculations
As mpdstats is a long running process the value of one of the attributes may have changed since the song started to play (f.ex. through a manual update using `modify`).
This commit is contained in:
parent
df274e2b15
commit
159a67e30f
1 changed files with 2 additions and 0 deletions
|
|
@ -187,6 +187,7 @@ class MPDStats(object):
|
|||
return
|
||||
|
||||
if increment is not None:
|
||||
item.load()
|
||||
value = type(increment)(item.get(attribute, 0)) + increment
|
||||
|
||||
if value is not None:
|
||||
|
|
@ -202,6 +203,7 @@ class MPDStats(object):
|
|||
def update_rating(self, item, skipped):
|
||||
"""Update the rating for a beets item.
|
||||
"""
|
||||
item.load()
|
||||
rating = self.rating(
|
||||
int(item.get('play_count', 0)),
|
||||
int(item.get('skip_count', 0)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue