Adapt to changes in tagparser library
This commit is contained in:
parent
be9ac10372
commit
d31fd79e87
|
@ -103,21 +103,21 @@ void generateFileInfo(const ArgumentOccurrence &, const Argument &inputFileArg,
|
||||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||||
try {
|
try {
|
||||||
// parse tags
|
// parse tags
|
||||||
MediaFileInfo inputFileInfo(inputFileArg.values().front());
|
auto inputFileInfo = MediaFileInfo(std::string(inputFileArg.values().front()));
|
||||||
inputFileInfo.setForceFullParse(validateArg.isPresent());
|
inputFileInfo.setForceFullParse(validateArg.isPresent());
|
||||||
inputFileInfo.open(true);
|
inputFileInfo.open(true);
|
||||||
Diagnostics diag;
|
auto diag = Diagnostics();
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
auto progress = AbortableProgressFeedback(); // FIXME: actually use the progress object
|
||||||
inputFileInfo.parseEverything(diag, progress);
|
inputFileInfo.parseEverything(diag, progress);
|
||||||
|
|
||||||
// generate and save info
|
// generate and save info
|
||||||
Diagnostics diagReparsing;
|
auto diagReparsing = Diagnostics();
|
||||||
(outputFileArg.isPresent() ? cout : cerr) << "Saving file info for \"" << inputFileArg.values().front() << "\" ..." << endl;
|
(outputFileArg.isPresent() ? cout : cerr) << "Saving file info for \"" << inputFileArg.values().front() << "\" ..." << endl;
|
||||||
if (!outputFileArg.isPresent()) {
|
if (!outputFileArg.isPresent()) {
|
||||||
cout << HtmlInfo::generateInfo(inputFileInfo, diag, diagReparsing).data() << endl;
|
cout << HtmlInfo::generateInfo(inputFileInfo, diag, diagReparsing).data() << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QFile file(fromNativeFileName(outputFileArg.values().front()));
|
auto file = QFile(fromNativeFileName(outputFileArg.values().front()));
|
||||||
if (file.open(QFile::WriteOnly) && file.write(HtmlInfo::generateInfo(inputFileInfo, diag, diagReparsing)) && file.flush()) {
|
if (file.open(QFile::WriteOnly) && file.write(HtmlInfo::generateInfo(inputFileInfo, diag, diagReparsing)) && file.flush()) {
|
||||||
cout << "File information has been saved to \"" << outputFileArg.values().front() << "\"." << endl;
|
cout << "File information has been saved to \"" << outputFileArg.values().front() << "\"." << endl;
|
||||||
} else {
|
} else {
|
||||||
|
@ -152,7 +152,7 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||||
try {
|
try {
|
||||||
// parse tags
|
// parse tags
|
||||||
fileInfo.setPath(file);
|
fileInfo.setPath(std::string(file));
|
||||||
fileInfo.open(true);
|
fileInfo.open(true);
|
||||||
fileInfo.parseContainerFormat(diag, progress);
|
fileInfo.parseContainerFormat(diag, progress);
|
||||||
fileInfo.parseEverything(diag, progress);
|
fileInfo.parseEverything(diag, progress);
|
||||||
|
@ -336,7 +336,7 @@ void displayTagInfo(const Argument &fieldsArg, const Argument &showUnsupportedAr
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||||
try {
|
try {
|
||||||
// parse tags
|
// parse tags
|
||||||
fileInfo.setPath(file);
|
fileInfo.setPath(std::string(file));
|
||||||
fileInfo.open(true);
|
fileInfo.open(true);
|
||||||
fileInfo.parseContainerFormat(diag, progress);
|
fileInfo.parseContainerFormat(diag, progress);
|
||||||
fileInfo.parseTags(diag, progress);
|
fileInfo.parseTags(diag, progress);
|
||||||
|
@ -498,7 +498,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
|
|
||||||
// set backup path
|
// set backup path
|
||||||
if (args.backupDirArg.isPresent()) {
|
if (args.backupDirArg.isPresent()) {
|
||||||
fileInfo.setBackupDirectory(args.backupDirArg.values().front());
|
fileInfo.setBackupDirectory(std::string(args.backupDirArg.values().front()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// iterate through all specified files
|
// iterate through all specified files
|
||||||
|
@ -510,7 +510,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
try {
|
try {
|
||||||
// parse tags and tracks (tracks are relevent because track meta-data such as language can be changed as well)
|
// parse tags and tracks (tracks are relevent because track meta-data such as language can be changed as well)
|
||||||
cout << TextAttribute::Bold << "Setting tag information for \"" << file << "\" ..." << Phrases::EndFlush;
|
cout << TextAttribute::Bold << "Setting tag information for \"" << file << "\" ..." << Phrases::EndFlush;
|
||||||
fileInfo.setPath(file);
|
fileInfo.setPath(std::string(file));
|
||||||
fileInfo.parseContainerFormat(diag, parsingProgress);
|
fileInfo.parseContainerFormat(diag, parsingProgress);
|
||||||
fileInfo.parseTags(diag, parsingProgress);
|
fileInfo.parseTags(diag, parsingProgress);
|
||||||
fileInfo.parseTracks(diag, parsingProgress);
|
fileInfo.parseTracks(diag, parsingProgress);
|
||||||
|
@ -808,7 +808,7 @@ void extractField(
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||||
try {
|
try {
|
||||||
// setup media file info
|
// setup media file info
|
||||||
inputFileInfo.setPath(file);
|
inputFileInfo.setPath(std::string(file));
|
||||||
inputFileInfo.open(true);
|
inputFileInfo.open(true);
|
||||||
|
|
||||||
// extract either tag field or attachment
|
// extract either tag field or attachment
|
||||||
|
@ -949,7 +949,7 @@ void exportToJson(const ArgumentOccurrence &, const Argument &filesArg, const Ar
|
||||||
for (const char *file : filesArg.values()) {
|
for (const char *file : filesArg.values()) {
|
||||||
try {
|
try {
|
||||||
// parse tags
|
// parse tags
|
||||||
fileInfo.setPath(file);
|
fileInfo.setPath(std::string(file));
|
||||||
fileInfo.open(true);
|
fileInfo.open(true);
|
||||||
fileInfo.parseContainerFormat(diag, progress);
|
fileInfo.parseContainerFormat(diag, progress);
|
||||||
fileInfo.parseTags(diag, progress);
|
fileInfo.parseTags(diag, progress);
|
||||||
|
|
|
@ -523,7 +523,7 @@ void MainWindow::showSaveAsDlg()
|
||||||
const QString path
|
const QString path
|
||||||
= QFileDialog::getSaveFileName(this, tr("Save changes as - ") + QCoreApplication::applicationName(), m_ui->tagEditorWidget->currentDir());
|
= QFileDialog::getSaveFileName(this, tr("Save changes as - ") + QCoreApplication::applicationName(), m_ui->tagEditorWidget->currentDir());
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
m_ui->tagEditorWidget->fileInfo().setSaveFilePath(toNativeFileName(path).data());
|
m_ui->tagEditorWidget->fileInfo().setSaveFilePath(std::string(toNativeFileName(path).data()));
|
||||||
m_ui->tagEditorWidget->applyEntriesAndSaveChangings();
|
m_ui->tagEditorWidget->applyEntriesAndSaveChangings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,9 +416,9 @@ void PicturePreviewSelection::addOfSelectedType(const QString &path)
|
||||||
assert(m_currentTypeIndex < m_values.size());
|
assert(m_currentTypeIndex < m_values.size());
|
||||||
TagValue &selectedCover = m_values[m_currentTypeIndex];
|
TagValue &selectedCover = m_values[m_currentTypeIndex];
|
||||||
try {
|
try {
|
||||||
MediaFileInfo fileInfo(toNativeFileName(path).constData());
|
auto fileInfo = MediaFileInfo(std::string_view(toNativeFileName(path).constData()));
|
||||||
Diagnostics diag; // FIXME: show diagnostic messages
|
auto diag = Diagnostics(); // FIXME: show diagnostic messages
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
auto progress = AbortableProgressFeedback(); // FIXME: actually use the progress object
|
||||||
fileInfo.open(true);
|
fileInfo.open(true);
|
||||||
fileInfo.parseContainerFormat(diag, progress);
|
fileInfo.parseContainerFormat(diag, progress);
|
||||||
|
|
||||||
|
|
|
@ -823,7 +823,7 @@ bool TagEditorWidget::startParsing(const QString &path, bool forceRefresh)
|
||||||
// set path of file info
|
// set path of file info
|
||||||
m_currentPath = path;
|
m_currentPath = path;
|
||||||
m_fileInfo.setSaveFilePath(string());
|
m_fileInfo.setSaveFilePath(string());
|
||||||
m_fileInfo.setPath(toNativeFileName(path).data());
|
m_fileInfo.setPath(std::string(toNativeFileName(path).data()));
|
||||||
// update file name and directory
|
// update file name and directory
|
||||||
const QFileInfo fileInfo(path);
|
const QFileInfo fileInfo(path);
|
||||||
m_lastDir = m_currentDir;
|
m_lastDir = m_currentDir;
|
||||||
|
|
|
@ -145,7 +145,7 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
|
||||||
{
|
{
|
||||||
Diagnostics diag;
|
Diagnostics diag;
|
||||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||||
MediaFileInfo fileInfo(toNativeFileName(fileName).data());
|
MediaFileInfo fileInfo(std::string(toNativeFileName(fileName).data()));
|
||||||
|
|
||||||
// add basic file information
|
// add basic file information
|
||||||
auto fileInfoObject = m_engine->newObject();
|
auto fileInfoObject = m_engine->newObject();
|
||||||
|
|
|
@ -902,7 +902,7 @@ void CliTests::testExtraction()
|
||||||
TESTUTILS_ASSERT_EXEC(args1);
|
TESTUTILS_ASSERT_EXEC(args1);
|
||||||
Diagnostics diag;
|
Diagnostics diag;
|
||||||
AbortableProgressFeedback progress;
|
AbortableProgressFeedback progress;
|
||||||
MediaFileInfo extractedInfo("/tmp/extracted.jpeg");
|
MediaFileInfo extractedInfo("/tmp/extracted.jpeg"sv);
|
||||||
extractedInfo.open(true);
|
extractedInfo.open(true);
|
||||||
extractedInfo.parseContainerFormat(diag, progress);
|
extractedInfo.parseContainerFormat(diag, progress);
|
||||||
CPPUNIT_ASSERT_EQUAL(static_cast<std::uint64_t>(22771), extractedInfo.size());
|
CPPUNIT_ASSERT_EQUAL(static_cast<std::uint64_t>(22771), extractedInfo.size());
|
||||||
|
|
Loading…
Reference in New Issue