Add local dashcam video library
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -222,6 +222,46 @@ def dashcam_file_marked_uploaded(relative_path, sha256):
|
||||
return cur.fetchone() is not None
|
||||
|
||||
|
||||
def dashcam_file_uploaded_for_stat(relative_path, size, mtime):
|
||||
"""Whether the current local file version is confirmed uploaded.
|
||||
|
||||
Uses the existing hash cache so list/retention scans never rehash large
|
||||
video files merely to display their status.
|
||||
"""
|
||||
conn = get_conn()
|
||||
if conn is None:
|
||||
return False
|
||||
with _conn_lock:
|
||||
cur = conn.execute(
|
||||
"""SELECT 1
|
||||
FROM dashcam_hash_cache AS cache
|
||||
JOIN dashcam_uploads AS uploads
|
||||
ON uploads.RELATIVE_PATH = cache.RELATIVE_PATH
|
||||
AND uploads.SHA256 = cache.SHA256
|
||||
WHERE cache.RELATIVE_PATH = ?
|
||||
AND cache.SIZE = ?
|
||||
AND cache.MTIME = ?""",
|
||||
(relative_path, size, mtime),
|
||||
)
|
||||
return cur.fetchone() is not None
|
||||
|
||||
|
||||
def uploaded_dashcam_file_stats():
|
||||
"""Return exact uploaded file versions as (path, size, mtime) tuples."""
|
||||
conn = get_conn()
|
||||
if conn is None:
|
||||
return set()
|
||||
with _conn_lock:
|
||||
cur = conn.execute(
|
||||
"""SELECT cache.RELATIVE_PATH, cache.SIZE, cache.MTIME
|
||||
FROM dashcam_hash_cache AS cache
|
||||
JOIN dashcam_uploads AS uploads
|
||||
ON uploads.RELATIVE_PATH = cache.RELATIVE_PATH
|
||||
AND uploads.SHA256 = cache.SHA256"""
|
||||
)
|
||||
return set(cur.fetchall())
|
||||
|
||||
|
||||
def mark_dashcam_file_uploaded(relative_path, sha256):
|
||||
conn = get_conn()
|
||||
if conn is None:
|
||||
|
||||
Reference in New Issue
Block a user