示例#1
0
    def search(self,
               query,
               sort_fields=[],
               return_lim=-1,
               tracks=None,
               reverse=False):
        """
            DEPRECATED, DO NOT USE IN NEW CODE
        """
        import warnings
        warnings.warn("TrackDB.search is deprecated.", DeprecationWarning)
        tracks = [
            x.track for x in search_tracks_from_string(
                self,
                query,
                case_sensitive=False,
                keyword_tags=['artist', 'albumartist', 'album', 'title'])
        ]

        if sort_fields:
            tracks = sort_tracks(sort_fields, tracks, reverse)
        if return_lim > 0:
            tracks = tracks[:return_lim]

        return tracks
示例#2
0
def get_top_artists(field, limit):
    artists = [
        x.artist for x in search.search_tracks_from_string(
            ex.exaile().collection, '! %s==__null__' % field)
    ]
    artists = util.sort_tracks([field], artists, True)
    return artists[:limit]
示例#3
0
def get_top_albums(field, limit):
    albums = [
        x.track for x in search.search_tracks_from_string(
            ex.exaile().collection, '! %s==__null__' % field)
    ]
    albums = util.sort_tracks([field], albums, True)
    return albums[:limit]
示例#4
0
    def search(self, query, sort_fields=[], return_lim=-1,
            tracks=None, reverse=False):
        """
            DEPRECATED, DO NOT USE IN NEW CODE
        """
        import warnings
        warnings.warn("TrackDB.search is deprecated.", DeprecationWarning)
        tracks = [ x.track for x in search_tracks_from_string(self, query,
                case_sensitive=False, keyword_tags=['artist', 'albumartist',
                'album', 'title']) ]

        if sort_fields:
            tracks = sort_tracks(sort_fields, tracks, reverse)
        if return_lim > 0:
            tracks = tracks[:return_lim]

        return tracks
示例#5
0
def get_top_artists(field, limit):
    artists = [x.artist for x in search.search_tracks_from_string(
                ex.exaile().collection, '! %s==__null__' % field)]
    artists = util.sort_tracks([field], artists, True)
    return artists[:limit]
示例#6
0
def get_top_albums(field, limit):
    albums = [x.track for x in search.search_tracks_from_string(
                ex.exaile().collection, '! %s==__null__' % field)]
    albums = util.sort_tracks([field], albums, True)
    return albums[:limit]