Skip to content

Commit

Permalink
Merge pull request #59 from TrackLab/main
Browse files Browse the repository at this point in the history
Logic for FFMPEG check
  • Loading branch information
wolfswolke authored Jul 20, 2024
2 parents c77bc69 + ee5805e commit 863a00d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/start_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import time
import subprocess

from src.constants import (APP_VERSION, ddos_protection_calc, ddos_wait_timer,
language, name, output_path, season_override,
Expand All @@ -14,6 +15,15 @@

logger = setup_logger(__name__)

def is_ffmpeg_installed():
# Attempt to execute ffmpeg
try:
result = subprocess.run(['ffmpeg', '-version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return "ffmpeg version" in result.stdout.decode()

except FileNotFoundError:
return False

# ------------------------------------------------------- #
# main
# ------------------------------------------------------- #
Expand Down Expand Up @@ -46,6 +56,11 @@ def main():
logger.error("Name is Default. Please reade readme before starting.")
exit()

# Check if FFMPEG is installed before even trying to download episodes
if not is_ffmpeg_installed():
logger.error("FFMPEG is not installed or could not be run. You can download it at https://ffmpeg.org/")
exit()

if season_override == 0:
logger.info("No Season override detected.")
if dlMode.lower() == 'movies':
Expand Down

0 comments on commit 863a00d

Please sign in to comment.