Go to the documentation of this file.
17 QString(
"http://smolt.mythtv.org/");
19 QString(
"smolt_token-smolt.mythtv.org");
31 query.
prepare(
"SELECT lastrun FROM housekeeping"
32 " WHERE tag = 'HardwareProfiler'"
33 " AND hostname = :HOST");
55 QString fileprefix =
GetConfDir() +
"/HardwareProfile";
58 dir.mkdir(fileprefix);
64 if (fileUUID.isEmpty() &&
m_uuid.isEmpty())
66 LOG(VB_GENERAL, LOG_INFO,
67 "No UUID in DB or File, generating new UUID...");
69 QString cmd =
GetShareDir() +
"hardwareprofile/sendProfile.py";
79 else if (fileUUID.isEmpty())
81 LOG(VB_GENERAL, LOG_INFO,
82 QString(
"Writing Database UUID to local file: %1")
88 LOG(VB_GENERAL, LOG_INFO,
89 QString(
"Profile UUID found in local file: %1")
103 QString hwuuid_file =
GetConfDir() +
"/HardwareProfile/hw-uuid";
104 QFile
file(hwuuid_file);
105 if (
file.open( QIODevice::ReadOnly ))
107 QTextStream stream(&
file);
108 ret = stream.readLine();
119 QString pubuuid_file =
GetConfDir() +
"/HardwareProfile/uuiddb.cfg";
120 QFile pubfile(pubuuid_file);
121 if (pubfile.open( QIODevice::ReadOnly ))
124 QTextStream stream(&pubfile);
125 while ( !stream.atEnd() )
127 s = stream.readLine();
130 ret = s.section(
"=",1,1);
148 QFile
file(token_file);
149 if (
file.open( QIODevice::ReadOnly ))
151 QTextStream stream(&
file);
152 ret = stream.readLine();
161 QString hwuuid_file =
GetConfDir() +
"/HardwareProfile/hw-uuid";
162 QFile
file(hwuuid_file);
163 if (
file.open(QIODevice::WriteOnly))
165 QTextStream stream(&
file);
179 LOG(VB_GENERAL, LOG_INFO,
180 "Last hardware profile update was > 30 days ago, update "
198 LOG(VB_GENERAL, LOG_INFO,
199 QString(
"Submitting the following hardware profile: %1")
203 QString cmd =
GetShareDir() +
"hardwareprofile/sendProfile.py";
205 args <<
"--submitOnly";
232 LOG(VB_GENERAL, LOG_INFO,
233 QString(
"Deleting the following hardware profile: %1")
236 QString cmd =
GetShareDir() +
"hardwareprofile/deleteProfile.py";
265 QString cmd =
GetShareDir() +
"hardwareprofile/sendProfile.py";
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
QString m_hardwareProfile
QDateTime as_utc(const QDateTime &old_dt)
Returns copy of QDateTime with TimeSpec set to UTC.
static QString GetPrivateUUIDFromFile(void)
static bool WritePrivateUUIDToFile(const QString &uuid)
const QString SMOLT_SERVER_LOCATION
QVariant value(int i) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
bool DoCheckRun(const QDateTime &now) override
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
QString GetPublicUUIDFromFile(void) const
@ GENERIC_EXIT_OK
Exited with no error.
bool DoRun(void) override
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
QString GetShareDir(void)
static QString GetHardwareProfile(void)
uint Wait(std::chrono::seconds timeout=0s)
bool DoCheckRun(const QDateTime &now) override
QString GetProfileURL(void) const
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QDateTime UpdateLastRun(const QDateTime &last, bool successful=true) override
int GetNumSetting(const QString &key, int defaultval=0)
QString GetPublicUUID(void) const
@ kMSRunShell
run process through shell
QString GetPrivateUUID(void) const
bool SubmitProfile(bool updateTime=true)
const QString SMOLT_TOKEN
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool NeedsUpdate(void) const
QString GetHostName(void)
void Run(std::chrono::seconds timeout=0s)
Runs a command inside the /bin/sh shell. Returns immediately.
void SaveSetting(const QString &key, int newValue)
static void Disable(void)
@ kMSStdOut
allow access to stdout
bool SaveSettingOnHost(const QString &key, const QString &newValue, const QString &host)
static QString GetAdminPasswordFromFile(void)
QString GetSetting(const QString &key, const QString &defaultval="")
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.