MythTV  master
netcommon.cpp
Go to the documentation of this file.
1 #include <QDir>
2 
3 #include <libmyth/mythcontext.h>
4 #include <libmythbase/mythdirs.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 #if QT_VERSION < QT_VERSION_CHECK(6,0,0)
24  quint16 urlChecksum = qChecksum(url.toLocal8Bit().constData(), url.toLocal8Bit().size());
25  quint16 titleChecksum = qChecksum(title.toLocal8Bit().constData(), title.toLocal8Bit().size());
26 #else
27  quint16 urlChecksum = qChecksum(url.toLocal8Bit());
28  quint16 titleChecksum = qChecksum(title.toLocal8Bit());
29 #endif
30  QString sFilename = QString("%1/%2_%3")
31  .arg(fileprefix).arg(urlChecksum).arg(titleChecksum);
32  return sFilename;
33 }
34 
35 QString GetMythXMLURL(void)
36 {
37  QString MasterIP = gCoreContext->GetMasterServerIP();
38  int MasterStatusPort = gCoreContext->GetMasterServerStatusPort();
39 
40  return QString("http://%1:%2/InternetContent/").arg(MasterIP)
41  .arg(MasterStatusPort);
42 }
43 
44 QUrl GetMythXMLSearch(const QString& url, const QString& query, const QString& grabber,
45  const QString& pagenum)
46 {
47  QString tmp = QString("%1GetInternetSearch?Query=%2&Grabber=%3&Page=%4")
48  .arg(url, query, grabber, pagenum);
49  return {tmp};
50 }
GetMythXMLSearch
QUrl GetMythXMLSearch(const QString &url, const QString &query, const QString &grabber, const QString &pagenum)
Definition: netcommon.cpp:44
mythdirs.h
netcommon.h
MythCoreContext::GetMasterServerStatusPort
int GetMasterServerStatusPort(void)
Returns the Master Backend status port If no master server status port has been defined in the databa...
Definition: mythcorecontext.cpp:997
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
GetConfDir
QString GetConfDir(void)
Definition: mythdirs.cpp:256
remotefile.h
MythCoreContext::GetMasterServerIP
QString GetMasterServerIP(void)
Returns the Master Backend IP address If the address is an IPv6 address, the scope Id is removed.
Definition: mythcorecontext.cpp:970
GetMythXMLURL
QString GetMythXMLURL(void)
Definition: netcommon.cpp:35
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
GetThumbnailFilename
QString GetThumbnailFilename(const QString &url, const QString &title)
Definition: netcommon.cpp:9
mythcontext.h