Created
November 11, 2019 12:40
-
-
Save dgnsrekt/5bd7326b531997ee00034e45cc9db2ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nox | |
from pathlib import Path | |
PROJECT_ROOT_DIR = Path(__file__).parent | |
PROJECT_BIN_DIR = PROJECT_ROOT_DIR / "bin" | |
FFMPEG_DIR = PROJECT_BIN_DIR / "ffmpeg-stable" | |
DOWNLOAD_COMPRESSED_FILE = "ffmpeg-git-amd64-static.tar.xz" | |
DOWNLOAD_URL = "https://johnvansickle.com/ffmpeg/builds/" + DOWNLOAD_COMPRESSED_FILE | |
FFMPEG_BIN = FFMPEG_DIR / "ffmpeg" | |
@nox.session(python=False) | |
def ffmpeg(session): | |
""" | |
Downloads and runs ffmpeg stable binary. | |
""" | |
if not PROJECT_BIN_DIR.exists(): | |
PROJECT_BIN_DIR.mkdir(exist_ok=True) | |
if not FFMPEG_DIR.exists(): | |
FFMPEG_DIR.mkdir(exist_ok=True) | |
if not FFMPEG_BIN.exists(): | |
session.run("wget", "--verbose", "--no-clobber", DOWNLOAD_URL, external=True) | |
session.run( | |
"tar", | |
"-xf", | |
DOWNLOAD_COMPRESSED_FILE, | |
"-C", | |
str(FFMPEG_DIR), | |
"--strip-components", | |
"1", | |
external=True, | |
) | |
session.run("rm", DOWNLOAD_COMPRESSED_FILE, external=True) | |
session.run(FFMPEG_BIN, "-version") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment