Removed hardcoded parameters. Defaults loaded at runtime.
This commit is contained in:
parent
5487319dc1
commit
eaee0ab233
|
@ -0,0 +1,204 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${file}",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PySpark",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"osx": {
|
||||
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
|
||||
},
|
||||
"windows": {
|
||||
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"
|
||||
},
|
||||
"linux": {
|
||||
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
|
||||
},
|
||||
"program": "${file}",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Python Module",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"module": "module.name",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Integrated Terminal/Console",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${file}",
|
||||
"cwd": "",
|
||||
"console": "integratedTerminal",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "External Terminal/Console",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${file}",
|
||||
"cwd": "",
|
||||
"console": "externalTerminal",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Django",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${workspaceRoot}/manage.py",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"args": [
|
||||
"runserver",
|
||||
"--noreload"
|
||||
],
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput",
|
||||
"DjangoDebugging"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Flask",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": false,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {
|
||||
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
|
||||
},
|
||||
"args": [
|
||||
"run",
|
||||
"--no-debugger",
|
||||
"--no-reload"
|
||||
],
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Flask (old)",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": false,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${workspaceRoot}/run.py",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"args": [],
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Pyramid",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"args": [
|
||||
"${workspaceRoot}/development.ini"
|
||||
],
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput",
|
||||
"Pyramid"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Watson",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"stopOnEntry": true,
|
||||
"pythonPath": "${config:python.pythonPath}",
|
||||
"program": "${workspaceRoot}/console.py",
|
||||
"cwd": "${workspaceRoot}",
|
||||
"args": [
|
||||
"dev",
|
||||
"runserver",
|
||||
"--noreload=True"
|
||||
],
|
||||
"env": {},
|
||||
"envFile": "${workspaceRoot}/.env",
|
||||
"debugOptions": [
|
||||
"WaitOnAbnormalExit",
|
||||
"WaitOnNormalExit",
|
||||
"RedirectOutput"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Attach (Remote Debug)",
|
||||
"type": "python",
|
||||
"request": "attach",
|
||||
"localRoot": "${workspaceRoot}",
|
||||
"remoteRoot": "${workspaceRoot}",
|
||||
"port": 3000,
|
||||
"secret": "my_secret",
|
||||
"host": "localhost"
|
||||
}
|
||||
]
|
||||
}
|
22
main.py
22
main.py
|
@ -36,6 +36,7 @@ class Command(QtCore.QObject):
|
|||
self.args = self.parser.parse_args()
|
||||
|
||||
self.settings = QSettings('settings.ini', QSettings.IniFormat)
|
||||
LoadDefaultSettings(self)
|
||||
|
||||
# load colours as tuples from comma-separated strings
|
||||
self.textColor = core.Core.RGBFromString(self.settings.value("textColor", '255, 255, 255'))
|
||||
|
@ -106,6 +107,8 @@ class Command(QtCore.QObject):
|
|||
self.settings.setValue("textColor", '%s,%s,%s' % self.textColor)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
|
||||
class Main(QtCore.QObject):
|
||||
|
||||
newTask = QtCore.pyqtSignal(str, str, QFont, int, int, int, int, tuple, tuple)
|
||||
|
@ -119,6 +122,8 @@ class Main(QtCore.QObject):
|
|||
self.window = window
|
||||
self.core = core.Core()
|
||||
self.settings = QSettings('settings.ini', QSettings.IniFormat)
|
||||
|
||||
LoadDefaultSettings(self)
|
||||
|
||||
# load colors as tuples from a comma-separated string
|
||||
self.textColor = core.Core.RGBFromString(self.settings.value("textColor", '255, 255, 255'))
|
||||
|
@ -314,6 +319,23 @@ class Main(QtCore.QObject):
|
|||
self.window.lineEdit_visColor.setText(RGBstring)
|
||||
window.pushButton_visColor.setStyleSheet(btnStyle)
|
||||
|
||||
def LoadDefaultSettings(self):
|
||||
default = {
|
||||
"outputWidth": 1280,
|
||||
"outputHeight": 720,
|
||||
"outputFrameRate": 30,
|
||||
"outputAudioCodec": "aac",
|
||||
"outputAudioBitrate": "192k",
|
||||
"outputVideoCodec": "libx264",
|
||||
"outputVideoFormat": "yuv420p",
|
||||
"outputPreset": "medium",
|
||||
"outputFormat": "mp4"
|
||||
}
|
||||
|
||||
for parm, value in default.items():
|
||||
if self.settings.value(parm) == None:
|
||||
self.settings.setValue(parm,value)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
# command line mode
|
||||
app = QtGui.QApplication(sys.argv, False)
|
||||
|
|
|
@ -15,6 +15,7 @@ class Worker(QtCore.QObject):
|
|||
|
||||
def __init__(self, parent=None):
|
||||
QtCore.QObject.__init__(self)
|
||||
self.settings = parent.settings
|
||||
parent.videoTask.connect(self.createVideo)
|
||||
self.core = core.Core()
|
||||
|
||||
|
@ -52,27 +53,27 @@ class Worker(QtCore.QObject):
|
|||
|
||||
# test if user has libfdk_aac
|
||||
encoders = sp.check_output(self.core.FFMPEG_BIN + " -encoders -hide_banner", shell=True)
|
||||
if b'libfdk_aac' in encoders:
|
||||
acodec = self.settings.value('outputAudioCodec')
|
||||
|
||||
if b'libfdk_aac' in encoders and acodec == 'aac':
|
||||
acodec = 'libfdk_aac'
|
||||
else:
|
||||
acodec = 'aac'
|
||||
|
||||
ffmpegCommand = [ self.core.FFMPEG_BIN,
|
||||
'-y', # (optional) means overwrite the output file if it already exists.
|
||||
'-f', 'rawvideo',
|
||||
'-vcodec', 'rawvideo',
|
||||
'-s', '1280x720', # size of one frame
|
||||
'-s', self.settings.value('outputWidth')+'x'+self.settings.value('outputHeight'), # size of one frame
|
||||
'-pix_fmt', 'rgb24',
|
||||
'-r', '30', # frames per second
|
||||
'-r', self.settings.value('outputFrameRate'), # frames per second
|
||||
'-i', '-', # The input comes from a pipe
|
||||
'-an',
|
||||
'-i', inputFile,
|
||||
'-acodec', acodec, # output audio codec
|
||||
'-b:a', "192k",
|
||||
'-vcodec', "libx264",
|
||||
'-pix_fmt', "yuv420p",
|
||||
'-preset', "medium",
|
||||
'-f', "mp4"]
|
||||
'-b:a', self.settings.value('outputAudioBitrate'),
|
||||
'-vcodec', self.settings.value('outputVideoCodec'),
|
||||
'-pix_fmt', self.settings.value('outputVideoFormat'),
|
||||
'-preset', self.settings.value('outputPreset'),
|
||||
'-f', self.settings.value('outputFormat')]
|
||||
|
||||
if acodec == 'aac':
|
||||
ffmpegCommand.append('-strict')
|
||||
|
|
Reference in New Issue