@@ -0,0 +1,2862 @@
+from copy import copy%0A%0Aclass Artist(object):%0A    def __init__(self, uri=None, name=None):%0A        self._uri = None%0A        self._name = name%0A%0A    @property%0A    def uri(self):%0A        return self._uri%0A%0A    @property%0A    def name(self):%0A        return self._name%0A%0A%0Aclass Album(object):%0A    def __init__(self, uri=None, name=None, artists=None, num_tracks=0):%0A        self._uri = uri%0A        self._name = name%0A        self._artists = artists or %5B%5D%0A        self._num_tracks = num_tracks%0A%0A    @property%0A    def uri(self):%0A        return self._uri%0A%0A    @property%0A    def name(self):%0A        return self._name%0A%0A    @property%0A    def artists(self):%0A        return copy(self._artists)%0A%0A    @property%0A    def num_tracks(self):%0A        return self._num_tracks%0A%0A%0Aclass Track(object):%0A    def __init__(self, uri=None, title=None, artists=None, album=None,%0A            track_no=0, date=None, length=None, id=None):%0A        self._uri = uri%0A        self._title = title%0A        self._artists = artists or %5B%5D%0A        self._album = album%0A        self._track_no = track_no%0A        self._date = date%0A        self._length = length%0A        self._id = id%0A%0A    @property%0A    def uri(self):%0A        return self._uri%0A%0A    @property%0A    def title(self):%0A        return self._title%0A%0A    @property%0A    def artists(self):%0A        return copy(self._artists)%0A%0A    @property%0A    def album(self):%0A        return self._album%0A%0A    @property%0A    def track_no(self):%0A        return self._track_no%0A%0A    @property%0A    def date(self):%0A        return self._date%0A%0A    @property%0A    def length(self):%0A        return self._length%0A%0A    @property%0A    def id(self):%0A        return self._id%0A%0A    def mpd_format(self, position=0):%0A        return %5B%0A            ('file', self.uri),%0A            ('Time', self.length // 1000),%0A            ('Artist', self.mpd_format_artists()),%0A            ('Title', self.title),%0A            ('Album', self.album.name),%0A            ('Track', '%25d/%25d' %25 (self.track_no, self.album.num_tracks)),%0A            ('Date', self.date),%0A            ('Pos', position),%0A            ('Id', self.id),%0A        %5D%0A%0A    def mpd_format_artists(self):%0A        return u', '.join(%5Ba.name for a in self.artists%5D)%0A%0A%0Aclass Playlist(object):%0A    def __init__(self, uri=None, name=None, tracks=None):%0A        self._uri = uri%0A        self._name = name%0A        self._tracks = tracks or %5B%5D%0A%0A    @property%0A    def uri(self):%0A        return self._uri%0A%0A    @property%0A    def name(self):%0A        return self._name%0A%0A    @property%0A    def tracks(self):%0A        return copy(self._tracks)%0A%0A    @property%0A    def length(self):%0A        return len(self._tracks)%0A%0A    def mpd_format(self, start=0, end=None):%0A        if end is None:%0A            end = self.length%0A        tracks = %5B%5D%0A        for track, position in zip(self.tracks, range(start, end)):%0A            tracks.append(track.mpd_format(position))%0A        return tracks%0A

Add backend-independent models