Skip to content

Commit

Permalink
enable setting 'limit_tune_attempts'
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeB2013 authored and janbar committed Aug 19, 2015
1 parent 000f424 commit f32248a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ int g_iTuneDelay = DEFAULT_TUNE_DELAY;
int g_iGroupRecordings = GROUP_RECORDINGS_ALWAYS;
int g_iEnableEDL = ENABLE_EDL_ALWAYS;
bool g_bBlockMythShutdown = DEFAULT_BLOCK_SHUTDOWN;
bool g_bLimitTuneAttempts = DEFAULT_LIMIT_TUNE_ATTEMPTS;

///* Client member variables */
ADDON_STATUS m_CurStatus = ADDON_STATUS_UNKNOWN;
Expand Down Expand Up @@ -301,6 +302,14 @@ ADDON_STATUS ADDON_Create(void *hdl, void *props)
g_bRecordingIcons = DEFAULT_RECORDING_ICONS;
}

/* Read setting "limit_tune_attempts" from settings.xml */
if (!XBMC->GetSetting("limit_tune_attempts", &g_bLimitTuneAttempts))
{
/* If setting is unknown fallback to defaults */
XBMC->Log(LOG_ERROR, "Couldn't get 'limit_tune_attempts' setting, falling back to '%b' as default", DEFAULT_LIMIT_TUNE_ATTEMPTS);
g_bLimitTuneAttempts = DEFAULT_LIMIT_TUNE_ATTEMPTS;
}

free (buffer);
XBMC->Log(LOG_DEBUG, "Loading settings...done");

Expand Down Expand Up @@ -615,6 +624,12 @@ ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
g_bBlockMythShutdown ? g_client->BlockBackendShutdown() : g_client->AllowBackendShutdown();
}
}
else if (str == "limit_tune_attempts")
{
XBMC->Log(LOG_INFO, "Changed Setting 'limit_tune_attempts' from %u to %u", g_bLimitTuneAttempts, *(bool*)settingValue);
if (g_bLimitTuneAttempts != *(bool*)settingValue)
g_bLimitTuneAttempts = *(bool*)settingValue;
}
return ADDON_STATUS_OK;
}

Expand Down
2 changes: 2 additions & 0 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#define ENABLE_EDL_DIALOG 1
#define ENABLE_EDL_NEVER 2
#define DEFAULT_BLOCK_SHUTDOWN true
#define DEFAULT_LIMIT_TUNE_ATTEMPTS true

/*!
* @brief PVR macros for string exchange
Expand Down Expand Up @@ -106,6 +107,7 @@ extern int g_iTuneDelay;
extern int g_iGroupRecordings;
extern int g_iEnableEDL;
extern bool g_bBlockMythShutdown;
extern bool g_bLimitTuneAttempts; ///< Limit channel tuning attempts to first card

extern ADDON::CHelper_libXBMC_addon *XBMC;
extern CHelper_libXBMC_pvr *PVR;
Expand Down
3 changes: 2 additions & 1 deletion src/pvrclient-mythtv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1946,8 +1946,9 @@ bool PVRClientMythTV::OpenLiveStream(const PVR_CHANNEL &channel)
// Suspend fileOps to avoid connection hang
if (m_fileOps)
m_fileOps->Suspend();
// Set tuning delay
// Configure tuning of channel
m_liveStream->SetTuneDelay(g_iTuneDelay);
m_liveStream->SetLimitTuneAttempts(g_bLimitTuneAttempts);
// Try to open
if (m_liveStream->SpawnLiveTV(chanset[0]->chanNum, chanset))
{
Expand Down

0 comments on commit f32248a

Please sign in to comment.