mirror of
https://github.com/xavier150/convert-video-for-Resolve
synced 2025-11-08 18:45:04 +01:00
Auto install ffmpeg-python
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import ffmpeg
|
import sys
|
||||||
|
import subprocess
|
||||||
|
import pkg_resources
|
||||||
from os import listdir
|
from os import listdir
|
||||||
from os.path import isfile, join
|
from os.path import isfile, join
|
||||||
import time
|
import time
|
||||||
@@ -9,9 +11,17 @@ export_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"Export")
|
|||||||
|
|
||||||
def CheckPrerequisites ():
|
def CheckPrerequisites ():
|
||||||
print("Check prerequisites..")
|
print("Check prerequisites..")
|
||||||
#time.sleep(1)
|
|
||||||
VerifiDirs(source_path)
|
VerifiDirs(source_path)
|
||||||
VerifiDirs(export_path)
|
VerifiDirs(export_path)
|
||||||
|
|
||||||
|
required = {'ffmpeg-python'}
|
||||||
|
installed = {pkg.key for pkg in pkg_resources.working_set}
|
||||||
|
missing = required - installed
|
||||||
|
|
||||||
|
if missing:
|
||||||
|
python = sys.executable
|
||||||
|
subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)
|
||||||
|
|
||||||
print("Check prerequisites finished!")
|
print("Check prerequisites finished!")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -34,6 +44,7 @@ class FileToConvert():
|
|||||||
self.status = "Waiting"
|
self.status = "Waiting"
|
||||||
|
|
||||||
def ConvertFile(self):
|
def ConvertFile(self):
|
||||||
|
import ffmpeg
|
||||||
SourceFile = os.path.join(source_path, self.file_name)
|
SourceFile = os.path.join(source_path, self.file_name)
|
||||||
new_file_name = self.file_name
|
new_file_name = self.file_name
|
||||||
new_file_name = new_file_name[:-4]
|
new_file_name = new_file_name[:-4]
|
||||||
|
|||||||
Reference in New Issue
Block a user