MythTV  master
netcommon.cpp
Go to the documentation of this file.
1 #include <QDir>
2 
3 #include <mythdirs.h>
4 #include <mythcontext.h>
5 #include <remotefile.h>
6 
7 #include "netcommon.h"
8 
9 QString GetThumbnailFilename(const QString& url, const QString& title)
10 {
11  QString fileprefix = GetConfDir();
12 
13  QDir dir(fileprefix);
14  if (!dir.exists())
15  dir.mkdir(fileprefix);
16 
17  fileprefix += "/cache/netvision-thumbcache";
18 
19  dir = QDir(fileprefix);
20  if (!dir.exists())
21  dir.mkdir(fileprefix);
22 
23  QString sFilename = QString("%1/%2_%3")
24  .arg(fileprefix)
25  .arg(qChecksum(url.toLocal8Bit().constData(),
26  url.toLocal8Bit().size()))
27  .arg(qChecksum(title.toLocal8Bit().constData(),
28  title.toLocal8Bit().size()));
29  return sFilename;
30 }
31 
32 QString GetMythXMLURL(void)
33 {
34  QString MasterIP = gCoreContext->GetMasterServerIP();
35  int MasterStatusPort = gCoreContext->GetMasterServerStatusPort();
36 
37  return QString("http://%1:%2/InternetContent/").arg(MasterIP)
38  .arg(MasterStatusPort);
39 }
40 
41 QUrl GetMythXMLSearch(const QString& url, const QString& query, const QString& grabber,
42  const QString& pagenum)
43 {
44  QString tmp = QString("%1GetInternetSearch?Query=%2&Grabber=%3&Page=%4")
45  .arg(url).arg(query).arg(grabber).arg(pagenum);
46  return QUrl(tmp);
47 }
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static guint32 * tmp
Definition: goom_core.c:35
QString GetMasterServerIP(void)
Returns the Master Backend IP address If the address is an IPv6 address, the scope Id is removed.
QString GetConfDir(void)
Definition: mythdirs.cpp:224
QString GetMythXMLURL(void)
Definition: netcommon.cpp:32
QUrl GetMythXMLSearch(const QString &url, const QString &query, const QString &grabber, const QString &pagenum)
Definition: netcommon.cpp:41
QString GetThumbnailFilename(const QString &url, const QString &title)
Definition: netcommon.cpp:9
int GetMasterServerStatusPort(void)
Returns the Master Backend status port If no master server status port has been defined in the databa...