mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-07 14:43:37 +01:00
library: Add option to ignore files by extension
Add a new skip option in library settings that takes a comma separated list of file extensions. Skip files with the specified extensions when scanning the library.
This commit is contained in:
parent
cef1d7e745
commit
3bd15aea0d
@ -98,6 +98,10 @@ void LibrarySettingsPage::Save() {
|
||||
QStringList filters = filter_text.split(',', QString::SkipEmptyParts);
|
||||
s.setValue("cover_art_patterns", filters);
|
||||
|
||||
QString skip_extensions = ui_->skip_extensions->text();
|
||||
QStringList extensions = skip_extensions.split(',', QString::SkipEmptyParts);
|
||||
s.setValue("skip_file_extensions", extensions);
|
||||
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(LibraryBackend::kSettingsGroup);
|
||||
@ -139,6 +143,9 @@ void LibrarySettingsPage::Load() {
|
||||
.toStringList();
|
||||
ui_->cover_art_patterns->setText(filters.join(","));
|
||||
|
||||
QStringList extensions = s.value("skip_file_extensions").toStringList();
|
||||
ui_->skip_extensions->setText(extensions.join(","));
|
||||
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup(LibraryBackend::kSettingsGroup);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>509</width>
|
||||
<height>452</height>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -137,7 +137,17 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="skip_extensions_label">
|
||||
<property name="text">
|
||||
<string>Skip files with these extensions (comma separated, case insensitive)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="skip_extensions"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="cover_art_patterns_label">
|
||||
<property name="text">
|
||||
<string>Preferred album art filenames (comma separated)</string>
|
||||
</property>
|
||||
|
@ -330,10 +330,12 @@ void LibraryWatcher::ScanSubdirectory(const QString& path,
|
||||
QString ext_part(ExtensionPart(child));
|
||||
QString dir_part(DirectoryPart(child));
|
||||
|
||||
if (sValidImages.contains(ext_part))
|
||||
album_art[dir_part] << child;
|
||||
else if (!child_info.isHidden())
|
||||
files_on_disk << child;
|
||||
if (!skip_file_extensions_.contains(ext_part)) {
|
||||
if (sValidImages.contains(ext_part))
|
||||
album_art[dir_part] << child;
|
||||
else if (!child_info.isHidden())
|
||||
files_on_disk << child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -832,6 +834,13 @@ void LibraryWatcher::ReloadSettings() {
|
||||
if (!s.isEmpty()) best_image_filters_ << s;
|
||||
}
|
||||
|
||||
skip_file_extensions_.clear();
|
||||
QStringList extensions = s.value("skip_file_extensions").toStringList();
|
||||
for (const QString& extension : extensions) {
|
||||
QString s = extension.trimmed().toLower();
|
||||
if (!s.isEmpty()) skip_file_extensions_ << s;
|
||||
}
|
||||
|
||||
if (!monitor_ && was_monitoring_before) {
|
||||
fs_watcher_->Clear();
|
||||
} else if (monitor_ && !was_monitoring_before) {
|
||||
|
@ -217,6 +217,9 @@ class LibraryWatcher : public QObject {
|
||||
*/
|
||||
QStringList best_image_filters_;
|
||||
|
||||
// List of file extensions that should be ingored during a scan.
|
||||
QStringList skip_file_extensions_;
|
||||
|
||||
bool scan_on_startup_;
|
||||
bool monitor_;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user