Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
[mythtv-cmyth] Reworked GetBackendName, GetBackendVersion and GetConn…
Browse files Browse the repository at this point in the history
…ectionString

- Moved string creation out from Connect() to the functions itself.
- GetBackendName now shows 'MythTV (<backend>)'
- GetBackendVersion now shows 'Protocol version: XX - Database version: XX' (added translatable string)
  • Loading branch information
fetzerch committed Nov 17, 2012
1 parent 1a58bf1 commit fe762b2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 17 deletions.
Expand Up @@ -66,3 +66,8 @@ msgstr "Enable Live TV"
msgctxt "#30007"
msgid "Allow Live TV to move scheduled shows"
msgstr "Allow Live TV to move scheduled shows"

# Systeminformation labels
msgctxt "#30100"
msgid "Protocol version: %i - Database version: %i"
msgstr "Protocol version: %i - Database version: %i"
7 changes: 7 additions & 0 deletions addons/pvr.mythtv.cmyth/src/cppmyth/MythDatabase.cpp
Expand Up @@ -70,6 +70,13 @@ bool MythDatabase::TestConnection(CStdString *msg)
return retval == 1;
}

int MythDatabase::GetSchemaVersion()
{
int retval = 0;
CMYTH_DB_CALL(retval, retval < 0, cmyth_database_get_version(*m_database_t));
return retval;
}

bool MythDatabase::FindProgram(time_t starttime, int channelid, const CStdString &title, MythProgram* program)
{
int retval = 0;
Expand Down
2 changes: 2 additions & 0 deletions addons/pvr.mythtv.cmyth/src/cppmyth/MythDatabase.h
Expand Up @@ -65,6 +65,8 @@ class MythDatabase

bool TestConnection(CStdString *msg);

int GetSchemaVersion();

bool FindProgram(time_t starttime, int channelid, const CStdString &title, MythProgram* pprogram);
ProgramList GetGuide(time_t starttime, time_t endtime);

Expand Down
25 changes: 11 additions & 14 deletions addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.cpp
Expand Up @@ -120,7 +120,7 @@ PVRClientMythTV::PVRClientMythTV()
, m_pEventHandler(NULL)
, m_db()
, m_fileOps(NULL)
, m_protocolVersion("")
, m_backendVersion("")
, m_connectionString("")
, m_categories()
, m_EPGstart(0)
Expand Down Expand Up @@ -197,9 +197,6 @@ bool PVRClientMythTV::Connect()
return false;
}

m_protocolVersion.Format("%i", m_con.GetProtocolVersion());
m_connectionString.Format("%s:%i - %s@%s:%i", g_szMythHostname, g_iMythPort, g_szDBName, g_szDBHostname, g_iDBPort);

// Create database connection
m_db = MythDatabase(g_szDBHostname, g_szDBName, g_szDBUser, g_szDBPassword, g_iDBPort);
if (m_db.IsNull())
Expand Down Expand Up @@ -244,22 +241,22 @@ bool PVRClientMythTV::Connect()

const char *PVRClientMythTV::GetBackendName()
{
if (g_bExtraDebug)
XBMC->Log(LOG_DEBUG, "%s", __FUNCTION__);
return m_con.GetBackendName();
m_backendName.Format("MythTV (%s)", m_con.GetBackendName());
XBMC->Log(LOG_DEBUG, "GetBackendName: %s", m_backendName.c_str());
return m_backendName;
}

const char *PVRClientMythTV::GetBackendVersion() const
const char *PVRClientMythTV::GetBackendVersion()
{
if (g_bExtraDebug)
XBMC->Log(LOG_DEBUG, "%s", __FUNCTION__);
return m_protocolVersion;
m_backendVersion.Format(XBMC->GetLocalizedString(30100), m_con.GetProtocolVersion(), m_db.GetSchemaVersion());
XBMC->Log(LOG_DEBUG, "GetBackendVersion: %s", m_backendVersion.c_str());
return m_backendVersion;
}

const char *PVRClientMythTV::GetConnectionString() const
const char *PVRClientMythTV::GetConnectionString()
{
if (g_bExtraDebug)
XBMC->Log(LOG_DEBUG, "%s", __FUNCTION__);
m_connectionString.Format("%s:%i - %s@%s:%i", g_szMythHostname, g_iMythPort, g_szDBName, g_szDBHostname, g_iDBPort);
XBMC->Log(LOG_DEBUG, "GetConnectionString: %s", m_connectionString.c_str());
return m_connectionString;
}

Expand Down
7 changes: 4 additions & 3 deletions addons/pvr.mythtv.cmyth/src/pvrclient-mythtv.h
Expand Up @@ -62,8 +62,8 @@ class PVRClientMythTV
// Server
bool Connect();
const char *GetBackendName();
const char *GetBackendVersion() const;
const char *GetConnectionString() const;
const char *GetBackendVersion();
const char *GetConnectionString();
bool GetDriveSpace(long long *iTotal, long long *iUsed);

// EPG
Expand Down Expand Up @@ -127,7 +127,8 @@ class PVRClientMythTV
PLATFORM::CMutex m_lock;
MythFile m_file;

CStdString m_protocolVersion;
CStdString m_backendName;
CStdString m_backendVersion;
CStdString m_connectionString;

// Categories
Expand Down

0 comments on commit fe762b2

Please sign in to comment.