]> git.parisson.com Git - deefuzzer.git/commitdiff
Added new station.feeds.showfilename option that includes the media file name in...
authorachbed <github@achbed.org>
Sat, 22 Nov 2014 04:57:24 +0000 (22:57 -0600)
committerachbed <github@achbed.org>
Sat, 22 Nov 2014 04:57:24 +0000 (22:57 -0600)
Added new station.feeds.showfilepath option that includes the server path to the media file in the feed

Signed-off-by: achbed <github@achbed.org>
deefuzzer/station.py
example/deefuzzer_doc.xml

index ef4de21b1b43376a73209abf4a3c8e0041044b56..9063185e630635e81526c6736ee19d716979c9b0 100644 (file)
@@ -78,6 +78,8 @@ class Station(Thread):
     feeds_rss = 1
     feeds_mode = 1
     feeds_playlist = 1
+    feeds_showfilepath = 0
+    feeds_showfilename = 0
 
     def __init__(self, station, q, logger, m3u):
         Thread.__init__(self)
@@ -168,6 +170,10 @@ class Station(Thread):
                 self.feeds_rss = int(self.station['rss']['rss'])
             if 'playlist' in self.station['rss']:
                 self.feeds_playlist = int(self.station['rss']['playlist'])
+            if 'showfilename' in self.station['rss']:
+                self.feeds_showfilename = int(self.station['rss']['showfilename'])
+            if 'showfilepath' in self.station['rss']:
+                self.feeds_showfilepath = int(self.station['rss']['showfilepath'])
 
             self.feeds_media_url = self.channel.url + '/media/'
             if 'media_url' in self.station['rss']:
@@ -464,19 +470,24 @@ class Station(Thread):
             file_name, file_title, file_ext = get_file_info(media)
             if file_ext.lower() == 'mp3' or mimetypes.guess_type(media)[0] == 'audio/mpeg':
                 try:
-                    media_objs.append(Mp3(media))
+                    file_meta = Mp3(media)
                 except:
                     continue
             elif file_ext.lower() == 'ogg' or mimetypes.guess_type(media)[0] == 'audio/ogg':
                 try:
-                    media_objs.append(Ogg(media))
+                    file_meta = Ogg(media)
                 except:
                     continue
             elif file_ext.lower() == 'webm' or mimetypes.guess_type(media)[0] == 'video/webm':
                 try:
-                    media_objs.append(WebM(media))
+                    file_meta = WebM(media)
                 except:
                     continue
+            if self.feeds_showfilename:
+                file_meta.metadata['filename'] = file_name.decode( "utf-8" )   #decode needed for some weird filenames
+            if self.feeds_showfilepath:
+                file_meta.metadata['filepath'] = media.decode( "utf-8" )   #decode needed for some weird filenames
+            media_objs.append(file_meta)
         return media_objs
 
     def update_feeds(self, media_list, rss_file, sub_title):
@@ -503,6 +514,7 @@ class Station(Thread):
 
             media_description = '<table>'
             media_description_item = '<tr><td>%s:   </td><td><b>%s</b></td></tr>'
+            
             for key in media.metadata.keys():
                 if media.metadata[key] != '':
                     media_description += media_description_item % (key.capitalize(),
index fd848dd2a2e05e1cd6b04c38608451fece628372..138a6a99c2d7ec5ffbe9e4f86a58ca531200fe95 100644 (file)
             <!-- the base URL of all media items.
                  Default is station url /media -->
             <media_url>http://localhost/media/</media_url>
+            <!-- Include the full name of the file in the feed -->
+            <showfilename>1</showfilename>
+            <!-- Include the full server path of the file in the feed -->
+            <showfilepath>0</showfilepath>
         </feeds>
         <server>
             <!-- The host to send the stream (domain or IP) -->