forked from vidjil/vidjil
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuse_server.py
More file actions
30 lines (23 loc) · 847 Bytes
/
fuse_server.py
File metadata and controls
30 lines (23 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from SimpleXMLRPCServer import SimpleXMLRPCServer
from subprocess import *
import sys
sys.path.insert(0, './web2py/applications/vidjil/modules')
import defs
import os.path
def fuse(cmd, output_dir, filename):
from subprocess import Popen, PIPE, STDOUT, os
fuse_log_file = open(output_dir+'/'+filename+'.fuse.log', 'w')
output_file = output_dir+'/'+filename+'.fused'
## fuse.py
p = Popen(cmd, shell=True, stdin=PIPE, stdout=fuse_log_file, stderr=STDOUT, close_fds=True)
(stdoutdata, stderrdata) = p.communicate()
fuse_filepath = os.path.abspath(output_file)
p.wait()
return fuse_filepath
def main():
server = SimpleXMLRPCServer((defs.FUSE_SERVER, defs.PORT_FUSE_SERVER))
server.register_function(fuse, "fuse")
while True:
server.handle_request()
if __name__ == "__main__":
main()