|
a/src/mediaserver/cdplugins/uprcl/uprclhttp.py |
|
b/src/mediaserver/cdplugins/uprcl/uprclhttp.py |
|
... |
|
... |
18 |
from __future__ import print_function
|
18 |
from __future__ import print_function
|
19 |
|
19 |
|
20 |
import os
|
20 |
import os
|
21 |
import time
|
21 |
import time
|
22 |
import bottle
|
22 |
import bottle
|
|
|
23 |
import mutagen
|
23 |
|
24 |
|
24 |
from upmplgutils import uplog
|
25 |
from upmplgutils import uplog
|
25 |
from uprclutils import embedded_open
|
26 |
from uprclutils import embedded_open
|
26 |
import uprclinit
|
27 |
import uprclinit
|
27 |
|
28 |
|
|
... |
|
... |
74 |
lm = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(fs.st_mtime))
|
75 |
lm = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(fs.st_mtime))
|
75 |
bottle.response.set_header("Last-Modified", lm)
|
76 |
bottle.response.set_header("Last-Modified", lm)
|
76 |
bottle.response.set_header("Content-type", ctype)
|
77 |
bottle.response.set_header("Content-type", ctype)
|
77 |
bottle.response.set_header("Content-Length", size)
|
78 |
bottle.response.set_header("Content-Length", size)
|
78 |
return f
|
79 |
return f
|
79 |
uplog("Streaming: %s" % os.path.join(self.root,filepath))
|
80 |
fullpath = os.path.join(self.root, filepath)
|
|
|
81 |
uplog("Streaming: %s " % fullpath)
|
|
|
82 |
mutf = mutagen.File(fullpath)
|
|
|
83 |
if mutf:
|
|
|
84 |
return bottle.static_file(filepath, root=self.root,
|
|
|
85 |
mimetype=mutf.mime[0])
|
|
|
86 |
else:
|
80 |
return bottle.static_file(filepath, root=self.root)
|
87 |
return bottle.static_file(filepath, root=self.root)
|
81 |
|
|
|
82 |
|
88 |
|
83 |
|
89 |
|
84 |
# Bottle handle both the streaming and control requests.
|
90 |
# Bottle handle both the streaming and control requests.
|
85 |
def runbottle(host='0.0.0.0', port=9278, pthstr='', pathprefix=''):
|
91 |
def runbottle(host='0.0.0.0', port=9278, pthstr='', pathprefix=''):
|
86 |
global datadir
|
92 |
global datadir
|