Merge branch 'bugfix_error_message' into develop

This commit is contained in:
misyaguziya
2025-10-08 13:01:57 +09:00
3 changed files with 32 additions and 19 deletions

View File

@@ -1136,7 +1136,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1178,7 +1177,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1203,7 +1201,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1228,7 +1225,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1319,7 +1315,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1360,7 +1355,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1385,7 +1379,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{
@@ -1411,7 +1404,6 @@ class Controller:
else:
raise ValueError()
except Exception:
errorLogging()
response = {
"status":400,
"result":{

View File

@@ -1,4 +1,4 @@
import asyncio
import time
from typing import Any
from time import sleep
from threading import Thread
@@ -120,7 +120,9 @@ class OSCHandler:
while True:
try:
self.osc_query_service = OSCQueryService(self.osc_query_service_name, self.http_port, self.osc_server_port)
# osc_server_name + UTC timestampでユニークなサービス名を生成
service_name = f"{self.osc_query_service_name}:{int(time.time())}"
self.osc_query_service = OSCQueryService(service_name, self.http_port, self.osc_server_port)
for filter, target in self.dict_filter_and_target.items():
self.osc_query_service.advertise_endpoint(filter, access=OSCAccess.READWRITE_VALUE)
break

View File

@@ -67,9 +67,16 @@ class OverlayImage:
font_path = os_path.join(self.root_path, font_family)
font = ImageFont.truetype(font_path, font_size)
except Exception:
errorLogging()
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
# overlayフォルダから操作している場合
if os_path.exists(os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)):
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
elif os_path.exists(os_path.join(os_path.dirname(__file__), "fonts", font_family)):
# src-pythonフォルダから操作している場合
font_path = os_path.join(os_path.dirname(__file__), "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
else:
raise FileNotFoundError(f"Font file not found: {font_family}")
text_width = draw.textlength(text, font)
character_width = text_width // len(text)
@@ -171,9 +178,14 @@ class OverlayImage:
font_path = os_path.join(self.root_path, font_family)
font = ImageFont.truetype(font_path, font_size)
except Exception:
errorLogging()
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
if os_path.exists(os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)):
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
elif os_path.exists(os_path.join(os_path.dirname(__file__), "fonts", font_family)):
font_path = os_path.join(os_path.dirname(__file__), "fonts", font_family)
font = ImageFont.truetype(font_path, font_size)
else:
raise FileNotFoundError(f"Font file not found: {font_family}")
# 改行を含んだtextの最大の文字数を計算する
text_width = max(draw.textlength(line, font) for line in text.split("\n"))
@@ -207,9 +219,16 @@ class OverlayImage:
font_path = os_path.join(self.root_path, self.LANGUAGES["Default"])
font = ImageFont.truetype(font_path, font_size)
except Exception:
errorLogging()
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", self.LANGUAGES["Default"])
font = ImageFont.truetype(font_path, font_size)
# overlayフォルダから操作している場合
if os_path.exists(os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", self.LANGUAGES["Default"])):
font_path = os_path.join(os_path.dirname(__file__), "..", "..", "..", "fonts", self.LANGUAGES["Default"])
font = ImageFont.truetype(font_path, font_size)
elif os_path.exists(os_path.join(os_path.dirname(__file__), "fonts", self.LANGUAGES["Default"])):
# src-pythonフォルダから操作している場合
font_path = os_path.join(os_path.dirname(__file__), "fonts", self.LANGUAGES["Default"])
font = ImageFont.truetype(font_path, font_size)
else:
raise FileNotFoundError(f"Font file not found: {self.LANGUAGES['Default']}")
text_height = font_size + ui_padding
text_width = draw.textlength(date_time, font)