Add 'Last-Modified' field to _stored_playlists_listplaylists response
This commit is contained in:
parent
6dfb658e6b
commit
434fbb8853
@ -10,6 +10,7 @@ implement our own MPD server which is compatible with the numerous existing
|
||||
`MPD clients <http://mpd.wikia.com/wiki/Clients>`_.
|
||||
"""
|
||||
|
||||
import datetime as dt
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
@ -1264,9 +1265,13 @@ class MpdHandler(object):
|
||||
playlist: b
|
||||
Last-Modified: 2010-02-06T02:11:08Z
|
||||
"""
|
||||
# TODO Add Last-Modified attribute to output
|
||||
return [u'playlist: %s' % p.name
|
||||
for p in self.backend.stored_playlists.playlists]
|
||||
result = []
|
||||
for playlist in self.backend.stored_playlists.playlists:
|
||||
result.append((u'playlist', playlist.name))
|
||||
# TODO Remove microseconds and add time zone information
|
||||
result.append((u'Last-Modified',
|
||||
(playlist.last_modified or dt.datetime.now()).isoformat()))
|
||||
return result
|
||||
|
||||
@handle_pattern(r'^load "(?P<name>[^"]+)"$')
|
||||
def _stored_playlists_load(self, name):
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import datetime as dt
|
||||
import unittest
|
||||
|
||||
from mopidy.backends.dummy import DummyBackend
|
||||
@ -702,7 +703,12 @@ class StoredPlaylistsHandlerTest(unittest.TestCase):
|
||||
self.assert_(u'ACK Name "name" not found' in result)
|
||||
|
||||
def test_listplaylists(self):
|
||||
last_modified = dt.datetime(2001, 3, 17, 13, 41, 17)
|
||||
self.b.stored_playlists.playlists = [Playlist(name='a',
|
||||
last_modified=last_modified)]
|
||||
result = self.h.handle_request(u'listplaylists')
|
||||
self.assert_(u'playlist: a' in result)
|
||||
self.assert_(u'Last-Modified: 2001-03-17T13:41:17' in result)
|
||||
self.assert_(u'OK' in result)
|
||||
|
||||
def test_load(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user