1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-22 15:54:26 +00:00

Avoid FileNotFoundError indexing subtitles

This commit is contained in:
Vitiko 2023-10-19 22:27:42 -04:00
parent e3cda5c11e
commit 5efc838749

View file

@ -872,14 +872,14 @@ def _search_external_subtitles(path, languages=None, only_one=False, match_stric
dirpath, filename = os.path.split(path) dirpath, filename = os.path.split(path)
dirpath = dirpath or '.' dirpath = dirpath or '.'
fn_no_ext, fileext = os.path.splitext(filename) fn_no_ext, fileext = os.path.splitext(filename)
fn_no_ext_lower = unicodedata.normalize('NFC', fn_no_ext.lower()) fn_no_ext_lower = fn_no_ext.lower() # unicodedata.normalize('NFC', fn_no_ext.lower())
subtitles = {} subtitles = {}
for entry in scandir(dirpath): for entry in scandir(dirpath):
if not entry.is_file(follow_symlinks=False): if not entry.is_file(follow_symlinks=False):
continue continue
p = unicodedata.normalize('NFC', entry.name) p = entry.name # unicodedata.normalize('NFC', entry.name)
# keep only valid subtitle filenames # keep only valid subtitle filenames
if not p.lower().endswith(SUBTITLE_EXTENSIONS): if not p.lower().endswith(SUBTITLE_EXTENSIONS):