def __init__(self, artist, album):
        self.artist = artist
        self.album = album

        self.match = xc.Intersection(
            xc.Match(field="artist", value=self.artist),
            xc.Match(field="album", value=self.album))
예제 #2
0
def list_titles(request, artist="Alle", album="Alle"):
    """Alle Titel eines Künstlers und oder eines Albums auflisten

       @param artist Name des Künstlers
       @param album Albumtitel
    """
    client = settings.XMMS2_CLIENT

    artist = smart_str(unquote_plus(artist))  # Vermeiden von UnicodeError
    album = smart_str(unquote_plus(album))

    if artist != "Alle":
        artist_coll = collections.Match(field="artist", value=artist)
    else:
        artist_coll = collections.Universe()

    if album != "Alle":
        album_coll = collections.Intersection(
            artist_coll, collections.Match(field="album", value=album))
    else:
        album_coll = collections.Intersection(artist_coll,
                                              collections.Universe())

    template = loader.get_template('concept/titlelist.html')
    context = RequestContext(
        request, {
            'selected_artist': artist,
            'albums': client.coll_query(['album'], artist_coll),
            'selected_album': album,
            'titles': client.coll_query(['id', 'title'], album_coll),
        })

    return HttpResponse(template.render(context))
    def write(self):
        indexKeys = map(chr, range(65, 91))
        for key in indexKeys:
            artist = xc.Match(field="artist", value=str(key) + "*")
            results = xmms.coll_query_infos(artist, ["artist"])

            groupLabel = "{0} ({1})".format(str(key), str(len(results)))
            PipeMenu(groupLabel, ["alphabetIndexArtists", str(key)]).write()
예제 #4
0
def common(request, client=settings.XMMS2_CLIENT, artist='Alle', album='Alle'):
    """Rendert die Index-Seite
    
    @deprecated wird nur noch von der Funktion index benötigt und kann daher in diese integriert werden
    """
    if artist != "Alle":
        artist_coll = collections.Match(field="artist", value=artist)
    else:
        artist_coll = collections.Universe()

    if album != "Alle":
        album_coll = collections.Intersection(
            artist_coll, collections.Match(field="album", value=album))
    else:
        album_coll = collections.Intersection(artist_coll,
                                              collections.Universe())

    playlist = client.list()
    playtime = 0
    for entry in playlist:
        try:
            playtime += entry.get('duration')
        except TypeError:
            pass

    template = loader.get_template('concept/index.html')
    context = RequestContext(
        request, {
            'playlist_list': client.playlist_list(),
            'active_playlist': client.playlist_active(),
            'playlist': playlist,
            'playtime': playtime,
            'current': client.current(),
            'artists': client.coll_query(['artist']),
            'selected_artist': artist,
            'albums': client.coll_query(['album'], artist_coll),
            'titles': client.coll_query(['id', 'title'], album_coll),
        })

    return HttpResponse(template.render(context))
예제 #5
0
파일: models.py 프로젝트: x-0-r/XMMS2-DJ
 def get(cls, **kwargs):
     """Search for a song in the media library
     """
     c = None
     for x in kwargs:
         if c:
             c = coll.Intersection(
                 c,
                 coll.Match(
                     field=x, value=force_unicode(kwargs[x])
                 )  # xmmsclient expects both args to be str or unicode
             )
         else:
             c = coll.Match(field=x, value=force_unicode(kwargs[x]))
     result = cls.client.coll_query(['id', 'artist', 'title'], c)
     num = len(result)
     if num == 1:
         return cls.get_from_dict(result[0])
     if not num:
         raise DoesNotExist("Song matching query does not exist.")
     raise MultipleObjectsReturned(
         "get() returned more than one Items! Lookup parameters were %s" %
         kwargs)
예제 #6
0
def search_title(request):
    """Nach Titel suchen
    """
    client = settings.XMMS2_CLIENT

    title = request.POST.get('title')
    title = "*%s*" % title
    title_coll = collections.Match(field="title", value=title)

    template = loader.get_template("dj/titlelist.html")
    context = Context({
        'titles': client.coll_query(['title', 'id'], title_coll),
    })
    return HttpResponse(template.render(context))
