mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-06 19:12:30 +01:00
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
|
import zipfile
|
||
|
from urllib.request import urlopen
|
||
|
import os
|
||
|
|
||
|
|
||
|
def download_and_extract(file_base_path, name):
|
||
|
print("Download: ", name)
|
||
|
|
||
|
download_server_base_url = 'https://evermeet.cx/ffmpeg/'
|
||
|
filedata = urlopen(download_server_base_url + name)
|
||
|
datatowrite = filedata.read()
|
||
|
path_and_filename = os.path.join(file_base_path, name)
|
||
|
|
||
|
print("Save tmp file: ", path_and_filename)
|
||
|
with open(path_and_filename, 'wb') as f:
|
||
|
f.write(datatowrite)
|
||
|
|
||
|
extraction_path = os.path.join(file_base_path, "../Common/ffmpeg")
|
||
|
|
||
|
print("Extract to:", extraction_path)
|
||
|
with zipfile.ZipFile(path_and_filename,"r") as zip_ref:
|
||
|
zip_ref.extractall(extraction_path)
|
||
|
|
||
|
print("Delete tmp file: ", path_and_filename)
|
||
|
os.remove(path_and_filename)
|
||
|
|
||
|
ffmpeg_7zip_name = 'ffmpeg-4.4.zip'
|
||
|
ffprobe_7zip_name = 'ffprobe-4.4.zip'
|
||
|
current_path = os.path.join(os.path.abspath(os.getcwd()),"")
|
||
|
extraction_path = os.path.abspath(os.path.join(current_path, "../Common/ffmpeg"))
|
||
|
|
||
|
if not os.path.exists(extraction_path):
|
||
|
os.makedirs(extraction_path)
|
||
|
|
||
|
download_and_extract(current_path, ffmpeg_7zip_name)
|
||
|
download_and_extract(current_path, ffprobe_7zip_name)
|