summaryrefslogtreecommitdiff
path: root/overnight_transcoder.py
diff options
context:
space:
mode:
authorTom Flux <tom@tomflux.xyz>2026-07-07 11:36:11 +0100
committerTom Flux <tom@tomflux.xyz>2026-07-07 11:36:11 +0100
commitf0d2fb17739c369de4590212d546a8ba91cee94d (patch)
treeb9976382be4204a665936d929bc9e3ac3034d74e /overnight_transcoder.py
parent4fff74a6378faa771cf5898d7cd1e43cfdb83039 (diff)
simplifyHEADmaster
Diffstat (limited to 'overnight_transcoder.py')
-rwxr-xr-xovernight_transcoder.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/overnight_transcoder.py b/overnight_transcoder.py
index 28048f9..96001b5 100755
--- a/overnight_transcoder.py
+++ b/overnight_transcoder.py
@@ -442,12 +442,6 @@ def update_transcode_result(conn: sqlite3.Connection, filepath: str, new_path: s
conn.commit()
-def remove_from_cache(conn: sqlite3.Connection, filepath: str):
- """Remove a file from the cache."""
- conn.execute("DELETE FROM files WHERE path = ?", (filepath,))
- conn.commit()
-
-
def get_cache_stats(conn: sqlite3.Connection) -> dict:
"""Get comprehensive stats from the cache."""
# File counts and sizes
@@ -598,24 +592,6 @@ def check_disk_space():
log.info("")
-def get_video_duration(filepath: str) -> Optional[float]:
- """Get video duration in seconds using ffprobe."""
- try:
- result = subprocess.run([
- "ffprobe", "-v", "quiet",
- "-show_entries", "format=duration",
- "-of", "json",
- filepath
- ], capture_output=True, text=True, timeout=30)
-
- if result.returncode == 0:
- data = json.loads(result.stdout)
- return float(data.get("format", {}).get("duration", 0))
- except Exception as e:
- log.debug(f"Failed to get duration for {filepath}: {e}")
- return None
-
-
def handle_interrupt(signum, frame):
"""Handle SIGINT/SIGTERM gracefully."""
log.warning("=" * 50)
@@ -675,17 +651,6 @@ def get_video_codec(filepath: str) -> Optional[str]:
return None
-def is_hevc(filepath: str) -> bool:
- """Check if a file is already HEVC encoded."""
- codec = get_video_codec(filepath)
- return codec in ["hevc", "h265"]
-
-
-def get_file_size_gb(filepath: str) -> float:
- """Get file size in GB."""
- return os.path.getsize(filepath) / (1024 ** 3)
-
-
def find_videos_to_transcode(conn: sqlite3.Connection) -> List[Dict]:
"""Find all non-HEVC videos, sorted by size (biggest first). Uses cache for speed."""
videos = []