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 __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))
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))
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)
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)
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":