Commit 06c14aee authored by Julius Künzel's avatar Julius Künzel
Browse files

[OTIO] Differentiate between read and write adapters

BUG: 448318
parent 315e3bb3
Pipeline #124452 passed with stage
in 5 minutes and 18 seconds
......@@ -9,6 +9,8 @@ import pkg_resources
def print_help():
print("""
THIS SCRIPT IS PART OF KDENLIVE (www.kdenlive.org)
Usage: python3 checkpackages.py [mode] [packages]
Where [packages] is a list of python package names separated by blank space
......@@ -34,9 +36,8 @@ for arg in sys.argv[1:]:
required.add(arg)
if len(required) == 0:
print("Error: You need to provide at least one package name")
print_help()
sys.exit()
sys.exit("Error: You need to provide at least one package name")
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
......@@ -57,5 +58,5 @@ elif '--details' in sys.argv:
python = sys.executable
subprocess.check_call([python, '-m', 'pip', 'show', *required])
else:
print("Error: You need to provide a mode")
print_help()
sys.exit("Error: You need to provide a mode")
# SPDX-FileCopyrightText: 2019 Vincent Pinon <vpinon@kde.org>
# SPDX-FileCopyrightText: 2022 Julius Künzel <jk.kdedev@smartlab.uber.space>
# SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
from opentimelineio import *
import sys
import opentimelineio as otio
for a in plugins.ActiveManifest().adapters:
if a.has_feature('read') and a.has_feature('write'):
print('*.'+' *.'.join(a.suffixes), end=' ')
def print_help():
print("""
THIS SCRIPT IS PART OF KDENLIVE (www.kdenlive.org)
Usage: python3 otiointerface.py [options]
Where [options] is at least one of the following:
--export-suffixes print out file suffixes of all otio adapters that can be used for export (support write)
--import-suffixes print out file suffixes of all otio adapters that can be used for import (support read)
""")
if '--help' in sys.argv:
print_help()
sys.exit()
use_read = False
use_write = False
if '--export-suffixes' in sys.argv:
use_write = True
if '--import-suffixes' in sys.argv:
use_read = True
if not use_read and not use_write:
print_help()
sys.exit("Error: You need to provide at least one valid option")
suffixes = otio.adapters.suffixes_with_defined_adapters(
read=use_read, write=use_write
)
print('*.'+' *.'.join(sorted(suffixes)), end=' ')
......@@ -26,9 +26,11 @@ OtioConvertions::OtioConvertions()
"listed in PATH environment variable"));
return;
}
m_adapters = runScript(QStringLiteral("otiointerface.py"), {});
qInfo() << "OTIO adapters:" << m_adapters;
if (!m_adapters.contains("kdenlive")) {
m_importAdapters = runScript(QStringLiteral("otiointerface.py"), {"--import-suffixes"});
qInfo() << "OTIO import adapters:" << m_importAdapters;
m_exportAdapters = runScript(QStringLiteral("otiointerface.py"), {"--export-suffixes"});
qInfo() << "OTIO export adapters:" << m_exportAdapters;
if (!(m_exportAdapters.contains("kdenlive") && m_importAdapters.contains("kdenlive"))) {
emit setupError(i18n("Your OpenTimelineIO module does not include Kdenlive adapter.\n"
"Please install version >= 0.12\n"));
}
......@@ -38,7 +40,9 @@ OtioConvertions::OtioConvertions()
bool OtioConvertions::wellConfigured()
{
checkDependencies();
return checkSetup() && missingDependencies().isEmpty() && !m_adapters.isEmpty() && m_adapters.contains("kdenlive");
return checkSetup() && missingDependencies().isEmpty()
&& !m_importAdapters.isEmpty() && m_importAdapters.contains("kdenlive")
&& !m_exportAdapters.isEmpty() && m_exportAdapters.contains("kdenlive");
}
bool OtioConvertions::configureSetup()
......@@ -94,7 +98,7 @@ void OtioConvertions::slotExportProject()
QString exportFile = QFileDialog::getSaveFileName(
pCore->window(), i18n("Export Project"),
pCore->currentDoc()->projectDataFolder(),
i18n("OpenTimelineIO adapters (%1)(%1)", m_adapters));
i18n("OpenTimelineIO adapters (%1)(%1)", m_exportAdapters));
if (exportFile.isNull()) {
return;
}
......@@ -125,7 +129,7 @@ void OtioConvertions::slotImportProject()
QString importFile = QFileDialog::getOpenFileName(
pCore->window(), i18n("Project to import"),
pCore->currentDoc()->projectDataFolder(),
i18n("OpenTimelineIO adapters (%1)(%1)", m_adapters));
i18n("OpenTimelineIO adapters (%1)(%1)", m_importAdapters));
if (importFile.isNull() || !QFile::exists(importFile)) {
return;
}
......
......@@ -26,7 +26,8 @@ public:
bool runOtioconvert(const QString &inputFile, const QString &outputFile);
private:
QString m_adapters;
QString m_importAdapters;
QString m_exportAdapters;
public slots:
void slotExportProject();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment