15 query.
prepare(
"SELECT * FROM internetcontent WHERE "
16 "commandline = :COMMAND AND host = :HOST "
17 "AND type = :TYPE AND tree = 1;");
18 QFileInfo fi(commandline);
19 query.
bindValue(
":COMMAND", fi.fileName());
28 return query.
size() > 0;
35 query.
prepare(
"SELECT * FROM internetcontent WHERE "
36 "commandline = :COMMAND AND host = :HOST "
37 "AND type = :TYPE AND search = 1;");
38 QFileInfo fi(commandline);
39 query.
bindValue(
":COMMAND", fi.fileName());
48 return query.
size() > 0;
55 query.
prepare(
"SELECT name,thumbnail,author,description,commandline,"
56 "version,search,tree FROM internetcontent "
57 "WHERE commandline = :COMMAND AND "
58 "host = :HOST AND type = :TYPE "
60 QFileInfo fi(commandline);
61 query.
bindValue(
":COMMAND", fi.fileName());
68 QString title = query.
value(0).toString();
69 QString image = query.
value(1).toString();
70 QString author = query.
value(2).toString();
71 QString desc = query.
value(3).toString();
72 QString command = QString(
"%1/internetcontent/%2")
74 double ver = query.
value(5).toDouble();
75 bool search = query.
value(6).toBool();
76 bool tree = query.
value(7).toBool();
79 tree, desc, command, ver);
87 query.
prepare(
"SELECT name,thumbnail,author,description,commandline,"
88 "version,search,tree FROM internetcontent "
89 "WHERE commandline = :COMMAND AND "
90 "type = :TYPE AND host = :HOST AND "
92 QFileInfo fi(commandline);
93 query.
bindValue(
":COMMAND", fi.fileName());
100 QString title = query.
value(0).toString();
101 QString image = query.
value(1).toString();
102 QString author = query.
value(2).toString();
103 QString desc = query.
value(3).toString();
104 QString command = QString(
"%1/internetcontent/%2")
106 double ver = query.
value(5).toDouble();
107 bool search = query.
value(6).toBool();
108 bool tree = query.
value(7).toBool();
111 tree, desc, command, ver);
118 query.
prepare(
"SELECT DISTINCT name,thumbnail,type,"
119 "author,description,commandline,"
120 "version,search,tree FROM internetcontent "
121 "where tree = 1 ORDER BY name;");
130 QString title = query.
value(0).toString();
131 QString image = query.
value(1).toString();
133 QString author = query.
value(3).toString();
134 QString desc = query.
value(4).toString();
135 QString commandline = QString(
"%1/internetcontent/%2")
137 double ver = query.
value(6).toDouble();
138 bool search = query.
value(7).toBool();
139 bool tree = query.
value(8).toBool();
142 tree, desc, commandline, ver);
152 query.
prepare(
"SELECT name,thumbnail,author,description,commandline,"
153 "version,search,tree FROM internetcontent "
154 "WHERE host = :HOST AND type = :TYPE "
155 "AND tree = 1 ORDER BY name;");
166 QString title = query.
value(0).toString();
167 QString image = query.
value(1).toString();
168 QString author = query.
value(2).toString();
169 QString desc = query.
value(3).toString();
170 QString commandline = QString(
"%1/internetcontent/%2")
172 double ver = query.
value(5).toDouble();
173 bool search = query.
value(6).toBool();
174 bool tree = query.
value(7).toBool();
177 tree, desc, commandline, ver);
187 query.
prepare(
"SELECT name,thumbnail,author,description,commandline,"
188 "version,search,tree FROM internetcontent "
189 "WHERE host = :HOST AND type = :TYPE "
190 "AND search = 1 ORDER BY name;");
201 QString title = query.
value(0).toString();
202 QString image = query.
value(1).toString();
203 QString author = query.
value(2).toString();
204 QString desc = query.
value(3).toString();
205 QString commandline = QString(
"%1/internetcontent/%2")
207 double ver = query.
value(5).toDouble();
208 bool search = query.
value(6).toBool();
209 bool tree = query.
value(7).toBool();
212 tree, desc, commandline, ver);
243 const QString &description,
const QString &commandline,
244 const double version,
bool search,
bool tree,
247 QFileInfo fi(thumbnail);
248 QString thumbbase = fi.fileName();
251 query.
prepare(
"INSERT INTO internetcontent (name,thumbnail,type,author,"
252 "description,commandline,version,search,tree,podcast,"
254 "VALUES( :NAME, :THUMBNAIL, :TYPE, :AUTHOR, :DESCRIPTION, :COMMAND, "
255 ":VERSION, :SEARCH, :TREE, :PODCAST, :HOST);");
257 query.
bindValue(
":THUMBNAIL", thumbbase);
260 query.
bindValue(
":DESCRIPTION", description);
261 QFileInfo cmd(commandline);
262 query.
bindValue(
":COMMAND", cmd.fileName());
278 if (!script)
return false;
285 if (!script)
return false;
295 query.
prepare(
"DELETE FROM internetcontent WHERE commandline = :COMMAND "
296 "AND host = :HOST AND search = 1;");
300 query.
prepare(
"DELETE FROM internetcontent WHERE commandline = :COMMAND "
301 "AND host = :HOST AND search = 0;");
303 QFileInfo fi(commandline);
304 query.
bindValue(
":COMMAND", fi.fileName());
317 query.
prepare(
"UPDATE internetcontent SET updated = :UPDATED "
318 "WHERE commandline = :COMMAND AND tree = 1;");
321 query.
bindValue(
":COMMAND", fi.fileName());
335 return then.addSecs(duration_cast<std::chrono::seconds>(updateFreq).count()) < now;
342 query.
prepare(
"SELECT updated "
343 "FROM internetcontent "
344 "WHERE commandline = :COMMAND ORDER "
345 "BY updated DESC LIMIT 1;");
347 query.
bindValue(
":COMMAND", fi.fileName());
352 else if (query.
next())
362 if (feedcommand.isEmpty())
366 query.
prepare(
"DELETE FROM internetcontentarticles "
367 "WHERE feedtitle = :FEEDTITLE AND podcast = 0;");
368 query.
bindValue(
":FEEDTITLE", feedcommand);
381 if (feedcommand.isEmpty())
385 query.
prepare(
"SELECT * FROM internetcontent "
386 "WHERE commandline = :COMMAND;");
387 QFileInfo fi(feedcommand);
388 query.
bindValue(
":COMMAND", fi.fileName());
403 if (!item || feedtitle.isEmpty() || path.isEmpty())
407 query.
prepare(
"INSERT INTO internetcontentarticles (feedtitle, path, paththumb, "
408 " title, subtitle, description, url, type, thumbnail, mediaURL, author, "
409 "date, time, rating, filesize, player, playerargs, download, "
410 "downloadargs, width, height, language, podcast, downloadable, "
411 "customhtml, countries, season, episode) "
412 "VALUES( :FEEDTITLE, :PATH, :PATHTHUMB, :TITLE, :SUBTITLE, :DESCRIPTION, "
413 ":URL, :TYPE, :THUMBNAIL, :MEDIAURL, :AUTHOR, :DATE, :TIME, :RATING, "
414 ":FILESIZE, :PLAYER, :PLAYERARGS, :DOWNLOAD, :DOWNLOADARGS, :WIDTH, :HEIGHT, "
415 ":LANGUAGE, :PODCAST, :DOWNLOADABLE, :CUSTOMHTML, :COUNTRIES, :SEASON, "
417 query.
bindValue(
":FEEDTITLE", feedtitle);
419 query.
bindValue(
":PATHTHUMB", paththumb);
431 time = QString::number(0);
466 QMultiMap<QPair<QString,QString>,
ResultItem*> ret;
469 query.
prepare(
"SELECT title, subtitle, description, url, "
470 "type, thumbnail, mediaURL, author, date, time, "
471 "rating, filesize, player, playerargs, download, "
472 "downloadargs, width, height, language, "
473 "downloadable, customhtml, countries, season, episode, "
474 "path, paththumb FROM internetcontentarticles "
475 "WHERE feedtitle = :FEEDTITLE AND podcast = 0 "
476 "AND type = :TYPE ORDER BY title DESC;");
477 query.
bindValue(
":FEEDTITLE", feedtitle);
487 QString title = query.
value(0).toString();
488 QString subtitle = query.
value(1).toString();
489 QString desc = query.
value(2).toString();
490 QString URL = query.
value(3).toString();
492 QString thumbnail = query.
value(5).toString();
493 QString mediaURL = query.
value(6).toString();
494 QString author = query.
value(7).toString();
496 QString time = query.
value(9).toString();
498 off_t filesize = query.
value(11).toULongLong();
499 QString player = query.
value(12).toString();
500 QStringList playerargs = query.
value(13).toString().split(
" ");
501 QString download = query.
value(14).toString();
502 QStringList downloadargs = query.
value(15).toString().split(
" ");
505 QString language = query.
value(18).toString();
506 bool downloadable = query.
value(19).toBool();
507 bool customhtml = query.
value(20).toBool();
508 QStringList countries = query.
value(21).toString().split(
" ");
512 QString path = query.
value(24).toString();
513 QString paththumb = query.
value(25).toString();
515 QPair<QString,QString> pair(path,paththumb);
516 ret.insert(pair,
new ResultItem(title, QString(),
517 subtitle, QString(), desc, URL,
518 thumbnail, mediaURL, author, date, time,
rating, filesize,
519 player, playerargs, download, downloadargs,
520 width, height, language, downloadable, countries,
521 season, episode, customhtml));
530 query.
prepare(
"SELECT commandline FROM internetcontent WHERE commandline = :URL AND "
531 "type = :TYPE AND podcast = 1;");
539 return query.
size() > 0;
546 query.
prepare(
"SELECT name,thumbnail,author,description,"
547 "commandline,download,updated FROM internetcontent "
548 "WHERE commandline = :URL AND type = :TYPE "
557 QString(), QString(),
false,
562 QString title = query.
value(0).toString();
563 QString image = query.
value(1).toString();
564 QString author = query.
value(2).toString();
565 QString description = query.
value(3).toString();
566 QString outurl = query.
value(4).toString();
567 bool download = query.
value(5).toBool();
568 QDateTime updated; query.
value(6).toDate();
571 outurl, author, download, updated);
583 "SELECT name, thumbnail, description, commandline, author, "
584 "download, updated FROM internetcontent WHERE podcast = 1 "
585 "AND type = :TYPE ORDER BY name");
596 QString title = query.
value(0).toString();
597 QString image = query.
value(1).toString();
598 QString description = query.
value(2).toString();
599 QString url = query.
value(3).toString();
600 QString author = query.
value(4).toString();
601 bool download = query.
value(5).toBool();
602 QDateTime updated; query.
value(6).toDate();
603 tmp.append(
new RSSSite(title, QString(), image,
type, description, url,
604 author, download, updated));
616 "SELECT name, thumbnail, type, description, commandline, author, "
617 "download, updated FROM internetcontent WHERE podcast = 1 "
627 QString title = query.
value(0).toString();
628 QString image = query.
value(1).toString();
630 QString description = query.
value(3).toString();
631 QString url = query.
value(4).toString();
632 QString author = query.
value(5).toString();
633 bool download = query.
value(6).toBool();
634 QDateTime updated; query.
value(7).toDate();
636 image,
type, description, url,
637 author, download, updated));
645 if (!site)
return false;
654 [[maybe_unused]]
const QString &sortname,
655 const QString &thumbnail,
656 const QString &description,
const QString &url,
657 const QString &author,
const bool download,
664 query.
prepare(
"INSERT INTO internetcontent (name,thumbnail,description,"
665 "commandline,author,download,updated,podcast, type) "
666 "VALUES( :NAME, :THUMBNAIL, :DESCRIPTION, :URL, :AUTHOR, :DOWNLOAD, "
667 ":UPDATED, :PODCAST, :TYPE);");
670 query.
bindValue(
":THUMBNAIL", thumbnail);
671 query.
bindValue(
":DESCRIPTION", description);
688 if (!site)
return false;
696 query.
prepare(
"DELETE FROM internetcontent WHERE commandline = :URL "
697 "AND type = :TYPE;");
713 query.
prepare(
"UPDATE internetcontent SET updated = :UPDATED "
714 "WHERE commandline = :URL AND type = :TYPE;");
724 if (feedtitle.isEmpty())
728 query.
prepare(
"DELETE FROM internetcontentarticles "
729 "WHERE feedtitle = :FEEDTITLE AND podcast = 1 "
730 "AND type = :TYPE ;");
731 query.
bindValue(
":FEEDTITLE", feedtitle);
745 if (!item || feedtitle.isEmpty())
749 query.
prepare(
"INSERT INTO internetcontentarticles (feedtitle, title, "
750 "description, url, type, thumbnail, mediaURL, author, date, time, "
751 "rating, filesize, player, playerargs, download, "
752 "downloadargs, width, height, language, downloadable, countries, "
754 "VALUES( :FEEDTITLE, :TITLE, :DESCRIPTION, :URL, :TYPE, :THUMBNAIL, "
755 ":MEDIAURL, :AUTHOR, :DATE, :TIME, :RATING, :FILESIZE, :PLAYER, "
756 ":PLAYERARGS, :DOWNLOAD, :DOWNLOADARGS, :WIDTH, :HEIGHT, "
757 ":LANGUAGE, :DOWNLOADABLE, :COUNTRIES, :PODCAST);");
758 query.
bindValue(
":FEEDTITLE", feedtitle);
770 time = QString::number(0);
803 query.
prepare(
"SELECT title, description, url, "
804 "thumbnail, mediaURL, author, date, time, "
805 "rating, filesize, player, playerargs, download, "
806 "downloadargs, width, height, language, "
807 "downloadable, countries, season, episode "
808 "FROM internetcontentarticles "
809 "WHERE feedtitle = :FEEDTITLE AND podcast = 1 "
810 "AND type = :TYPE ORDER BY date DESC;");
811 query.
bindValue(
":FEEDTITLE", feedtitle);
820 QString title = query.
value(0).toString();
822 QString desc = query.
value(1).toString();
823 QString URL = query.
value(2).toString();
824 QString thumbnail = query.
value(3).toString();
825 QString mediaURL = query.
value(4).toString();
826 QString author = query.
value(5).toString();
828 QString time = query.
value(7).toString();
830 off_t filesize = query.
value(9).toULongLong();
831 QString player = query.
value(10).toString();
832 QStringList playerargs = query.
value(11).toString().split(
" ");
833 QString download = query.
value(12).toString();
834 QStringList downloadargs = query.
value(13).toString().split(
" ");
837 QString language = query.
value(16).toString();
838 bool downloadable = query.
value(17).toBool();
839 QStringList countries = query.
value(18).toString().split(
" ");
843 ret.append(
new ResultItem(title, QString(), QString(),
844 QString(), desc, URL, thumbnail,
845 mediaURL, author, date, time,
rating, filesize,
846 player, playerargs, download, downloadargs,
847 width, height, language, downloadable, countries,
848 season, episode,
false));
856 QByteArray urlarr(url.toLatin1());
857 QByteArray titlearr(title.toLatin1());
858 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
859 quint16 urlChecksum = qChecksum(urlarr.data(), urlarr.length());
860 quint16 titleChecksum = qChecksum(titlearr.data(), titlearr.length());
862 quint16 urlChecksum = qChecksum(urlarr);
863 quint16 titleChecksum = qChecksum(titlearr);
866 QString ext = QFileInfo(qurl.path()).suffix();
867 QString basefilename = QString(
"download_%1_%2.%3")
868 .arg(QString::number(urlChecksum), QString::number(titleChecksum), ext);