Enhance file matching functionality in find_local_files to support recursive directory search. Update docstring for clarity on search behavior.
This commit is contained in:
@@ -82,7 +82,7 @@ def decode_pathurl(pathurl: str) -> str:
|
|||||||
|
|
||||||
def find_local_files(video_refs: Set[Tuple[str, str]], directory: str) -> Dict[str, Dict[str, str]]:
|
def find_local_files(video_refs: Set[Tuple[str, str]], directory: str) -> Dict[str, Dict[str, str]]:
|
||||||
"""
|
"""
|
||||||
Match XML references with files in directory.
|
Match XML references with files in directory (searches recursively).
|
||||||
|
|
||||||
Returns a dict mapping original filename to:
|
Returns a dict mapping original filename to:
|
||||||
{
|
{
|
||||||
@@ -94,9 +94,9 @@ def find_local_files(video_refs: Set[Tuple[str, str]], directory: str) -> Dict[s
|
|||||||
directory_path = Path(directory)
|
directory_path = Path(directory)
|
||||||
file_mapping = {}
|
file_mapping = {}
|
||||||
|
|
||||||
# Create a case-insensitive mapping of files in directory
|
# Create a case-insensitive mapping of files in directory (recursive search)
|
||||||
local_files = {}
|
local_files = {}
|
||||||
for file_path in directory_path.iterdir():
|
for file_path in directory_path.rglob('*'):
|
||||||
if file_path.is_file():
|
if file_path.is_file():
|
||||||
local_files[file_path.name.lower()] = str(file_path.resolve())
|
local_files[file_path.name.lower()] = str(file_path.resolve())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user