mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 11:19:18 +01:00
Length in smart playlists works again. Fixes issue 1796
This commit is contained in:
parent
071f1f4f7e
commit
4d19917b05
@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "search.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
|
||||
#include <QStringList>
|
||||
@ -89,6 +90,7 @@ QString Search::ToSql(const QString& songs_table) const {
|
||||
} else if (limit_ != -1) {
|
||||
sql += " LIMIT " + QString::number(limit_);
|
||||
}
|
||||
qLog(Debug) << sql;
|
||||
|
||||
return sql;
|
||||
}
|
||||
|
@ -72,6 +72,9 @@ QString SearchTerm::ToSql() const {
|
||||
second_value = QString::number(second_value_.toInt()*7);
|
||||
}
|
||||
}
|
||||
} else if (TypeOf(field_) == Type_Time) {
|
||||
// Convert seconds to nanoseconds
|
||||
value = "CAST (" + value + " *1000000000 AS INTEGER)";
|
||||
}
|
||||
|
||||
switch (operator_) {
|
||||
@ -87,19 +90,22 @@ QString SearchTerm::ToSql() const {
|
||||
if (TypeOf(field_) == Type_Text)
|
||||
return col + " LIKE '" + value + "'";
|
||||
else if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " = " + value + "";
|
||||
else
|
||||
return col + " = '" + value + "'";
|
||||
case Op_GreaterThan:
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " > " + value + "";
|
||||
else
|
||||
return col + " > '" + value + "'";
|
||||
case Op_LessThan:
|
||||
if (TypeOf(field_) == Type_Rating ||
|
||||
TypeOf(field_) == Type_Date)
|
||||
TypeOf(field_) == Type_Date ||
|
||||
TypeOf(field_) == Type_Time)
|
||||
return col + " < " + value + "";
|
||||
else
|
||||
return col + " < '" + value + "'";
|
||||
|
@ -107,6 +107,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
<string notr="true">mm:ss</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user