From 58f0265365114a8241260d137833437cee3d400b Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 3 Nov 2018 10:48:38 +0100 Subject: Move fuzzyCheck to Helper namespace --- helper.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index 88b243d..b1f277b 100644 --- a/helper.cpp +++ b/helper.cpp @@ -384,6 +384,20 @@ namespace Helper { return PicData(); } + QStringList fuzzyCheck(const QString &subtitle){ + QStringList retval; + QSqlDatabase db = QSqlDatabase::database("treedb"); + db.open(); + QSqlQuery fuzzyQ(db); + fuzzyQ.prepare("SELECT tsubtitle FROM seriesparts WHERE regexp_replace(tsubtitle, '[ .,''!-]', '', 'g') = lower(regexp_replace(:st, '[ .,''!-]', '', 'g'))"); + fuzzyQ.bindValue(":st", subtitle); + fuzzyQ.exec(); + while(fuzzyQ.next()){ + retval << fuzzyQ.value(0).toString(); + } + return retval; + } + Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {} Duration::Duration(qint64 seconds){ -- cgit v1.2.3-70-g09d2