--- hls_streaming/hls.py
+++ hls_streaming/hls.py
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 |
import cv2 |
4 | 4 |
import numpy as np |
5 | 5 |
import requests |
6 |
+import base64 |
|
6 | 7 |
from requests_toolbelt.multipart.encoder import MultipartEncoder |
7 | 8 |
from zoneinfo import ZoneInfo |
8 | 9 |
from datetime import datetime |
... | ... | @@ -99,7 +100,7 @@ |
99 | 100 |
header = { |
100 | 101 |
'Content-Type': f'image/{image_type}', |
101 | 102 |
'x-time-sent': time_sent, |
102 |
- 'x-cctv-info': str(self.cctvid), |
|
103 |
+ 'x-cctv-info': base64.b64encode(str(self.cctvid).encode('utf-8')).decode('ascii'), |
|
103 | 104 |
'x-cctv-latitude' : str(self.lat), |
104 | 105 |
'x-cctv-longitude' : str(self.lon), |
105 | 106 |
} |
... | ... | @@ -133,20 +134,20 @@ |
133 | 134 |
self.input_stream.close() |
134 | 135 |
|
135 | 136 |
|
136 |
-# # Example usage |
|
137 |
-# if __name__ == "__main__": |
|
138 |
-# capturer = FrameCapturer( |
|
139 |
-# 'http://cctvsec.ktict.co.kr/5545/LFkDslDT81tcSYh3G4306+mcGlLb3yShF9rx2vcPfltwUL4+I950kcBlD15uWm6K0cKCtAMlxsIptMkCDo5lGQiLlARP+SyUloz8vIMNB18=', |
|
140 |
-# 101, 10, 5 |
|
141 |
-# ) |
|
142 |
-# t1 = time.time() |
|
143 |
-# try: |
|
144 |
-# capturer.start() |
|
145 |
-# time.sleep(600000) |
|
146 |
-# finally: |
|
147 |
-# capturer.stop() |
|
148 |
-# del capturer |
|
149 |
-# t2 = time.time() |
|
150 |
-# with open("result.txt", "w") as file: |
|
151 |
-# file.write(f'{t2-t1} seconds before terminating') |
|
152 |
-# exit() |
|
137 |
+# Example usage |
|
138 |
+if __name__ == "__main__": |
|
139 |
+ capturer = FrameCapturer( |
|
140 |
+ 'http://cctvsec.ktict.co.kr/5545/LFkDslDT81tcSYh3G4306+mcGlLb3yShF9rx2vcPfltwUL4+I950kcBlD15uWm6K0cKCtAMlxsIptMkCDo5lGQiLlARP+SyUloz8vIMNB18=', |
|
141 |
+ "[국도] 테해란로", 10, 5 |
|
142 |
+ ) |
|
143 |
+ t1 = time.time() |
|
144 |
+ try: |
|
145 |
+ capturer.start() |
|
146 |
+ time.sleep(600000) |
|
147 |
+ finally: |
|
148 |
+ capturer.stop() |
|
149 |
+ del capturer |
|
150 |
+ t2 = time.time() |
|
151 |
+ with open("result.txt", "w") as file: |
|
152 |
+ file.write(f'{t2-t1} seconds before terminating') |
|
153 |
+ exit() |
--- test.py
+++ test.py
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 |
from flask_restx import Api, Resource, fields |
3 | 3 |
import os |
4 | 4 |
from datetime import datetime |
5 |
+import base64 |
|
5 | 6 |
# from yoloseg.inference_ import Inference |
6 | 7 |
|
7 | 8 |
app = Flask(__name__) |
... | ... | @@ -34,7 +35,7 @@ |
34 | 35 |
if 'file' not in request.files: |
35 | 36 |
ns.abort(400, 'No image part in the request') |
36 | 37 |
image = request.files['file'] |
37 |
- cctv_info = request.headers.get('x-cctv-info', '') |
|
38 |
+ cctv_info = base64.b64decode(request.headers.get('x-cctv-info', '')).decode('UTF-8') |
|
38 | 39 |
print(cctv_info) |
39 | 40 |
time_sent = request.headers.get('x-time-sent', '') |
40 | 41 |
cctv_latitude = request.headers.get('x-cctv-latitude', 'Not provided') |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?