|
a/src/mediaserver/cdplugins/uprcl/uprcl-app.py |
|
b/src/mediaserver/cdplugins/uprcl/uprcl-app.py |
|
... |
|
... |
13 |
# GNU General Public License for more details.
|
13 |
# GNU General Public License for more details.
|
14 |
#
|
14 |
#
|
15 |
# You should have received a copy of the GNU General Public License
|
15 |
# You should have received a copy of the GNU General Public License
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17 |
|
17 |
|
|
|
18 |
from __future__ import print_function
|
18 |
import sys
|
19 |
import sys
|
19 |
import os
|
20 |
import os
|
20 |
import json
|
21 |
import json
|
21 |
import re
|
22 |
import re
|
22 |
import cmdtalkplugin
|
23 |
import cmdtalkplugin
|
|
... |
|
... |
32 |
import uprclinit
|
33 |
import uprclinit
|
33 |
|
34 |
|
34 |
#####
|
35 |
#####
|
35 |
# Initialize communication with our parent process: pipe and method
|
36 |
# Initialize communication with our parent process: pipe and method
|
36 |
# call dispatch
|
37 |
# call dispatch
|
|
|
38 |
|
|
|
39 |
# Some of the modules we use write garbage to stdout, which messes the
|
|
|
40 |
# communication with our parent. Why can't people understand that this
|
|
|
41 |
# is verboten ? Get off my lawn ! So we dup stdout and close it, then
|
|
|
42 |
# pass the right file to cmdtalk. (hoping that none of the imports
|
|
|
43 |
# above print anything, else we'll have to move this code up)
|
|
|
44 |
_outfile = os.fdopen(os.dup(1), "w")
|
|
|
45 |
os.close(1)
|
|
|
46 |
fd = os.open("/dev/null", os.O_WRONLY)
|
|
|
47 |
# print("UPRCL-APP: got fd %d for /dev/null" % fd, file=sys.stderr)
|
|
|
48 |
|
37 |
# Func name to method mapper
|
49 |
# Func name to method mapper
|
38 |
dispatcher = cmdtalkplugin.Dispatch()
|
50 |
dispatcher = cmdtalkplugin.Dispatch()
|
39 |
# Pipe message handler
|
51 |
# Pipe message handler
|
40 |
msgproc = cmdtalkplugin.Processor(dispatcher)
|
52 |
msgproc = cmdtalkplugin.Processor(dispatcher, outfile=_outfile)
|
41 |
|
53 |
|
42 |
@dispatcher.record('trackuri')
|
54 |
@dispatcher.record('trackuri')
|
43 |
def trackuri(a):
|
55 |
def trackuri(a):
|
44 |
# This is used for plugins which generate temporary local urls
|
56 |
# This is used for plugins which generate temporary local urls
|
45 |
# pointing to the microhttpd instance. The microhttpd
|
57 |
# pointing to the microhttpd instance. The microhttpd
|