Skip to content

Commit 153e3d2

Browse files
committed
fixed files being created when unchecked but had previously been checked
1 parent d6799f7 commit 153e3d2

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

chapter-marker-dock.cpp

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,10 @@ void ChapterMarkerDock::saveIgnoredScenes()
902902
//--------------------FILE MANAGEMENT--------------------
903903
void ChapterMarkerDock::createExportFiles()
904904
{
905+
if (!exportChaptersToFileEnabled) {
906+
return;
907+
}
908+
905909
obs_output_t *output = obs_frontend_get_recording_output();
906910
if (!output) {
907911
blog(LOG_ERROR, "[StreamUP Record Chapter Manager] Could not get the recording output.");
@@ -966,14 +970,15 @@ void ChapterMarkerDock::createExportFiles()
966970
}
967971
}
968972

973+
969974
void ChapterMarkerDock::setExportTextFilePath(const QString &filePath)
970975
{
971976
exportTextFilePath = filePath;
972977
}
973978

974979
void ChapterMarkerDock::writeChapterToTextFile(const QString &chapterName, const QString &timestamp, const QString &chapterSource)
975980
{
976-
if (!exportChaptersToTextEnabled || !exportChaptersToFileEnabled) {
981+
if (!exportChaptersToFileEnabled || !exportChaptersToTextEnabled) {
977982
return;
978983
}
979984

@@ -1003,31 +1008,29 @@ void ChapterMarkerDock::setExportXMLFilePath(const QString &filePath)
10031008

10041009
void ChapterMarkerDock::writeChapterToXMLFile(const QString &chapterName, const QString &timestamp, const QString &chapterSource)
10051010
{
1006-
if (!exportChaptersToXMLEnabled || !exportChaptersToFileEnabled) {
1011+
if (!exportChaptersToFileEnabled || !exportChaptersToXMLEnabled) {
10071012
return;
10081013
}
10091014

10101015
if (exportXMLFilePath.isEmpty()) {
1011-
blog(LOG_ERROR, "[StreamUP Record Chapter Manager] Chapter file path is not set, creating a new file.");
1016+
blog(LOG_ERROR, "[StreamUP Record Chapter Manager] XML file path is not set, creating a new file.");
10121017
createExportFiles();
10131018
return;
10141019
}
10151020

1016-
QString fullChapterName = chapterName;
1017-
1018-
if (addChapterSourceEnabled && !chapterName.contains(chapterSource)) {
1019-
fullChapterName += " (" + chapterSource + ")";
1020-
}
1021-
1022-
QString content = QString("<Chapter>\n"
1023-
" <Timestamp>%1</Timestamp>\n"
1024-
" <Name>%2</Name>\n"
1025-
"</Chapter>\n")
1026-
.arg(timestamp, fullChapterName);
1027-
1028-
if (!writeToFile(exportXMLFilePath, content)) {
1021+
QFile file(exportXMLFilePath);
1022+
if (!file.open(QIODevice::Append | QIODevice::Text)) {
10291023
blog(LOG_ERROR, "[StreamUP Record Chapter Manager] Failed to open XML file: %s", QT_TO_UTF8(exportXMLFilePath));
1024+
return;
10301025
}
1026+
1027+
QTextStream out(&file);
1028+
out << " <Chapter>\n";
1029+
out << " <Name>" << chapterName << "</Name>\n";
1030+
out << " <Timestamp>" << timestamp << "</Timestamp>\n";
1031+
out << " <Source>" << chapterSource << "</Source>\n";
1032+
out << " </Chapter>\n";
1033+
file.close();
10311034
}
10321035

10331036
void ChapterMarkerDock::writeAnnotationToFiles(const QString &annotationText, const QString &timestamp,

0 commit comments

Comments
 (0)