From 3a61445519473a00904feaed9af10f1e8bdca508 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Sat, 14 Mar 2015 00:05:10 +0100 Subject: [PATCH] models: Change Track.last_modified from seconds to ms --- docs/changelog.rst | 6 ++++++ mopidy/models.py | 7 ++++--- mopidy/utils/path.py | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index f06f291d..6c111ff2 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -13,6 +13,12 @@ v0.20.0 (UNRELEASED) - Add :class:`mopidy.models.Image` model to be returned by :meth:`mopidy.core.LibraryController.get_images`. (Part of :issue:`973`) +- Change the semantics of :attr:`mopidy.models.Track.last_modified` to be + milliseconds instead of seconds since Unix epoch, or a simple counter, + depending on the source of the track. This makes it match the semantics of + :attr:`mopidy.models.Playlist.last_modified`. (Fixes: :issue:`678`, PR: + :issue:`1036`) + **Core API** - Deprecate all properties in the core API. The previously undocumented getter diff --git a/mopidy/models.py b/mopidy/models.py index 4d6ed27d..c0931855 100644 --- a/mopidy/models.py +++ b/mopidy/models.py @@ -378,9 +378,10 @@ class Track(ImmutableObject): #: The MusicBrainz ID of the track. Read-only. musicbrainz_id = None - #: Integer representing when the track was last modified, exact meaning - #: depends on source of track. For local files this is the mtime, for other - #: backends it could be a timestamp or simply a version counter. + #: Integer representing when the track was last modified. Exact meaning + #: depends on source of track. For local files this is the modification + #: time in milliseconds since Unix epoch. For other backends it could be an + #: equivalent timestamp or simply a version counter. last_modified = None def __init__(self, *args, **kwargs): diff --git a/mopidy/utils/path.py b/mopidy/utils/path.py index c72d3b18..0c0d6676 100644 --- a/mopidy/utils/path.py +++ b/mopidy/utils/path.py @@ -200,7 +200,7 @@ def _find(root, thread_count=10, relative=False, follow=False): def find_mtimes(root, follow=False): results, errors = _find(root, relative=False, follow=follow) - mtimes = dict((f, int(st.st_mtime)) for f, st in results.items()) + mtimes = dict((f, int(st.st_mtime * 1000)) for f, st in results.items()) return mtimes, errors