def tracks_to_mpd_format(tracks, start=0, end=None):
 if (end is None):
  end = len(tracks)
 tracks = tracks[start:end]
 positions = range(start, end)
 assert (len(tracks) == len(positions))
 result = []
 for (track, position) in zip(tracks, positions):
  formatted_track = track_to_mpd_format(track, position)
  if formatted_track:
   result.append(formatted_track)
 return result

def tracks_to_mpd_format ( tracks , start = 0 , end = None ) : if ( end is None ) : end = len ( tracks ) tracks = tracks [ start : end ] positions = range ( start , end ) assert ( len ( tracks ) == len ( positions ) ) result = [ ] for ( track , position ) in zip ( tracks , positions ) : formatted_track = track_to_mpd_format ( track , position ) if formatted_track : result . append ( formatted_track ) return result
format list of tracks for output to mpd client .