From 621ea217065003324ce29c5372d64d1035790344 Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Wed, 4 Jun 2025 03:39:20 +0300 Subject: [PATCH] check if file exist AJT Japanese needs to play files stored in all possible locations on disk --- qt/aqt/sound.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/qt/aqt/sound.py b/qt/aqt/sound.py index 5c0df22ed..278cfee19 100644 --- a/qt/aqt/sound.py +++ b/qt/aqt/sound.py @@ -46,22 +46,8 @@ from aqt.utils import ( ########################################################################## -def is_in_any_collection(file_path: str) -> bool: - from aqt import mw - - file_dir = os.path.dirname(file_path) # should be "/path/to/collection.media" - profile_dir = os.path.dirname(file_dir) # e.g. "/path/to/User 1" - return ( - os.path.basename(file_dir) == "collection.media" - and os.path.basename(profile_dir) in mw.pm.profiles() - and os.path.dirname(profile_dir) == mw.pm.base - ) - - def resolve_tag_path(tag: SoundOrVideoTag, media_folder: str) -> str: - file_path = ( - tag.filename if is_in_any_collection(tag.filename) else tag.path(media_folder) - ) + file_path = tag.filename if os.path.isfile(tag.filename) else tag.path(media_folder) return hooks.media_file_filter(file_path)