Allow preserving the muxing/writing application
See https://github.com/Martchus/tageditor/issues/108
This commit is contained in:
parent
1cb00c7c41
commit
f4346fb8e6
|
@ -83,6 +83,8 @@ SetTagInfoArgs::SetTagInfoArgs(Argument &filesArg, Argument &verboseArg, Argumen
|
|||
, backupDirArg("temp-dir", '\0', "specifies the directory for temporary/backup files", { "path" })
|
||||
, layoutOnlyArg("layout-only", 'l', "confirms layout-only changes")
|
||||
, preserveModificationTimeArg("preserve-modification-time", '\0', "preserves the file's modification time")
|
||||
, preserveMuxingAppArg("preserve-muxing-app", '\0', "preserves the file's muxing app meta-data value")
|
||||
, preserveWritingAppArg("preserve-writing-app", '\0', "preserves the file's writing app meta-data value")
|
||||
, jsArg("java-script", 'j', "modifies tag fields via the specified JavaScript", { "path" })
|
||||
, jsSettingsArg("script-settings", '\0', "passes settings to the JavaScript specified via --java-script", { "key=value" })
|
||||
, setTagInfoArg("set", 's', "sets the specified tag information and attachments")
|
||||
|
@ -140,7 +142,7 @@ SetTagInfoArgs::SetTagInfoArgs(Argument &filesArg, Argument &verboseArg, Argumen
|
|||
&id3v2UsageArg, &id3InitOnCreateArg, &id3TransferOnRemovalArg, &mergeMultipleSuccessiveTagsArg, &id3v2VersionArg, &encodingArg,
|
||||
&removeTargetArg, &addAttachmentArg, &updateAttachmentArg, &removeAttachmentArg, &removeExistingAttachmentsArg, &minPaddingArg,
|
||||
&maxPaddingArg, &prefPaddingArg, &tagPosArg, &indexPosArg, &forceRewriteArg, &backupDirArg, &layoutOnlyArg, &preserveModificationTimeArg,
|
||||
&jsArg, &jsSettingsArg, &verboseArg, &pedanticArg, &quietArg, &outputFilesArg });
|
||||
&preserveMuxingAppArg, &preserveWritingAppArg, &jsArg, &jsSettingsArg, &verboseArg, &pedanticArg, &quietArg, &outputFilesArg });
|
||||
}
|
||||
|
||||
} // namespace Cli
|
||||
|
|
|
@ -129,6 +129,8 @@ void restore()
|
|||
v.tagPocessing.autoTagManagement = settings.value(QStringLiteral("autotagmanagement"), v.tagPocessing.autoTagManagement).toBool();
|
||||
v.tagPocessing.preserveModificationTime
|
||||
= settings.value(QStringLiteral("preservemodificationtime"), v.tagPocessing.preserveModificationTime).toBool();
|
||||
v.tagPocessing.preserveMuxingApp = settings.value(QStringLiteral("preservemuxingapp"), v.tagPocessing.preserveMuxingApp).toBool();
|
||||
v.tagPocessing.preserveWritingApp = settings.value(QStringLiteral("preservewritingapp"), v.tagPocessing.preserveWritingApp).toBool();
|
||||
settings.beginGroup(QStringLiteral("id3v1"));
|
||||
switch (settings.value(QStringLiteral("usage"), 0).toInt()) {
|
||||
case 1:
|
||||
|
@ -266,6 +268,8 @@ void save()
|
|||
settings.setValue(QStringLiteral("unsupportedfieldhandling"), static_cast<int>(v.tagPocessing.unsupportedFieldHandling));
|
||||
settings.setValue(QStringLiteral("autotagmanagement"), v.tagPocessing.autoTagManagement);
|
||||
settings.setValue(QStringLiteral("preservemodificationtime"), v.tagPocessing.preserveModificationTime);
|
||||
settings.setValue(QStringLiteral("preservemuxingapp"), v.tagPocessing.preserveMuxingApp);
|
||||
settings.setValue(QStringLiteral("preservewritingapp"), v.tagPocessing.preserveWritingApp);
|
||||
settings.beginGroup(QStringLiteral("id3v1"));
|
||||
settings.setValue(QStringLiteral("usage"), static_cast<int>(v.tagPocessing.creationSettings.id3v1usage));
|
||||
settings.endGroup();
|
||||
|
|
|
@ -80,6 +80,8 @@ struct TagProcessing {
|
|||
UnsupportedFieldHandling unsupportedFieldHandling = UnsupportedFieldHandling::Ignore;
|
||||
bool autoTagManagement = true;
|
||||
bool preserveModificationTime = false;
|
||||
bool preserveMuxingApp = false;
|
||||
bool preserveWritingApp = false;
|
||||
TagParser::TagCreationSettings creationSettings;
|
||||
FileLayout fileLayout;
|
||||
};
|
||||
|
|
|
@ -701,6 +701,12 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
fileInfo.setForceIndexPosition(args.forceIndexPosArg.isPresent());
|
||||
fileInfo.setForceRewrite(args.forceRewriteArg.isPresent());
|
||||
fileInfo.setWritingApplication(APP_NAME " v" APP_VERSION);
|
||||
if (args.preserveMuxingAppArg.isPresent()) {
|
||||
fileInfo.setFileHandlingFlags(fileInfo.fileHandlingFlags() | MediaFileHandlingFlags::PreserveMuxingApplication);
|
||||
}
|
||||
if (args.preserveWritingAppArg.isPresent()) {
|
||||
fileInfo.setFileHandlingFlags(fileInfo.fileHandlingFlags() | MediaFileHandlingFlags::PreserveWritingApplication);
|
||||
}
|
||||
|
||||
// set backup path
|
||||
if (args.backupDirArg.isPresent()) {
|
||||
|
|
|
@ -48,6 +48,8 @@ struct SetTagInfoArgs {
|
|||
CppUtilities::ConfigValueArgument backupDirArg;
|
||||
CppUtilities::ConfigValueArgument layoutOnlyArg;
|
||||
CppUtilities::ConfigValueArgument preserveModificationTimeArg;
|
||||
CppUtilities::ConfigValueArgument preserveMuxingAppArg;
|
||||
CppUtilities::ConfigValueArgument preserveWritingAppArg;
|
||||
CppUtilities::ConfigValueArgument jsArg;
|
||||
CppUtilities::ConfigValueArgument jsSettingsArg;
|
||||
CppUtilities::OperationArgument setTagInfoArg;
|
||||
|
|
|
@ -358,6 +358,8 @@ bool TagProcessingGeneralOptionPage::apply()
|
|||
}
|
||||
settings.autoTagManagement = ui()->autoTagManagementCheckBox->isChecked();
|
||||
settings.preserveModificationTime = ui()->preserveModificationTimeCheckBox->isChecked();
|
||||
settings.preserveMuxingApp = ui()->preserveMuxingAppCheckBox->isChecked();
|
||||
settings.preserveWritingApp = ui()->preserveWritingAppCheckBox->isChecked();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -393,6 +395,8 @@ void TagProcessingGeneralOptionPage::reset()
|
|||
}
|
||||
ui()->autoTagManagementCheckBox->setChecked(settings.autoTagManagement);
|
||||
ui()->preserveModificationTimeCheckBox->setChecked(settings.preserveModificationTime);
|
||||
ui()->preserveMuxingAppCheckBox->setChecked(settings.preserveMuxingApp);
|
||||
ui()->preserveWritingAppCheckBox->setChecked(settings.preserveWritingApp);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1155,7 +1155,8 @@ bool TagEditorWidget::startSaving()
|
|||
m_fileWatcher->removePath(m_currentPath);
|
||||
// use current configuration
|
||||
const auto &settings = Settings::values();
|
||||
const auto &fileLayoutSettings = settings.tagPocessing.fileLayout;
|
||||
const auto &generalSettings = settings.tagPocessing;
|
||||
const auto &fileLayoutSettings = generalSettings.fileLayout;
|
||||
m_fileInfo.setForceRewrite(fileLayoutSettings.forceRewrite);
|
||||
m_fileInfo.setTagPosition(fileLayoutSettings.preferredTagPosition);
|
||||
m_fileInfo.setForceTagPosition(fileLayoutSettings.forceTagPosition);
|
||||
|
@ -1165,6 +1166,12 @@ bool TagEditorWidget::startSaving()
|
|||
m_fileInfo.setMaxPadding(fileLayoutSettings.maxPadding);
|
||||
m_fileInfo.setPreferredPadding(fileLayoutSettings.preferredPadding);
|
||||
m_fileInfo.setBackupDirectory(settings.editor.backupDirectory);
|
||||
if (generalSettings.preserveMuxingApp) {
|
||||
m_fileInfo.setFileHandlingFlags(m_fileInfo.fileHandlingFlags() | MediaFileHandlingFlags::PreserveMuxingApplication);
|
||||
}
|
||||
if (generalSettings.preserveWritingApp) {
|
||||
m_fileInfo.setFileHandlingFlags(m_fileInfo.fileHandlingFlags() | MediaFileHandlingFlags::PreserveWritingApplication);
|
||||
}
|
||||
const auto startThread = [this, preserveModificationTime = settings.tagPocessing.preserveModificationTime] {
|
||||
// define functions to show the saving progress and to actually applying the changes
|
||||
auto showPercentage([this](AbortableProgressFeedback &progress) {
|
||||
|
|
|
@ -139,6 +139,29 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="preserveMuxingAppCheckBox">
|
||||
<property name="text">
|
||||
<string>Preserve muxing application</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="preserveWritingAppCheckBox">
|
||||
<property name="text">
|
||||
<string>Preserve writing application</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in New Issue