Skip to content

Commit 5180460

Browse files
committed
Rename to Embed Markers as Chapters
and use a temporary file.
1 parent 400da35 commit 5180460

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/jobs/encodejob.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ EncodeJob::EncodeJob(const QString &name,
7272
connect(action, SIGNAL(triggered()), this, SLOT(onSpatialMediaTriggered()));
7373
m_successActions << action;
7474

75-
action = new QAction(tr("Embed Chapters..."), this);
75+
action = new QAction(tr("Embed Markers as Chapters..."), this);
7676
connect(action, SIGNAL(triggered()), this, SLOT(onEmbedChapters()));
7777
m_successActions << action;
7878
}
@@ -255,22 +255,19 @@ void EncodeJob::onEmbedChapters()
255255
result = result.call(args);
256256
if (!result.isError()) {
257257
// Save the result with the export file name.
258-
info = QFileInfo(filePath);
259-
auto metadataFilePath
260-
= QDir(info.absolutePath()).filePath(info.completeBaseName() + ".txt");
261-
QFile f(metadataFilePath);
262-
f.open(QIODevice::WriteOnly | QIODevice::Text);
263-
f.write(result.toString().toUtf8());
264-
f.close();
258+
auto tempFile = Util::writableTemporaryFile(filePath, "shotcut-XXXXXX.txt");
259+
tempFile->write(result.toString().toUtf8());
260+
tempFile->close();
265261

266262
QStringList args;
267-
args << "-i" << objectName() << "-i" << metadataFilePath << "-map_metadata"
263+
args << "-i" << objectName() << "-i" << tempFile->fileName() << "-map_metadata"
268264
<< "1"
269265
<< "-c"
270266
<< "copy"
271267
<< "-y" << filePath;
272268
auto job = new FfmpegJob(filePath, args, false);
273269
job->setLabel(filePath);
270+
tempFile->setParent(job);
274271
JOBS.add(job);
275272
}
276273
} else {

0 commit comments

Comments
 (0)