mirror of
https://github.com/hanxi/xiaomusic.git
synced 2026-04-24 22:19:58 +08:00
fix: 修复一些报错问题
This commit is contained in:
@@ -7,7 +7,7 @@ import signal
|
||||
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.asyncio import AsyncioIntegration
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration
|
||||
from sentry_sdk.integrations.logging import LoggingIntegration, ignore_logger
|
||||
|
||||
LOGO = r"""
|
||||
__ __ _ __ __ _
|
||||
@@ -32,6 +32,7 @@ sentry_sdk.init(
|
||||
],
|
||||
# debug=True,
|
||||
)
|
||||
ignore_logger("miservice")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -336,7 +336,7 @@ async def get_local_music_duration(filename, ffmpeg_location="./ffmpeg/bin"):
|
||||
m = await loop.run_in_executor(None, mutagen.File, filename)
|
||||
duration = m.info.length
|
||||
except Exception as e:
|
||||
log.error(f"Error getting local music {filename} duration: {e}")
|
||||
log.warning(f"Error getting local music {filename} duration: {e}")
|
||||
return duration
|
||||
|
||||
|
||||
@@ -673,8 +673,16 @@ def _resize_save_image(image_bytes, save_path, max_size=300):
|
||||
|
||||
|
||||
def extract_audio_metadata(file_path, save_root):
|
||||
audio = mutagen.File(file_path)
|
||||
metadata = Metadata()
|
||||
|
||||
audio = None
|
||||
try:
|
||||
audio = mutagen.File(file_path)
|
||||
except Exception as e:
|
||||
log.warning(f"Error extract_audio_metadata file: {file_path} {e}")
|
||||
if audio is None:
|
||||
return asdict(metadata)
|
||||
|
||||
tags = audio.tags
|
||||
if tags is None:
|
||||
return asdict(metadata)
|
||||
|
||||
@@ -325,7 +325,7 @@ class XiaoMusic:
|
||||
|
||||
# 检查响应状态码
|
||||
if r.status != 200:
|
||||
self.log.error(f"Request failed with status {r.status}")
|
||||
self.log.warning(f"Request failed with status {r.status}")
|
||||
continue
|
||||
|
||||
except asyncio.CancelledError:
|
||||
@@ -1646,7 +1646,7 @@ class XiaoMusicDevice:
|
||||
)
|
||||
await self.stop_if_xiaoai_is_playing(device_id)
|
||||
except Exception as e:
|
||||
self.log.exception(f"Execption {e}")
|
||||
self.log.warning(f"Execption {e}")
|
||||
|
||||
async def get_if_xiaoai_is_playing(self):
|
||||
playing_info = await self.xiaomusic.mina_service.player_get_status(
|
||||
|
||||
Reference in New Issue
Block a user