예제 #7
0
def search_artist(request):
    """Nach Künstler suchen
    """
    client = settings.XMMS2_CLIENT

    artist = request.POST.get('artist')
    artist = "*%s*" % artist
    artist_coll = collections.Match(field="artist", value=artist)

    template = loader.get_template("dj/artistlist.html")
    context = Context({
        'artists': client.coll_query(['artist'], artist_coll),
    })
    return HttpResponse(template.render(context))
예제 #8
0
def album_add(request, artist, album):
    """Alle Titel eines Albums zur Playlist hinzufügen

       @param artist Name des Künstlers
       @param album Albumname

       @remarks
         Name sollte evtl. nach "add_album" geändert werden
    """
    client = settings.XMMS2_CLIENT

    artist = unquote_plus(artist)
    album = unquote_plus(album)

    if artist != "Alle":
        artist_coll = collections.Match(field="artist", value=artist)
    else:
        artist_coll = collections.Universe()

    album_coll = collections.Intersection(
        artist_coll, collections.Match(field="album", value=album))
    client.playlist_add_collection(album_coll)

    return get_playlist(request)
예제 #9
0
def artist_add(request, artist):
    """Alle Titel eines Künstlers zur Playlist hinzufügen
       
       @param artist Name des Künstlers (bzw. der Band)

       @remarks
         Evtl sollte Namensgebung nach "add_artist" geändert werden
    """
    client = settings.XMMS2_CLIENT

    artist = unquote_plus(artist)
    artist_coll = collections.Match(field="artist", value=artist)
    client.playlist_add_collection(artist_coll)

    return get_playlist(request)
예제 #10
0
def search_album(request):
    """Nach Album suchen
    """
    client = settings.XMMS2_CLIENT

    artist = request.POST.get('artist')
    album = request.POST.get('album')
    album = "*%s*" % album
    album_coll = collections.Match(field="album", value=album)

    template = loader.get_template("dj/albumlist.html")
    context = Context({
        'selected_artist': artist,
        'albums': client.coll_query(['album'], album_coll),
    })
    return HttpResponse(template.render(context))
예제 #11
0
def list_albums(request, artist="Alle"):
    """Alle Albem eines Künstlers auflisten
       
       @param artist Name des Künstlers/der Band
    """
    client = settings.XMMS2_CLIENT

    artist = unquote_plus(artist)
    artist = smart_str(artist)  # vermeidet UnicodeError bei xmms2-Funktionen

    if artist != "Alle":
        artist_coll = collections.Match(field="artist", value=artist)
    else:
        artist_coll = collections.Universe()

    template = loader.get_template('concept/albumlist.html')
    context = RequestContext(
        request, {
            'selected_artist': artist,
            'albums': client.coll_query(['album'], artist_coll),
        })

    return HttpResponse(template.render(context))
 def __init__(self, artist):
     self.artist = artist
     self.artistMatch = xc.Match(field="artist", value=artist)
 def __init__(self, artist):
     self.artistMatch = xc.Match(field="artist", value=str(artist) + "*")
            trackId = int(sys.argv[3])

            if trackCommand == "add":
                xmms.playlist_insert_id(0, trackId)

            if trackCommand == "info":
                Container(TrackInfo(trackId)).write()

        if command == "album":
            albumCommand = str(sys.argv[2])
            artistName = str(sys.argv[3])
            albumName = str(sys.argv[4])

            if albumCommand == "add":
                match = xc.Intersection(
                    xc.Match(field="artist", value=artistName),
                    xc.Match(field="album", value=albumName))

                trackIds = xmms.coll_query_infos(match, ["id"])
                for trackId in trackIds:
                    xmms.playlist_add_id(trackId["id"])

        if command == "playlist-entry":
            subCommand = str(sys.argv[2])
            entryIndex = int(sys.argv[3])

            if subCommand == "move":
                newIndex = int(sys.argv[4])
                xmms.playlist_move(entryIndex, newIndex)

            if subCommand == "remove":