Go to the documentation of this file.
16 "commandline = :COMMAND AND host = :HOST "
17 "AND type = :TYPE AND tree = 1;");
18 QFileInfo fi(commandline);
36 "commandline = :COMMAND AND host = :HOST "
37 "AND type = :TYPE AND search = 1;");
38 QFileInfo fi(commandline);
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);
72 QString command = QString(
"%1/internetcontent/%2").arg(
GetShareDir())
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);
104 QString command = QString(
"%1/internetcontent/%2").arg(
GetShareDir())
111 tree, desc, command, ver);
119 "author,description,commandline,"
120 "version,search,tree FROM internetcontent "
121 "where tree = 1 ORDER BY name;");
135 QString commandline = QString(
"%1/internetcontent/%2").arg(
GetShareDir())
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;");
170 QString commandline = QString(
"%1/internetcontent/%2").arg(
GetShareDir())
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;");
205 QString commandline = QString(
"%1/internetcontent/%2").arg(
GetShareDir())
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);");
261 QFileInfo cmd(commandline);
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);
317 query.
prepare(
"UPDATE internetcontent SET updated = :UPDATED "
318 "WHERE commandline = :COMMAND AND tree = 1;");
335 return then.addSecs(updateFreq * 60 * 60) < now;
343 "FROM internetcontent "
344 "WHERE commandline = :COMMAND ORDER "
345 "BY updated DESC LIMIT 1;");
362 if (feedcommand.isEmpty())
367 "WHERE feedtitle = :FEEDTITLE AND podcast = 0;");
381 if (feedcommand.isEmpty())
386 "WHERE commandline = :COMMAND;");
387 QFileInfo fi(feedcommand);
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, "
431 time = QString::number(0);
467 QMultiMap<QPair<QString,QString>,
ResultItem*> ret;
470 query.
prepare(
"SELECT title, subtitle, description, url, "
471 "type, thumbnail, mediaURL, author, date, time, "
472 "rating, filesize, player, playerargs, download, "
473 "downloadargs, width, height, language, "
474 "downloadable, customhtml, countries, season, episode, "
475 "path, paththumb FROM internetcontentarticles "
476 "WHERE feedtitle = :FEEDTITLE AND podcast = 0 "
477 "AND type = :TYPE ORDER BY title DESC;");
493 QString thumbnail =
query.
value(5).toString();
501 QStringList playerargs =
query.
value(13).toString().split(
" ");
502 QString download =
query.
value(14).toString();
503 QStringList downloadargs =
query.
value(15).toString().split(
" ");
506 QString language =
query.
value(18).toString();
514 QString paththumb =
query.
value(25).toString();
516 QPair<QString,QString> pair(path,paththumb);
518 subtitle, QString(), desc, URL,
519 thumbnail, mediaURL, author, date, time,
rating, filesize,
520 player, playerargs, download, downloadargs,
521 width, height, language, downloadable,
countries,
522 season, episode, customhtml));
531 query.
prepare(
"SELECT commandline FROM internetcontent WHERE commandline = :URL AND "
532 "type = :TYPE AND podcast = 1;");
547 query.
prepare(
"SELECT name,thumbnail,author,description,"
548 "commandline,download,updated FROM internetcontent "
549 "WHERE commandline = :URL AND type = :TYPE "
558 QString(), QString(),
false,
566 QString description =
query.
value(3).toString();
572 outurl, author, download, updated);
584 "SELECT name, thumbnail, description, commandline, author, "
585 "download, updated FROM internetcontent WHERE podcast = 1 "
586 "AND type = :TYPE ORDER BY name");
599 QString description =
query.
value(2).toString();
605 author, download, updated));
617 "SELECT name, thumbnail, type, description, commandline, author, "
618 "download, updated FROM internetcontent WHERE podcast = 1 "
631 QString description =
query.
value(3).toString();
637 image,
type, description, url,
638 author, download, updated));
646 if (!site)
return false;
654 bool insertInDB(
const QString &name,
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);");
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())
729 "WHERE feedtitle = :FEEDTITLE AND podcast = 1 "
730 "AND type = :TYPE ;");
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);");
770 time = QString::number(0);
805 "thumbnail, mediaURL, author, date, time, "
806 "rating, filesize, player, playerargs, download, "
807 "downloadargs, width, height, language, "
808 "downloadable, countries, season, episode "
809 "FROM internetcontentarticles "
810 "WHERE feedtitle = :FEEDTITLE AND podcast = 1 "
811 "AND type = :TYPE ORDER BY date DESC;");
825 QString thumbnail =
query.
value(3).toString();
833 QStringList playerargs =
query.
value(11).toString().split(
" ");
834 QString download =
query.
value(12).toString();
835 QStringList downloadargs =
query.
value(13).toString().split(
" ");
838 QString language =
query.
value(16).toString();
845 QString(), desc, URL, thumbnail,
846 mediaURL, author, date, time,
rating, filesize,
847 player, playerargs, download, downloadargs,
848 width, height, language, downloadable,
countries,
849 season, episode,
false));
857 QByteArray urlarr(url.toLatin1());
858 quint16 urlChecksum = qChecksum(urlarr.data(), urlarr.length());
859 QByteArray titlearr(
title.toLatin1());
860 quint16 titleChecksum = qChecksum(titlearr.data(), titlearr.length());
862 QString ext = QFileInfo(qurl.path()).suffix();
863 QString basefilename = QString(
"download_%1_%2.%3")
864 .arg(QString::number(urlChecksum))
865 .arg(QString::number(titleChecksum)).arg(ext);
bool isActive(void) const
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
const off_t & GetFilesize() const
const QString & GetAuthor() const
bool insertTreeArticleInDB(const QString &feedtitle, const QString &path, const QString &paththumb, ResultItem *item, ArticleType type)
bool insertInDB(RSSSite *site)
QString GetDownloadFilename(const QString &title, const QString &url)
GrabberScript * findTreeGrabberByCommand(const QString &commandline, ArticleType type)
bool findInDB(const QString &url, ArticleType type)
const QString & GetCommandline() const
GrabberScript::scriptList findAllDBSearchGrabbers(ArticleType type)
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
const QString & GetPlayer() const
void markUpdated(RSSSite *site)
const QString & GetTitle() const
const QString & GetImage() const
const bool & GetCustomHTML() const
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
const QString & GetDescription() const
const QString & GetTitle() const
RSSSite::rssList findAllDBRSSByType(ArticleType type)
bool insertRSSArticleInDB(const QString &feedtitle, ResultItem *item, ArticleType type)
const QStringList & GetCountries() const
bool findSearchGrabberInDB(const QString &commandline, ArticleType type)
GrabberScript::scriptList findAllDBTreeGrabbers()
bool needsUpdate(GrabberScript *script, uint updateFreq)
QMultiMap< QPair< QString, QString >, ResultItem * > getTreeArticles(const QString &feedtitle, ArticleType type)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
bool markTreeUpdated(GrabberScript *script, const QDateTime &curTime)
QList< GrabberScript * > scriptList
bool findTreeGrabberInDB(const QString &commandline, ArticleType type)
const QString & GetAuthor() const
const QString & GetRating() const
const QString & GetThumbnail() const
const QDateTime & GetDate() const
const uint & GetWidth() const
bool removeFromDB(RSSSite *site)
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
QString GetShareDir(void)
bool insertGrabberInDB(const QString &name, const QString &thumbnail, ArticleType type, const QString &author, const QString &description, const QString &commandline, const double version, bool search, bool tree, bool podcast)
def rating(profile, smoonURL, gate)
const QString & GetDownloader() const
const QString & GetTime() const
bool insertSearchInDB(GrabberScript *script, ArticleType type)
const QString & GetLanguage() const
const uint & GetSeason() const
bool isTreeInUse(const QString &feedcommand)
const QString & GetSubtitle() const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
const double & GetVersion() const
bool removeGrabberFromDB(const QString &commandline, const bool search)
const QString & GetDescription() const
GrabberScript * findSearchGrabberByCommand(const QString &commandline, ArticleType type)
const QStringList & GetPlayerArguments() const
const uint & GetEpisode() const
RSSSite::rssList findAllDBRSS()
QDateTime lastUpdate(GrabberScript *script)
const QString & GetURL() const
bool clearTreeItems(const QString &feedcommand)
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
RSSSite * findByURL(const QString &url, ArticleType type)
bool insertTreeInDB(GrabberScript *script, ArticleType type)
QList< ResultItem * > resultList
int numRowsAffected() const
QString GetHostName(void)
bool removeTreeFromDB(GrabberScript *script)
bool clearRSSArticles(const QString &feedtitle, ArticleType type)
ResultItem::resultList getRSSArticles(const QString &feedtitle, ArticleType type)
const QStringList & GetDownloaderArguments() const
MSqlQuery query(MSqlQuery::InitCon())
const bool & GetDownloadable() const
bool removeSearchFromDB(GrabberScript *script)
GrabberScript::scriptList findAllDBTreeGrabbersByHost(ArticleType type)
const uint & GetHeight() const
const QString & GetMediaURL() const
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.