models: Change Track.last_modified from seconds to ms

This commit is contained in:
Stein Magnus Jodal 2015-03-14 00:05:10 +01:00
parent 980e04537b
commit 3a61445519
3 changed files with 11 additions and 4 deletions

View File

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

View File

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

View File

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