mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
Merge branch 'master' into hotfix/PYPE-641-nk-nks-small-fixes
This commit is contained in:
commit
f9ddd368ea
2 changed files with 41 additions and 9 deletions
|
|
@ -62,9 +62,12 @@ class VersionToTaskStatus(BaseEvent):
|
||||||
|
|
||||||
# Lower version status name and check if has mapping
|
# Lower version status name and check if has mapping
|
||||||
version_status = version_status_orig.lower()
|
version_status = version_status_orig.lower()
|
||||||
new_status_names = status_mapping.get(version_status)
|
new_status_names = []
|
||||||
if not new_status_names:
|
mapped = status_mapping.get(version_status)
|
||||||
continue
|
if mapped:
|
||||||
|
new_status_names.extend(list(mapped))
|
||||||
|
|
||||||
|
new_status_names.append(version_status)
|
||||||
|
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"Processing AssetVersion status change: [ {} ]".format(
|
"Processing AssetVersion status change: [ {} ]".format(
|
||||||
|
|
@ -72,10 +75,6 @@ class VersionToTaskStatus(BaseEvent):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Backwards compatibility (convert string to list)
|
|
||||||
if isinstance(new_status_names, str):
|
|
||||||
new_status_names = [new_status_names]
|
|
||||||
|
|
||||||
# Lower all names from presets
|
# Lower all names from presets
|
||||||
new_status_names = [name.lower() for name in new_status_names]
|
new_status_names = [name.lower() for name in new_status_names]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
import subprocess
|
||||||
|
import json
|
||||||
import opentimelineio_contrib.adapters.ffmpeg_burnins as ffmpeg_burnins
|
import opentimelineio_contrib.adapters.ffmpeg_burnins as ffmpeg_burnins
|
||||||
from pypeapp.lib import config
|
from pypeapp.lib import config
|
||||||
from pype import api as pype
|
from pype import api as pype
|
||||||
|
|
@ -9,6 +11,34 @@ from pype import api as pype
|
||||||
log = pype.Logger().get_logger("BurninWrapper", "burninwrap")
|
log = pype.Logger().get_logger("BurninWrapper", "burninwrap")
|
||||||
|
|
||||||
|
|
||||||
|
ffmpeg_path = os.environ.get("FFMPEG_PATH")
|
||||||
|
if ffmpeg_path and os.path.exists(ffmpeg_path):
|
||||||
|
# add separator "/" or "\" to be prepared for next part
|
||||||
|
ffmpeg_path += os.path.sep
|
||||||
|
else:
|
||||||
|
ffmpeg_path = ""
|
||||||
|
|
||||||
|
FFMPEG = (
|
||||||
|
'{} -loglevel panic -i %(input)s %(filters)s %(args)s%(output)s'
|
||||||
|
).format(os.path.normpath(ffmpeg_path + "ffmpeg"))
|
||||||
|
FFPROBE = (
|
||||||
|
'{} -v quiet -print_format json -show_format -show_streams %(source)s'
|
||||||
|
).format(os.path.normpath(ffmpeg_path + "ffprobe"))
|
||||||
|
|
||||||
|
|
||||||
|
def _streams(source):
|
||||||
|
"""Reimplemented from otio burnins to be able use full path to ffprobe
|
||||||
|
:param str source: source media file
|
||||||
|
:rtype: [{}, ...]
|
||||||
|
"""
|
||||||
|
command = FFPROBE % {'source': source}
|
||||||
|
proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE)
|
||||||
|
out = proc.communicate()[0]
|
||||||
|
if proc.returncode != 0:
|
||||||
|
raise RuntimeError("Failed to run: %s" % command)
|
||||||
|
return json.loads(out)['streams']
|
||||||
|
|
||||||
|
|
||||||
class ModifiedBurnins(ffmpeg_burnins.Burnins):
|
class ModifiedBurnins(ffmpeg_burnins.Burnins):
|
||||||
'''
|
'''
|
||||||
This is modification of OTIO FFmpeg Burnin adapter.
|
This is modification of OTIO FFmpeg Burnin adapter.
|
||||||
|
|
@ -61,6 +91,9 @@ class ModifiedBurnins(ffmpeg_burnins.Burnins):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, source, streams=None, options_init=None):
|
def __init__(self, source, streams=None, options_init=None):
|
||||||
|
if not streams:
|
||||||
|
streams = _streams(source)
|
||||||
|
|
||||||
super().__init__(source, streams)
|
super().__init__(source, streams)
|
||||||
if options_init:
|
if options_init:
|
||||||
self.options_init.update(options_init)
|
self.options_init.update(options_init)
|
||||||
|
|
@ -187,7 +220,7 @@ class ModifiedBurnins(ffmpeg_burnins.Burnins):
|
||||||
if self.filter_string:
|
if self.filter_string:
|
||||||
filters = '-vf "{}"'.format(self.filter_string)
|
filters = '-vf "{}"'.format(self.filter_string)
|
||||||
|
|
||||||
return (ffmpeg_burnins.FFMPEG % {
|
return (FFMPEG % {
|
||||||
'input': self.source,
|
'input': self.source,
|
||||||
'output': output,
|
'output': output,
|
||||||
'args': '%s ' % args if args else '',
|
'args': '%s ' % args if args else '',
|
||||||
|
|
@ -368,7 +401,7 @@ def burnins_from_data(input_path, codec_data, output_path, data, overwrite=True)
|
||||||
codec_args = ''
|
codec_args = ''
|
||||||
if codec_data is not []:
|
if codec_data is not []:
|
||||||
codec_args = " ".join(codec_data)
|
codec_args = " ".join(codec_data)
|
||||||
|
|
||||||
burnin.render(output_path, args=codec_args, overwrite=overwrite)
|
burnin.render(output_path, args=codec_args, overwrite=overwrite)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue