[autoqueue] r288 committed - block performers as well as artists

2 views
Skip to first unread message

codesite...@google.com

unread,
Oct 2, 2009, 4:44:59 PM10/2/09
to auto...@googlegroups.com
Revision: 288
Author: this...@gmail.com
Date: Fri Oct 2 13:43:57 2009
Log: block performers as well as artists
http://code.google.com/p/autoqueue/source/detail?r=288

Modified:
/trunk/autoqueue.py
/trunk/quodlibet_autoqueue.py
/trunk/rhythmbox_autoqueue.py

=======================================
--- /trunk/autoqueue.py Sat Sep 26 08:37:21 2009
+++ /trunk/autoqueue.py Fri Oct 2 13:43:57 2009
@@ -137,6 +137,10 @@
"""return lowercase UNICODE name of artist"""
return NotImplemented

+ def get_artists(self):
+ """return lowercase UNICODE name of artists and performers."""
+ return NotImplemented
+
def get_title(self):
"""return lowercase UNICODE title of song"""
return NotImplemented
@@ -308,8 +312,9 @@
return connection

def disallowed(self, song):
- if song.get_artist() in self.get_blocked_artists():
- return True
+ for artist in song.get_artists():
+ if artist in self.get_blocked_artists():
+ return True
try:
lastplayed = song.get_last_started()
except NotImplemented:
@@ -334,14 +339,15 @@
if song is None:
return
self.now = datetime.now()
- artist_name = song.get_artist()
+ artist_names = song.get_artists()
title = song.get_title()
- if not (artist_name and title):
+ if not (artist_names and title):
return
# add the artist to the blocked list, so their songs won't be
# played for a determined time
- self.block_artist(artist_name)
- self.prune_artists.append(artist_name)
+ for artist_name in artist_names:
+ self.block_artist(artist_name)
+ self.prune_artists.append(artist_name)
if self.running:
return
self.song = song
@@ -512,9 +518,10 @@

def get_blocked_artists(self):
"""prevent artists already in the queue from being queued"""
- return list(self._blocked_artists) + [
- song.get_artist() for song in
- self.player_get_songs_in_queue()]
+ blocked = []
+ for song in self.player_get_songs_in_queue():
+ blocked.extend(song.get_artists())
+ return list(self._blocked_artists) + blocked

def get_last_songs(self):
"""return the last song in the queue or the currently playing
=======================================
--- /trunk/quodlibet_autoqueue.py Wed Sep 16 05:33:17 2009
+++ /trunk/quodlibet_autoqueue.py Fri Oct 2 13:43:57 2009
@@ -81,6 +81,11 @@
"""return lowercase UNICODE name of artist"""
return self.song.comma("artist").lower()

+ def get_artists(self):
+ """return lowercase UNICODE name of artists and performers."""
+ return [artist.lower() for artist in self.song.list("artist") +
+ self.song.list("performer")]
+
def get_title(self):
"""return lowercase UNICODE title of song"""
version = self.song.comma("version").lower()
=======================================
--- /trunk/rhythmbox_autoqueue.py Wed Sep 16 05:33:17 2009
+++ /trunk/rhythmbox_autoqueue.py Fri Oct 2 13:43:57 2009
@@ -53,6 +53,9 @@
return urllib.unquote(location[7:])
return None

+ def get_last_started(self):
+ return self.db.entry_get(self.song, rhythmdb.PROP_LAST_PLAYED)
+

class AutoQueuePlugin(rb.Plugin, AutoQueueBase):
def __init__(self):
@@ -63,6 +66,7 @@
self.gconfclient = gconf.client_get_default()
self.verbose = False
self.by_mirage = False
+ self.log("initialized")

def activate(self, shell):
self.shell = shell

Reply all
Reply to author
Forward
0 new messages