Skip to content

Commit

Permalink
Merge pull request #4 from actlaboratory/cat/lfs_is_useless
Browse files Browse the repository at this point in the history
FFmpegを外部リソースから持って来るスクリプトを追加
  • Loading branch information
yncat authored Jan 4, 2024
2 parents 45ac553 + a6b774b commit 9291ba4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
ffmpeg.exe filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ runCMD.bat
*.po~
temp/
*.zip
ffmpeg.exe
3 changes: 0 additions & 3 deletions ffmpeg.exe

This file was deleted.

11 changes: 10 additions & 1 deletion tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
import urllib.request
import zipfile


import diff_archiver

import constants

from tools import bumpup

from tools import bumpup, ffmpegDownloader


class build:
Expand All @@ -34,6 +36,10 @@ def __init__(self):
automated = self.setAutomated()
print("Starting build for %s(automated mode=%s)" % (constants.APP_NAME, automated))

# FFmpegがなければダウンロードする
if not os.path.isfile("ffmpeg.exe"):
self.downloadFFmpeg()

# パッケージのパスとファイル名を決定
package_path = os.path.join("dist", os.path.splitext(os.path.basename(constants.STARTUP_FILE))[0])
build_filename = os.environ.get('TAG_NAME', 'snapshot')
Expand Down Expand Up @@ -75,6 +81,9 @@ def __init__(self):
self.makePackageInfo(archive_name, patch_name, build_filename)
print("Build finished!")

def downloadFFmpeg(self):
ffmpegDownloader.downloadFFmpeg()

def runcmd(self,cmd):
proc=subprocess.Popen(cmd.split(), shell=True, stdout=1, stderr=2)
proc.communicate()
Expand Down
12 changes: 12 additions & 0 deletions tools/downloadFFmpeg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import os
import sys
sys.path.append(os.getcwd())

from tools import ffmpegDownloader


if os.path.isfile("ffmpeg.exe"):
print("ffmpeg.exe already exists!")
else:
ffmpegDownloader.downloadFFmpeg()
# end if
21 changes: 21 additions & 0 deletions tools/ffmpegDownloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import urllib.request
import os
import shutil
import zipfile

def downloadFFmpeg():
ffmpegVersion = "6.1.1"
remoteFile = "ffmpeg-%s-full_build" % ffmpegVersion
url = "https://github.com/GyanD/codexffmpeg/releases/download/%s/%s.zip" % (ffmpegVersion, remoteFile)
print("Downloading FFmpeg from %s" % url)
urllib.request.urlretrieve(url, "ffmpeg.zip")
print("Extracting FFmpeg...")
with zipfile.ZipFile("ffmpeg.zip", "r") as zip:
zip.extract("%s/bin/ffmpeg.exe" % remoteFile)
# end with
print("moving ffmpeg.exe to current directory...")
shutil.move(os.path.join(remoteFile, "bin", "ffmpeg.exe"), "ffmpeg.exe")
print("removing temporary files...")
shutil.rmtree(remoteFile)
os.remove("ffmpeg.zip")
print("got ffmpeg!")

0 comments on commit 9291ba4

Please sign in to comment.