]> git.parisson.com Git - deefuzzer.git/commitdiff
fix twitting new track
authorGuillaume Pellerin <yomguy@parisson.com>
Sun, 17 Jan 2010 01:09:10 +0000 (01:09 +0000)
committerGuillaume Pellerin <yomguy@parisson.com>
Sun, 17 Jan 2010 01:09:10 +0000 (01:09 +0000)
tools/station.py

index d76794625d6c5473427dafbd8ed9310b661cd95f..733a2154f9b64243dae7081ad6536da21562da9b 100644 (file)
@@ -251,7 +251,9 @@ class Station(Thread):
                         song = song.encode('utf-8')
                         artist = artist.encode('utf-8')
                         if self.twitter_mode == 1:
-                            message = 'New track ! %s #%s #%s' % (song.replace('_', ' '), artist.replace(' ', ''), self.short_name)
+                            artist_names = artist.split(' ')
+                            artist_tags = ' #'.join(list(set(artist_names)-set(['&', '-'])))
+                            message = 'New track ! %s %s on #%s' % (song.replace('_', ' '), artist_tags, self.short_name)
                             self.update_twitter(message)
 
                 if self.mode_shuffle == 1:
@@ -348,10 +350,11 @@ class Station(Thread):
         rss.write_xml(f, 'utf-8')
         f.close()
 
-    def update_twitter(self):
-        artist_names = self.artist.split(' ')
-        artist_tags = ' #'.join(list(set(artist_names)-set(['&', '-'])))
-        message = '♫ %s %s on #%s #%s' % (self.prefix, self.song, self.short_name, artist_tags)
+    def update_twitter(self, message=None):
+        if not message:
+            artist_names = self.artist.split(' ')
+            artist_tags = ' #'.join(list(set(artist_names)-set(['&', '-'])))
+            message = '♫ %s %s on #%s #%s' % (self.prefix, self.song, self.short_name, artist_tags)
         tags = '#' + ' #'.join(self.twitter_tags)
         message = message + ' ' + tags
         message = message[:113] + ' ' + self.tinyurl