transcoding option for web-video added
[vpproxy.git] / plugins / m3u_plugin.py
index 4104e43240ea63e8d6e81fc5b8332d2834e66850..cc614f2ef130095c4349a12ff902f1dd12903274 100644 (file)
@@ -17,7 +17,7 @@ import os
 
 class M3u(VPProxyPlugin):
 
-    handlers = ('m3u', )
+    handlers = ('m3u', 'm3ut' )
 
     logger = logging.getLogger('plugin_m3u')
     playlist = None
@@ -28,6 +28,13 @@ class M3u(VPProxyPlugin):
 
         self.splitted_path=connection.path.split('/')
         
+        if self.splitted_path[1]=='m3u':
+          prefix='get'
+        elif self.splitted_path[1]=='m3ut':
+          prefix='mp4'  
+        else:
+          connection.dieWithError(404)  
+        
         if len(self.splitted_path)>3:
             connection.dieWithError()
             return
@@ -61,7 +68,7 @@ class M3u(VPProxyPlugin):
         try:
             playlist=parseM3U(m3u_file)
         except:
-            connection.dieWithError()
+            connection.dieWithError(404)
             return    
 
         if not playlist:
@@ -76,7 +83,7 @@ class M3u(VPProxyPlugin):
             channel['url']=record.path.decode('utf-8')            
             playlistgen.addItem(channel)
 
-        exported = playlistgen.exportm3u(hostport)
+        exported = playlistgen.exportm3u(hostport,prefix)
         exported = exported.encode('utf-8')
         connection.wfile.write(exported)