settings: Add option to guess song metadata

Add "Try to guess missing metadata" option to the Song Metadata page
that controls the setting in SongPathParser.
This commit is contained in:
Jim Broadus 2021-05-17 11:17:29 -07:00 committed by John Maguire
parent cf88e47206
commit 776bd3b022
4 changed files with 32 additions and 0 deletions

View File

@ -58,6 +58,8 @@ TagReaderClient::~TagReaderClient() {}
void TagReaderClient::Start() { worker_pool_->Start(); }
void TagReaderClient::ReloadSettings() { path_parser_->ReloadSettings(); }
void TagReaderClient::WorkerFailedToStart() {
qLog(Error) << "The" << kWorkerExecutableName << "executable was not found"
<< "in the current directory or on the PATH. Clementine will"

View File

@ -47,6 +47,7 @@ class TagReaderClient : public QObject {
static const char* kWorkerExecutableName;
void Start();
void ReloadSettings();
ReplyType* ReadFile(const QString& filename);
ReplyType* SaveFile(const QString& filename, const Song& metadata);

View File

@ -21,6 +21,8 @@
#include <QThread>
#include "core/player.h"
#include "core/songpathparser.h"
#include "core/tagreaderclient.h"
#include "ui/iconloader.h"
#include "ui_songmetadatasettingspage.h"
@ -52,6 +54,14 @@ void SongMetadataSettingsPage::Load() {
QString::number(max_numprocs_tagclients));
s.endGroup();
s.beginGroup(SongPathParser::kSongMetadataSettingsGroup);
bool guess = s.value(SongPathParser::kGuessMetadataSetting,
SongPathParser::kGuessMetadataSettingDefault)
.toBool();
ui_->guess_metadata->setCheckState(guess ? Qt::Checked : Qt::Unchecked);
s.endGroup();
}
void SongMetadataSettingsPage::Save() {
@ -61,6 +71,15 @@ void SongMetadataSettingsPage::Save() {
s.setValue("max_numprocs_tagclients", ui_->max_numprocs_tagclients->value());
s.endGroup();
s.beginGroup(SongPathParser::kSongMetadataSettingsGroup);
s.setValue(SongPathParser::kGuessMetadataSetting,
ui_->guess_metadata->checkState() != Qt::Unchecked);
s.endGroup();
TagReaderClient::Instance()->ReloadSettings();
}
void SongMetadataSettingsPage::MaxNumProcsTagClientsChanged(int value) {

View File

@ -56,6 +56,16 @@
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="guess_metadata">
<property name="toolTip">
<string>Try to extract title, artist, and album from file path.</string>
</property>
<property name="text">
<string>Try to guess missing metadata</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">