예제 #1
0
파일: mpdhelper.py 프로젝트: goosemo/theory
    def tracks(self,artist,album=None):
        # this is really ugly!

        if album:
            tracks = self.find('artist',artist,'album',album)
            try:
                tracks.sort(self._sorttrackno)
            except (ValueError,KeyError):
                pass
        else:
            tracks = self.find('artist',artist)
            tracks.sort(self._sorttracktitle)

        trackno = 1

        for t in tracks:
            h.format_title(t,trackno)
            trackno += 1

        return tracks
예제 #2
0
    def tracks(self,artist,album=None):
        if not album and not artist:
            return [] # don't want to list entire DB

        args = []
        if artist:
            args.extend(['artist', artist])
        if album:
            args.extend(['album', album])

        tracks = self.find(*tuple(args))
        tracks.sort(key=self._key_track_album_and_number)

        trackno = 1

        for t in tracks:
            if 'album' not in t:
                t['album'] = ''
            h.format_title(t, trackno)
            trackno += 1

        return tracks
예제 #3
0
    def tracks(self,artist,album=None):
        # this is really ugly!

        if album:
            tracks = self.find('artist', artist, 'album', album)
            try:
                tracks.sort(self._sorttrackno)
            except (ValueError, KeyError):
                pass
        else:
            tracks = self.find('artist', artist)
            tracks.sort(self._sorttracktitle)

        trackno = 1

        for t in tracks:
            if 'album' not in t:
                t['album'] = ''
            h.format_title(t, trackno)
            trackno += 1

        return tracks
예제 #4
0
    def tracks(self, artist, album=None):
        if not album and not artist:
            return []  # don't want to list entire DB

        args = []
        if artist:
            args.extend(['artist', artist])
        if album:
            args.extend(['album', album])

        tracks = self.find(*tuple(args))
        tracks.sort(key=self._key_track_album_and_number)

        trackno = 1

        for t in tracks:
            if 'album' not in t:
                t['album'] = ''
            h.format_title(t, trackno)
            trackno += 1

        return tracks