wolfswolke / aniworld_scraper

Aniworld.to mp4 scraper for animes.
MIT License
56 stars 16 forks source link

[REQUEST] Check/Handle when ffmpeg is not installed, and notify the user #58

Closed TrackLab closed 2 months ago

TrackLab commented 3 months ago

Please describe what you want to be added/changed: Literally every single time this gets an update and I pull it in a few folder, I forgot about ffmpeg. Getting only errors about files not being found for the .mp4 Which doesnt really tell you that youre missing FFMPEG.

Possible Solutions if you have any: Im suggesting a simple check/notification when FFMPEG isnt there. Either by checking if ffmpeg.exe is in the src folder, or a overal try/except when trying to load up ffmpeg if its installed as PATH.

And if its not, the user could be notified, asking if FFMPEG is installed, and if not, also post the official FFMPEG link. I might see if I can add this in a fork, but wanted to post a request either way.

wolfswolke commented 3 months ago

In downloaded.py at download_and_convert_hls_stream I already determine the ffmpeg path. This should only be 1 more line there with check cmlet and if it responds OK good else throw exit. I can add that when I'm home.

TrackLab commented 3 months ago

I made this function that checks if any ffmpeg instance (PATH or locally as .exe) returns its version number. In case you need a quick function to call for it.

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

Which I used in the main, before it checks for season_override. Added in line 59

# 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()

Feel free to use it, or not lol

wolfswolke commented 3 months ago

Merged the request thank you ^^