]> git.parisson.com Git - deefuzzer.git/commitdiff
Fix no metadata for stream-m relaying
authorGuillaume Pellerin <yomguy@parisson.com>
Thu, 12 Feb 2015 23:54:48 +0000 (00:54 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Thu, 12 Feb 2015 23:54:48 +0000 (00:54 +0100)
Fix relay fallback when source not ready

deefuzzer/relay.py
deefuzzer/station.py

index 4adbd632131c3176b52f1e6a572bb7653941845b..b3d7c9a6da9ca1b921fdcf781918e23e1a28e443 100644 (file)
@@ -48,6 +48,7 @@ class Relay(Thread):
         self.sub_buffer_size = sub_buffer_size
         self.queue_size = queue_size
         self.queue = Queue.Queue(self.queue_size)
+        self.stream = None
 
     def set_url(self, url):
         self.url = url
@@ -70,6 +71,8 @@ class Relay(Thread):
                 self.queue.put_nowait(self.chunk)
 #                print self.queue.qsize()
             else:
-                self.stream.close()
-                break
+                if self.stream:
+                    self.stream.close()
+                else:
+                    self.open()
 
index af4cb02c6fd1181425efed07922bd78eb9229f84..82cab2d3929aefb6ff4dbbe6c28a22c08f8322ad 100644 (file)
@@ -342,7 +342,7 @@ class Station(Thread):
         self.twitter_mode = value
         message = "received OSC message '%s' with arguments '%d'" % (path, value)
 
-        # IMPROVEMENT: The URL paths should be configurable because they're 
+        # IMPROVEMENT: The URL paths should be configurable because they're
         # server-implementation specific
         self.m3u_url = self.channel.url + '/m3u/' + self.m3u.split(os.sep)[-1]
         self.feeds_url = self.channel.url + '/rss/' + self.feeds_playlist_file.split(os.sep)[-1]
@@ -658,7 +658,9 @@ class Station(Thread):
 
     def set_relay_mode(self):
         self.prefix = '#nowplaying #LIVE'
-        self.get_currentsongmeta()
+        self.title = ""
+        self.artist = ""
+        self.song = ""
 
         if self.type == 'stream-m':
             relay = URLReader(self.relay_url)
@@ -699,7 +701,7 @@ class Station(Thread):
 
     def set_read_mode(self):
         self.prefix = '#nowplaying'
-        
+
         try:
             self.get_currentsongmeta()
             fn = self.current_media_obj.file_name
@@ -808,6 +810,7 @@ class Station(Thread):
     def icecastloop_metadata(self):
         try:
             self.update_twitter_current()
+            if self.song:
             self.channel.set_metadata({'song': self.song, 'charset': 'utf-8'})
             return True
         except Exception, e: