派生自 development/c++

pansen
2019-03-07 d3b7bbe7102cd089680a828f5d8f6402c8cf6342
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import time
 
import Ice
import sys
import traceback
 
import RecordVideo
 
status = 0
ic = None
try:
 
    # 初始化运行环境
    ic = Ice.initialize(sys.argv)
 
    # 获取远程printer服务的代理
    base = ic.stringToProxy("LoopRecordVideoServer:default -h 192.168.1.185 -p 11010")
 
    # 请求服务端确认:”这是不是 Demo::Printer的代理接口?“
    printer = RecordVideo.LoopRecorderPrx.checkedCast(base)
    if not printer:
        raise RuntimeError("Invalid proxy")
 
    str_json = "{\"rtsp\":\"rtsp://admin:a1234567@192.168.1.215:554/h264/ch1/main/av_stream\"," \
               "\"path\":\"/home/basic/work/qiaojia/realtime/21/"
 
    # 远程调用,看起来像本地的服务一样
    # ti = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    # str1 = str_json + ti + ".mp4\"}"
    # print(str1)
    # printer.addCamera("2", "test")
 
    time.sleep(2)
    ti1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    str2 = str_json + ti1 + ".mp4\"}"
    print(str2)
    printer.addCamera("21", str2)
 
    # time.sleep(2)
    # ti1 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    # str2 = str_json + ti1 + ".mp4\"}"
    # print(str2)
    # printer.addCamera("2", str2)
 
    # printer.addCamera("2", "test")
    # time.sleep(2)
    # ti3 = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    # str3 = str_json + ti3 + ".mp4\"}"
    # print(str2)
    # printer.addCamera("3", str3)
 
    # printer.removeCamera("2")
 
    while True:
        printer.feedDog("21")
        time.sleep(1)
 
except:
    traceback.print_exc()
    status = 1
 
if ic:
    # Clean up
    try:
        ic.destroy()
    except:
        traceback.print_exc()
        status = 1
 
sys.exit(status)