diff --git a/Dockerfile b/Dockerfile index a72591a..38222c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,6 +26,7 @@ RUN pip3 install rq RUN pip3 install schedule RUN pip3 install shortuuid RUN pip3 install getmac +RUN pip3 install pybase64 COPY . . diff --git a/editor/rtsp_video_editor.py b/editor/rtsp_video_editor.py index 902b79c..6edb9f6 100644 --- a/editor/rtsp_video_editor.py +++ b/editor/rtsp_video_editor.py @@ -1,4 +1,4 @@ -import base64 +import pybase64 import io import ffmpeg import PIL.Image as Image @@ -23,7 +23,7 @@ def take_screenshot(self) -> str: image = self.__take_screenshot() image_bytes = io.BytesIO() image.save(image_bytes, format='JPEG') - img_str = base64.b64encode(image_bytes.getvalue()) + img_str = pybase64.b64encode(image_bytes.getvalue()) return img_str.decode('utf-8') def generate_thumbnail(self) -> str: @@ -31,7 +31,7 @@ def generate_thumbnail(self) -> str: image.thumbnail((300, 300), Image.LANCZOS) image_bytes = io.BytesIO() image.save(image_bytes, format='JPEG') - img_str = base64.b64encode(image_bytes.getvalue()) + img_str = pybase64.b64encode(image_bytes.getvalue()) return img_str.decode('utf-8') def probe(self) -> dict: diff --git a/readers/base_pipe_reader.py b/readers/base_pipe_reader.py index d2b0865..9a690e8 100644 --- a/readers/base_pipe_reader.py +++ b/readers/base_pipe_reader.py @@ -1,4 +1,4 @@ -import base64 +import pybase64 import json from abc import ABC, abstractmethod from enum import IntEnum @@ -77,7 +77,7 @@ def __create_base64_img(numpy_img: np.array) -> str: img = Image.fromarray(numpy_img) buffered = BytesIO() img.save(buffered, format="JPEG") - img_str = base64.b64encode(buffered.getvalue()).decode() + img_str = pybase64.b64encode(buffered.getvalue()).decode() return img_str def send(self, img_data): diff --git a/temp.py b/temp.py index 149fb7a..a431b4c 100644 --- a/temp.py +++ b/temp.py @@ -1,4 +1,4 @@ -import base64 +import pybase64 import time from datetime import datetime import glob @@ -38,7 +38,7 @@ def _create_base64_img(numpy_img: np.array) -> str: img = Image.fromarray(numpy_img) buffered = BytesIO() img.save(buffered, format="JPEG") - img_str = base64.b64encode(buffered.getvalue()).decode() + img_str = pybase64.b64encode(buffered.getvalue()).decode() return img_str diff --git a/various/probe_event_handler.py b/various/probe_event_handler.py index 37f5090..83c2be6 100644 --- a/various/probe_event_handler.py +++ b/various/probe_event_handler.py @@ -1,4 +1,4 @@ -import base64 +import pybase64 import json import ffmpeg from datetime import datetime @@ -39,5 +39,5 @@ def handle(self, dic: dict): pre = ProbeResponseEvent() pre.address = request.address - pre.result_b64 = base64.b64encode(barr).decode('utf-8') + pre.result_b64 = pybase64.b64encode(barr).decode('utf-8') self.event_bus.publish_async(serialize_json(pre))