Suppress "field not supported" for ID3v1 fields if writing ID3v2 as well
This commit is contained in:
parent
27a1d6b81e
commit
0e36eec6c7
|
@ -675,6 +675,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
diag.emplace_back(DiagLevel::Critical, "Can not create appropriate tags for file.", context);
|
diag.emplace_back(DiagLevel::Critical, "Can not create appropriate tags for file.", context);
|
||||||
} else {
|
} else {
|
||||||
// iterate through all tags
|
// iterate through all tags
|
||||||
|
const auto willWriteAnId3v2Tag = fileInfo.hasId3v2Tag();
|
||||||
for (auto *tag : tags) {
|
for (auto *tag : tags) {
|
||||||
// clear current values if option is present
|
// clear current values if option is present
|
||||||
if (args.removeOtherFieldsArg.isPresent()) {
|
if (args.removeOtherFieldsArg.isPresent()) {
|
||||||
|
@ -781,10 +782,12 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
argsToString("An IO error occurred when parsing the specified file \"", path, "\": ", e.what()), context);
|
argsToString("An IO error occurred when parsing the specified file \"", path, "\": ", e.what()), context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// finally set the values
|
// finally set/clear the values
|
||||||
try {
|
try {
|
||||||
|
// add error if field is not supported unless it is just ID3v1 and we are writing an ID3v2 tag as well
|
||||||
if ((!convertedValues.empty() || convertedId3v2CoverValues.empty())
|
if ((!convertedValues.empty() || convertedId3v2CoverValues.empty())
|
||||||
&& !denotedScope.field.setValues(tag, tagType, convertedValues)) {
|
&& !denotedScope.field.setValues(tag, tagType, convertedValues)
|
||||||
|
&& (tagType != TagType::Id3v1Tag || !willWriteAnId3v2Tag)) {
|
||||||
diag.emplace_back(DiagLevel::Critical,
|
diag.emplace_back(DiagLevel::Critical,
|
||||||
argsToString("Unable set field \"", denotedScope.field.name(), "\": setting field is not supported"), context);
|
argsToString("Unable set field \"", denotedScope.field.name(), "\": setting field is not supported"), context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,7 +259,7 @@ void CliTests::testModifyingCover()
|
||||||
const auto lyrics = "lyrics>=" + lyricsFile;
|
const auto lyrics = "lyrics>=" + lyricsFile;
|
||||||
const char *const args1[] = { "tageditor", "get", "-f", mp3File1.data(), nullptr };
|
const char *const args1[] = { "tageditor", "get", "-f", mp3File1.data(), nullptr };
|
||||||
const char *const args2[] = { "tageditor", "set", otherCover.data(), frontCover0.data(), frontCover1.data(), backCover0.data(), lyrics.data(),
|
const char *const args2[] = { "tageditor", "set", otherCover.data(), frontCover0.data(), frontCover1.data(), backCover0.data(), lyrics.data(),
|
||||||
"-f", mp3File1.data(), nullptr };
|
"--pedantic", "-f", mp3File1.data(), nullptr };
|
||||||
CPPUNIT_ASSERT_EQUAL(0, execApp(args2, stdout, stderr));
|
CPPUNIT_ASSERT_EQUAL(0, execApp(args2, stdout, stderr));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, execApp(args1, stdout, stderr));
|
CPPUNIT_ASSERT_EQUAL(0, execApp(args1, stdout, stderr));
|
||||||
CPPUNIT_ASSERT_MESSAGE("covers added",
|
CPPUNIT_ASSERT_MESSAGE("covers added",
|
||||||
|
|
Loading…
Reference in New Issue