diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index d4c159a1c..5dda9fb3c 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -559,13 +559,16 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen subtitles = {} _scandir = _scandir_generic if scandir_generic else scandir for entry in _scandir(dirpath): + if not entry.name and not scandir_generic: + logger.debug('Could not determine the name of the file, retrying with scandir_generic') + return _search_external_subtitles(path, languages, only_one, True) if not entry.is_file(follow_symlinks=False): continue p = entry.name # keep only valid subtitle filenames - if not p.lower().startswith(fileroot.lower()) or not p.endswith(SUBTITLE_EXTENSIONS): + if not p.lower().startswith(fileroot.lower()) or not p.lower().endswith(SUBTITLE_EXTENSIONS): continue p_root, p_ext = os.path.splitext(p) diff --git a/libs/subliminal_patch/extensions.py b/libs/subliminal_patch/extensions.py index 5e20e8556..e155439a6 100644 --- a/libs/subliminal_patch/extensions.py +++ b/libs/subliminal_patch/extensions.py @@ -63,3 +63,4 @@ subliminal.refiner_manager.register('drone = subliminal_patch.refiners.drone:ref subliminal.refiner_manager.register('filebot = subliminal_patch.refiners.filebot:refine') subliminal.refiner_manager.register('file_info_file = subliminal_patch.refiners.file_info_file:refine') subliminal.refiner_manager.register('symlinks = subliminal_patch.refiners.symlinks:refine') +