def test_mpd_format(self): playlist = Playlist(tracks=[ Track(uri="foo", track_no=1), Track(uri="bàr", track_no=2), Track(uri="baz", track_no=3), ]) result = translator.playlist_to_mpd_format(playlist, tagtype_list.TAGTYPE_LIST) assert len(result) == 3
def test_mpd_format_with_range(self): playlist = Playlist(tracks=[ Track(uri="foo", track_no=1), Track(uri="bàr", track_no=2), Track(uri="baz", track_no=3), ]) result = translator.playlist_to_mpd_format(playlist, tagtype_list.TAGTYPE_LIST, 1, 2) assert len(result) == 1 assert dict(result[0])["Track"] == 2
def listplaylistinfo(context, name): """ *musicpd.org, stored playlists section:* ``listplaylistinfo {NAME}`` Lists songs in the playlist ``NAME.m3u``. Output format: Standard track listing, with fields: file, Time, Title, Date, Album, Artist, Track """ playlist = _get_playlist(context, name) track_uris = [track.uri for track in playlist.tracks] tracks_map = context.core.library.lookup(uris=track_uris).get() tracks = [] for uri in track_uris: tracks.extend(tracks_map[uri]) playlist = playlist.replace(tracks=tracks) return translator.playlist_to_mpd_format(playlist)