Update video provider

This commit is contained in:
hlohaus
2025-06-19 10:04:43 +02:00
parent aa92c2225e
commit 04b59558b4
5 changed files with 45 additions and 42 deletions

View File

@@ -435,14 +435,16 @@ class Backend_Api(Api):
return jsonify({"error": {"message": "Not found"}}), 404
if search not in self.match_files:
self.match_files[search] = {}
found_mime_type = False
for root, _, files in os.walk(media_dir):
for file in files:
mime_type = is_allowed_extension(file)
if mime_type is not None:
mime_type = secure_filename(mime_type)
if safe_search[0] in mime_type:
found_mime_type = True
self.match_files[search][file] = self.match_files[search].get(file, 0) + 1
for tag in safe_search:
for tag in safe_search[1:] if found_mime_type else safe_search:
if tag in file.lower():
self.match_files[search][file] = self.match_files[search].get(file, 0) + 1
break