SmartPlaylistSearchTerm: Fix filetype search

This commit is contained in:
Jonas Kvinge 2022-04-19 23:10:46 +02:00
parent 83d762287f
commit 3f3ae7c38f
1 changed files with 10 additions and 1 deletions

View File

@ -38,9 +38,18 @@ QString SmartPlaylistSearchTerm::ToSql() const {
QString col = FieldColumnName(field_);
QString date = DateName(date_, true);
QString value = value_.toString();
QString value;
value.replace('\'', "''");
value = value_.toString();
if (field_ == Field_Filetype) {
Song::FileType filetype = Song::FiletypeByExtension(value);
if (filetype == Song::FileType_Unknown) {
filetype = Song::FiletypeByDescription(value);
}
value = QString::number(static_cast<int>(filetype));
}
QString second_value;
bool special_date_query = (operator_ == SmartPlaylistSearchTerm::Op_NumericDate ||