Folder for date
This commit is contained in:
1 parent
9496824637
commit
2792ccd5bc
1 file changed
+12
-1
+12
-1
@@ -69,6 +69,15 @@ def _api_get(base_url, path, default=None):
|
||||
return default
|
||||
|
||||
|
||||
def _folder_date(filepath):
|
||||
output = Path(OUTPUT_DIR)
|
||||
rel = Path(filepath).relative_to(output)
|
||||
parts = rel.parts
|
||||
if len(parts) >= 2:
|
||||
return parts[0]
|
||||
return None
|
||||
|
||||
|
||||
def _stop_ffmpeg_locked():
|
||||
global _streaming_proc, _streaming_mp4
|
||||
if _streaming_proc:
|
||||
@@ -207,10 +216,12 @@ def api_download_mp4():
|
||||
def api_batch_result():
|
||||
fpath = request.args.get("file", "")
|
||||
filename = Path(fpath).name
|
||||
batch_num, date_str = _parse_filename(filename)
|
||||
batch_num, _ = _parse_filename(filename)
|
||||
if batch_num is None:
|
||||
return jsonify({"success": False, "error": "Cannot parse batch number from filename"}), 200
|
||||
|
||||
date_str = _folder_date(fpath) or _parse_filename(filename)[1]
|
||||
|
||||
def _match_in_batches(batches):
|
||||
for b in batches:
|
||||
if b.get("batch_number") == batch_num:
|
||||
|
||||
Reference in new issue
Block a user