Skip to content

Commit

Permalink
Replaces base64 with pybase64
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetgoren committed May 31, 2024
1 parent 489e5b4 commit 0f1c9bc
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 . .

Expand Down
6 changes: 3 additions & 3 deletions editor/rtsp_video_editor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base64
import pybase64
import io
import ffmpeg
import PIL.Image as Image
Expand All @@ -23,15 +23,15 @@ 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:
image = self.__take_screenshot()
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:
Expand Down
4 changes: 2 additions & 2 deletions readers/base_pipe_reader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base64
import pybase64
import json
from abc import ABC, abstractmethod
from enum import IntEnum
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions temp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base64
import pybase64
import time
from datetime import datetime
import glob
Expand Down Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions various/probe_event_handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base64
import pybase64
import json
import ffmpeg
from datetime import datetime
Expand Down Expand Up @@ -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))

0 comments on commit 0f1c9bc

Please sign in to comment.