summaryrefslogtreecommitdiff
path: root/src/libwebvi
diff options
context:
space:
mode:
authorAntti Ajanki <antti.ajanki@iki.fi>2011-07-07 18:49:00 +0300
committerAntti Ajanki <antti.ajanki@iki.fi>2011-07-07 19:05:02 +0300
commitd9c351d21c08cecceee47f8d4d13f8c5fec57922 (patch)
treeb32f78e026f0f0c53fa734393d4773d404219e25 /src/libwebvi
parentbd88072b5df85c392917e4bce11a40c0058c4657 (diff)
downloadvdr-plugin-webvideo-d9c351d21c08cecceee47f8d4d13f8c5fec57922.tar.gz
vdr-plugin-webvideo-d9c351d21c08cecceee47f8d4d13f8c5fec57922.tar.bz2
Streaming support for external downloaders
Diffstat (limited to 'src/libwebvi')
-rw-r--r--src/libwebvi/webvi/request.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/libwebvi/webvi/request.py b/src/libwebvi/webvi/request.py
index cab15f7..313a82e 100644
--- a/src/libwebvi/webvi/request.py
+++ b/src/libwebvi/webvi/request.py
@@ -22,6 +22,7 @@ import cStringIO
import re
import download
import sys
+import tempfile
import utils
import json2xml
import asyncurl
@@ -312,10 +313,33 @@ class Request:
self.setup_downloader(url, None, None,
self.finished_check_url,
self.processing['HTTP-headers'], True)
+ elif url.startswith('wvt://'):
+ if not url.startswith('wvt:///bin/'):
+ self.request_done(406,'Streaming not supported')
+
+ fifo = self.create_fifo()
+ fifourl = url + '&arg=' + fifo
+
+ # Unlink fifo when downloader has finished. Note: If the
+ # reader doesn't read the fifo for some reason, the writer
+ # process will deadlock and the fifo is never unlinked.
+ self.setup_downloader(fifourl, None, None,
+ lambda x, y: os.unlink(fifo))
+ self.writewrapper('file://' + fifo)
+ self.request_done(0, None)
else:
self.writewrapper(url)
self.request_done(0, None)
+ def create_fifo(self):
+ while True:
+ fifoname = tempfile.mktemp()
+ try:
+ os.mkfifo(fifoname, 0600)
+ return fifoname
+ except IOError:
+ pass
+
def send_mainmenu(self):
"""Build the XML main menu from the module description files
in the hard drive.