From 159a67e30f931449e52649f4ccaf1d9e027137ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johann=20Kl=C3=A4hn?= Date: Thu, 12 Dec 2013 08:19:23 +0100 Subject: [PATCH] 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`). --- beetsplug/mpdstats.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/beetsplug/mpdstats.py b/beetsplug/mpdstats.py index a894c8455..303557c27 100644 --- a/beetsplug/mpdstats.py +++ b/beetsplug/mpdstats.py @@ -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)),