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:
Johann Klähn 2013-12-12 08:19:23 +01:00
parent df274e2b15
commit 159a67e30f

View file

@ -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)),