Remove mtime and key from track_to_mpd_format
This commit is contained in:
parent
137d8976dc
commit
4ac1d8d217
@ -6,7 +6,7 @@ from mopidy.utils.path import mtime as get_mtime
|
||||
from mopidy.frontends.mpd import protocol
|
||||
from mopidy.utils.path import path_to_uri, uri_to_path, split_path
|
||||
|
||||
def track_to_mpd_format(track, position=None, cpid=None, key=False, mtime=False):
|
||||
def track_to_mpd_format(track, position=None, cpid=None):
|
||||
"""
|
||||
Format track for output to MPD client.
|
||||
|
||||
@ -41,10 +41,6 @@ def track_to_mpd_format(track, position=None, cpid=None, key=False, mtime=False)
|
||||
if position is not None and cpid is not None:
|
||||
result.append(('Pos', position))
|
||||
result.append(('Id', cpid))
|
||||
if key and track.uri:
|
||||
result.insert(0, ('key', os.path.basename(uri_to_path(track.uri))))
|
||||
if mtime and track.uri:
|
||||
result.append(('mtime', get_mtime(uri_to_path(track.uri))))
|
||||
return result
|
||||
|
||||
MPD_KEY_ORDER = '''
|
||||
|
||||
@ -42,21 +42,6 @@ class TrackMpdFormatTest(unittest.TestCase):
|
||||
self.assert_(('Pos', 1) in result)
|
||||
self.assert_(('Id', 2) in result)
|
||||
|
||||
def test_track_to_mpd_format_with_key(self):
|
||||
track = Track(uri='file:///dir/subdir/file.mp3')
|
||||
result = translator.track_to_mpd_format(track, key=True)
|
||||
self.assert_(('key', 'file.mp3') in result)
|
||||
|
||||
def test_track_to_mpd_format_with_key_not_uri_encoded(self):
|
||||
track = Track(uri='file:///dir/subdir/file%20test.mp3')
|
||||
result = translator.track_to_mpd_format(track, key=True)
|
||||
self.assert_(('key', 'file test.mp3') in result)
|
||||
|
||||
def test_track_to_mpd_format_with_mtime(self):
|
||||
uri = translator.path_to_uri(data_folder('blank.mp3'))
|
||||
result = translator.track_to_mpd_format(Track(uri=uri), mtime=True)
|
||||
self.assert_(('mtime', 1234567) in result)
|
||||
|
||||
def test_track_to_mpd_format_for_nonempty_track(self):
|
||||
track = Track(
|
||||
uri=u'a uri',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user