MPD: More correct date format in listplaylists output
This commit is contained in:
parent
2f9775250a
commit
bcc133a079
@ -1506,9 +1506,14 @@ class MpdFrontend(object):
|
||||
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()))
|
||||
last_modified = (playlist.last_modified or
|
||||
dt.datetime.now()).isoformat()
|
||||
# Remove microseconds
|
||||
last_modified = last_modified.split('.')[0]
|
||||
# Add time zone information
|
||||
# TODO Convert to UTC before adding Z
|
||||
last_modified = last_modified + 'Z'
|
||||
result.append((u'Last-Modified', last_modified))
|
||||
return result
|
||||
|
||||
@handle_pattern(r'^load "(?P<name>[^"]+)"$')
|
||||
|
||||
@ -894,12 +894,13 @@ class StoredPlaylistsHandlerTest(unittest.TestCase):
|
||||
u'ACK [50@0] {listplaylistinfo} No such playlist')
|
||||
|
||||
def test_listplaylists(self):
|
||||
last_modified = dt.datetime(2001, 3, 17, 13, 41, 17)
|
||||
last_modified = dt.datetime(2001, 3, 17, 13, 41, 17, 12345)
|
||||
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)
|
||||
# Date without microseconds and with time zone information
|
||||
self.assert_(u'Last-Modified: 2001-03-17T13:41:17Z' in result)
|
||||
self.assert_(u'OK' in result)
|
||||
|
||||
def test_load(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user