Author: duncan
Date: Mon Jan  8 20:57:22 2007
New Revision: 8952

Modified:
   branches/rel-1/freevo/src/audio/plugins/mplayer.py

Log:
[ 1629355 ] Add webradio streaming info
Patch from Gorka Olaizola applied


Modified: branches/rel-1/freevo/src/audio/plugins/mplayer.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/mplayer.py  (original)
+++ branches/rel-1/freevo/src/audio/plugins/mplayer.py  Mon Jan  8 20:57:22 2007
@@ -230,6 +230,21 @@
         self.RE_TIME     = re.compile("^A: *([0-9]+)").match
         self.RE_TIME_NEW = re.compile("^A: *([0-9]+):([0-9]+)").match
 
+        # [0] -> start of line to check with mplayer output
+        # [1] -> keyword to store info in self.item.info
+        self.STREAM_KEYWORDS = [
+            ( "Genre  : ", "genre" ),
+            ( "Artist : ", "artist" ),
+            ( "Name   : ", "stream_name" ),
+            ( " Genre: ", "genre" ),
+            ( " Artist: ", "artist" ),
+            ( " Name: ", "stream_name" ),
+            ( "Demuxer info Name changed to ", "stream_name" ),
+            ( "Demuxer info Genre changed to ", "genre" ),
+            ( "Demuxer info Artist changed to ", "artist" )
+        ]
+
+
         # check for mplayer plugins
         self.stdout_plugins  = []
         self.elapsed_plugins = []
@@ -293,11 +308,18 @@
                 if titleEnd > titleStart:
                     self.item.info['artist'] = line[titleStart:titleEnd]
 
-
+        else:
+            for keywords in self.STREAM_KEYWORDS:
+                if line.startswith(keywords[0]):
+                    _debug_("stream keyword found: %s %s" % (keywords[0], 
keywords[1] ))
+                    titleStart = len(keywords[0])
+                    self.item.info[ keywords[1] ] = line[titleStart:]
+                    break
 
     def stderr_cb(self, line):
         if line.startswith('Failed to open') and \
                (not self.item or not self.item.elapsed):
             self.stop_reason = line
+
         for p in self.stdout_plugins:
             p.stdout(line)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to