Go to the documentation of this file.
13 QString generate_myth_url(
const QString &storage_group,
const QString &host,
29 if (inetref.isEmpty())
34 QString querystring =
"SELECT host, coverart, fanart, banner "
35 "FROM recordedartwork WHERE inetref = :INETREF ";
38 querystring +=
"AND season = :SEASON;";
43 querystring +=
"ORDER BY season = :SEASON DESC, season DESC;";
46 querystring +=
"ORDER BY season DESC;";
52 if (strict || season > 0)
63 QString host = query.
value(0).toString();
64 QString coverart = query.
value(1).toString();
65 QString fanart = query.
value(2).toString();
66 QString banner = query.
value(3).toString();
68 if (!coverart.isEmpty())
71 coverartinfo.
url = generate_myth_url(
"Coverart", host, coverart);
75 if (!fanart.isEmpty())
78 fanartinfo.
url = generate_myth_url(
"Fanart", host, fanart);
82 if (!banner.isEmpty())
85 bannerinfo.
url = generate_myth_url(
"Banners", host, banner);
96 const QString &coverart,
97 const QString &fanart,
98 const QString &banner)
103 if (!coverart.isEmpty())
106 coverartinfo.
url = generate_myth_url(
"Coverart", host, coverart);
110 if (!fanart.isEmpty())
113 fanartinfo.
url = generate_myth_url(
"Fanart", host, fanart);
117 if (!banner.isEmpty())
120 bannerinfo.
url = generate_myth_url(
"Banners", host, banner);
134 if (inetref.isEmpty())
142 if (!coverurl.path().isEmpty())
144 coverart = coverurl.path();
145 coverart = coverart.remove(0,1);
149 if (!fanarturl.path().isEmpty())
151 fanart = fanarturl.path();
152 fanart = fanart.remove(0,1);
156 if (!bannerurl.path().isEmpty())
158 banner = bannerurl.path();
159 banner = banner.remove(0,1);
165 prequery.
prepare(
"DELETE FROM recordedartwork WHERE "
166 "inetref = :INETREF AND season = :SEASON;");
171 if (!prequery.
exec())
179 query.
prepare(
"INSERT INTO recordedartwork(inetref,"
180 "season,host,coverart,fanart,banner) VALUES( "
181 ":INETREF, :SEASON, :HOST, :COVERART, "
182 ":FANART, :BANNER);");
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
void bindValueNoNull(const QString &placeholder, const QVariant &val)
Add a single binding, taking care not to set a NULL value.
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
static QString GenMythURL(const QString &host=QString(), int port=0, QString path=QString(), const QString &storageGroup=QString())
int GetBackendServerPort(void)
Returns the locally defined backend control port.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
static void DBError(const QString &where, const MSqlQuery &query)
static QString GetGroupToUse(const QString &host, const QString &sgroup)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.