Skip to content

Commit

Permalink
refactor: Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmozhijin committed Nov 22, 2024
1 parent 64a2229 commit b4b8ac4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions LDDC/backend/song_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ def parse_cue(data: str, file_dir: str, file_path: str | None = None) -> tuple[l
if not os.path.isfile(audio_file_path):
for file_extension in audio_formats:
if file_path and (
(audio_file_path := os.path.join(os.path.dirname(file_path), os.path.splitext(file["filename"])[0] + "." + file_extension))
and os.path.isfile(audio_file_path) or
(audio_file_path := os.path.splitext(file_path)[0] + "." + file_extension)
and os.path.isfile(audio_file_path)):
((audio_file_path := os.path.join(os.path.dirname(file_path), os.path.splitext(file["filename"])[0] + "." + file_extension))
and os.path.isfile(audio_file_path)) or
((audio_file_path := os.path.splitext(file_path)[0] + "." + file_extension)
and os.path.isfile(audio_file_path))):
break
else:
logger.warning("未找到音频文件: %s", file["filename"])
Expand Down

0 comments on commit b4b8ac4

Please sign in to comment.