Skip to content

Commit cf2e431

Browse files
committed
.
0 parents  commit cf2e431

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.dub
2+
docs.json
3+
__dummy.html
4+
docs/
5+
ffmpeg-fetcher.so
6+
ffmpeg-fetcher.dylib
7+
ffmpeg-fetcher.dll
8+
ffmpeg-fetcher.a
9+
ffmpeg-fetcher.lib
10+
ffmpeg-fetcher-test-*
11+
*.exe
12+
*.o
13+
*.obj
14+
*.lst

dub.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"description": "Automatically downloads and extracts zeranoe-ffmpeg",
3+
"license": "The Unlicense",
4+
"authors": [
5+
"CoolOppo"
6+
],
7+
"copyright": "Public Domain",
8+
"name": "ffmpeg-fetcher"
9+
}

source/app.d

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import std.net.curl, std.file, std.stdio;
2+
import std.path : buildPath;
3+
import std.uuid;
4+
import std.process;
5+
void main()
6+
{
7+
writeln("Making temp dir...");
8+
auto id = randomUUID.toString();
9+
auto tempDir = tempDir.buildPath(id);
10+
mkdir(tempDir);
11+
auto file = tempDir.buildPath("ffmpeg.zip");
12+
writeln("Downloading latest ffmpeg...");
13+
download("https://ffmpeg.zeranoe.com/builds/win64/shared/ffmpeg-latest-win64-shared.zip", file);
14+
writeln("Extracting...");
15+
wait(spawnProcess([`C:\Program Files\7-Zip\7zG.exe`, "x", file, "-spe", "-o"~tempDir]));
16+
auto installPath = `C:\opt\ffmpeg`;
17+
if (installPath.exists)
18+
{
19+
writeln("Deleting old ffmpeg...");
20+
rmdirRecurse(installPath);
21+
}
22+
writeln("Installing new ffmpeg...");
23+
wait(spawnProcess([`cmd.exe`, "/C", "move " ~ tempDir.buildPath("ffmpeg-latest-win64-shared") ~ " " ~ installPath]));
24+
writeln("Deleting temporary directory...");
25+
rmdirRecurse(tempDir);
26+
writeln("Update completed.");
27+
}

0 commit comments

Comments
 (0)