Permalink
Browse files

fix settings.xml & add powerstate option

  • Loading branch information...
Jörg Dembski
Jörg Dembski committed Apr 13, 2012
1 parent fd351c1 commit 3cf4d2f959127f73f14bbc08a730faa5dfee881e
View
@@ -1,3 +1,6 @@
+0.1.13 add: option to set deepstandby powerstate on the DVB box on PVR-addon shutdown
+ fix: error in settings.xml, causing crashes on linux
+
0.1.12 add: support to specify the folder for storing recordings
0.1.11 fix: some unicode string errors in german language file
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.vuplus"
- version="0.1.10"
+ version="0.1.13"
name="VU+ Client"
provider-name="Joerg Dembski">
<requires>
@@ -22,6 +22,8 @@
<string id="30021">HTTP</string>
<string id="30022">Recordings / Timer</string>
<string id="30022">Recording path on DVB box</string>
+ <string id="30023">Recording folder on the receiver</string>
+ <string id="30024">Send DeepStandby-Command</string>
<!-- notifications -->
<string id="30500">Disconnected from '%s'</string>
@@ -22,6 +22,7 @@
<string id="30021">HTTP</string>
<string id="30022">Aufnahmen / Timer</string>
<string id="30023">Aufnahmeverzeichnis auf dem Receiver</string>
+ <string id="30024">Sende DeepStandby-Befehl</string>
<!-- notifications -->
@@ -29,6 +29,7 @@
<setting label="30017" type="bool" id="onlycurrent" default="false"/>
<setting label="30009" type="bool" id="showcompleted" default="false"/>
<setting label="30011" type="bool" id="timerlistcleanup" default="false"/>
-
+ <setting type="sep" />
+ <setting label="30024" tyoe="bool" id="setpowerstate" default="false" />
</category>
</settings>
View
@@ -1,6 +1,6 @@
m4_define([MAJOR], 0)
m4_define([MINOR], 1)
-m4_define([MICRO], 12)
+m4_define([MICRO], 13)
dnl Process this file with autoconf to produce a configure script.
AC_INIT([xbmc-addon-vuplus], [MAJOR.MINOR.MICRO], [Joerg Dembski])
View
@@ -537,10 +537,6 @@ void *Vu::Process()
return NULL;
}
-void Vu::Close()
-{
- m_bIsConnected = false;
-}
bool Vu::LoadChannels()
{
@@ -808,11 +804,12 @@ PVR_ERROR Vu::GetChannels(PVR_HANDLE handle, bool bRadio)
Vu::~Vu()
{
StopThread();
-
+
m_channels.clear();
m_timers.clear();
m_recordings.clear();
m_groups.clear();
+ m_bIsConnected = false;
}
PVR_ERROR Vu::GetEPGForChannel(PVR_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd)
@@ -1084,41 +1081,45 @@ CStdString Vu::URLEncodeInline(const CStdString& strData)
return buffer;
}
-bool Vu::SendSimpleCommand(const CStdString& strCommandURL, CStdString& strResultText)
+bool Vu::SendSimpleCommand(const CStdString& strCommandURL, CStdString& strResultText, bool bIgnoreResult)
{
CStdString url;
url.Format("%s%s", m_strURL.c_str(), strCommandURL.c_str());
CStdString strXML;
strXML = GetHttpXML(url);
- XMLResults xe;
- XMLNode xMainNode = XMLNode::parseString(strXML.c_str(), NULL, &xe);
+ if (!bIgnoreResult)
+ {
+ XMLResults xe;
+ XMLNode xMainNode = XMLNode::parseString(strXML.c_str(), NULL, &xe);
- if(xe.error != 0) {
- XBMC->Log(LOG_ERROR, "%s Unable to parse XML. Error: '%s' ", __FUNCTION__, XMLNode::getError(xe.error));
- return false;
- }
+ if(xe.error != 0) {
+ XBMC->Log(LOG_ERROR, "%s Unable to parse XML. Error: '%s' ", __FUNCTION__, XMLNode::getError(xe.error));
+ return false;
+ }
- XMLNode xNode = xMainNode.getChildNode("e2simplexmlresult");
+ XMLNode xNode = xMainNode.getChildNode("e2simplexmlresult");
- bool bTmp;
+ bool bTmp;
- if (!GetBoolean(xNode, "e2state", bTmp)) {
- XBMC->Log(LOG_ERROR, "%s Could not parse e2state from result!", __FUNCTION__);
- strResultText.Format("Could not parse e2state!");
- return false;
- }
+ if (!GetBoolean(xNode, "e2state", bTmp)) {
+ XBMC->Log(LOG_ERROR, "%s Could not parse e2state from result!", __FUNCTION__);
+ strResultText.Format("Could not parse e2state!");
+ return false;
+ }
- if (!GetString(xNode, "e2statetext", strResultText)) {
- XBMC->Log(LOG_ERROR, "%s Could not parse e2state from result!", __FUNCTION__);
- return false;
- }
+ if (!GetString(xNode, "e2statetext", strResultText)) {
+ XBMC->Log(LOG_ERROR, "%s Could not parse e2state from result!", __FUNCTION__);
+ return false;
+ }
- if (!bTmp)
- XBMC->Log(LOG_ERROR, "%s Error message from backend: '%s'", __FUNCTION__, strResultText.c_str());
+ if (!bTmp)
+ XBMC->Log(LOG_ERROR, "%s Error message from backend: '%s'", __FUNCTION__, strResultText.c_str());
- return bTmp;
+ return bTmp;
+ }
+ return true;
}
@@ -1531,5 +1532,17 @@ bool Vu::SwitchChannel(const PVR_CHANNEL &channel)
return false;
return true;
+}
+
+void Vu::SendPowerstate()
+{
+ if (!g_bSetPowerstate)
+ return;
+
+ CLockObject lock(m_mutex);
+ CStdString strTmp;
+ strTmp.Format("web/powerstate?newstate=1");
+ CStdString strResult;
+ SendSimpleCommand(strTmp, strResult, true);
}
View
@@ -141,7 +141,7 @@ class Vu : public PLATFORM::CThread
CStdString GetHttpXML(CStdString& url);
int GetChannelNumber(CStdString strServiceReference);
CStdString URLEncodeInline(const CStdString& strData);
- bool SendSimpleCommand(const CStdString& strCommandURL, CStdString& strResult);
+ bool SendSimpleCommand(const CStdString& strCommandURL, CStdString& strResult, bool bIgnoreResult = false);
static int VuWebResponseCallback(void *contents, int iLength, int iSize, void *memPtr);
CStdString GetGroupServiceReference(CStdString strGroupName);
bool LoadChannels(CStdString strServerReference, CStdString strGroupName);
@@ -188,13 +188,9 @@ class Vu : public PLATFORM::CThread
const char* GetLiveStreamURL(const PVR_CHANNEL &channelinfo);
bool OpenLiveStream(const PVR_CHANNEL &channelinfo);
void CloseLiveStream();
+ void SendPowerstate();
bool SwitchChannel(const PVR_CHANNEL &channel);
-
-
bool Open();
void Action();
- void Close();
-
-
};
View
@@ -37,7 +37,6 @@ int g_iClientId = -1;
*/
std::string g_strHostname = DEFAULT_HOST;
int g_iConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
-int g_iResponseTimeout = DEFAULT_RESPONSE_TIMEOUT;
int g_iPortStream = DEFAULT_STREAM_PORT;
int g_iPortWeb = DEFAULT_WEB_PORT;
int g_iUpdateInterval = DEFAULT_UPDATE_INTERVAL;
@@ -52,6 +51,7 @@ bool g_bZap = false;
bool g_bCheckForGroupUpdates = true;
bool g_bCheckForChannelUpdates = true;
bool g_bOnlyCurrentLocation = false;
+bool g_bSetPowerstate = false;
std::string g_szClientPath = "";
std::string g_strChannelDataPath = "/tmp/";
@@ -106,6 +106,10 @@ void ADDON_ReadSettings(void)
if (!XBMC->GetSetting("onlycurrent", &g_bOnlyCurrentLocation))
g_bOnlyCurrentLocation = false;
+ /* read setting "setpowerstate" from settings.xml */
+ if (!XBMC->GetSetting("setpowerstate", &g_bSetPowerstate))
+ g_bSetPowerstate = false;
+
/* read setting "showcompleted" from settings.xml */
if (!XBMC->GetSetting("showcompleted", &g_bShowTimersCompleted))
g_bShowTimersCompleted = false;
@@ -130,10 +134,6 @@ void ADDON_ReadSettings(void)
if (!XBMC->GetSetting("updateint", &g_iUpdateInterval))
g_iConnectTimeout = DEFAULT_UPDATE_INTERVAL;
- /* read setting "read_timeout" from settings.xml */
- if (!XBMC->GetSetting("response_timeout", &g_iResponseTimeout))
- g_iResponseTimeout = DEFAULT_RESPONSE_TIMEOUT;
-
/* read setting "iconpath" from settings.xml */
if (XBMC->GetSetting("iconpath", buffer))
g_strIconPath = buffer;
@@ -217,6 +217,12 @@ void ADDON_Destroy()
m_bCreated = false;
}
+ if (VuData)
+ {
+ VuData->SendPowerstate();
+ }
+
+
if (PVR)
{
delete PVR;
@@ -300,16 +306,6 @@ ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
return ADDON_STATUS_OK;
}
}
- else if (str == "response_timeout")
- {
- int iNewValue = *(int*) settingValue + 1;
- if (g_iResponseTimeout != iNewValue)
- {
- XBMC->Log(LOG_INFO, "%s - Changed Setting 'response_timeout' from %u to %u", __FUNCTION__, g_iResponseTimeout, iNewValue);
- g_iResponseTimeout = iNewValue;
- return ADDON_STATUS_OK;
- }
- }
return ADDON_STATUS_OK;
}
View
@@ -25,7 +25,6 @@
#define DEFAULT_HOST "127.0.0.1"
#define DEFAULT_CONNECT_TIMEOUT 30
-#define DEFAULT_RESPONSE_TIMEOUT 3
#define DEFAULT_STREAM_PORT 8001
#define DEFAULT_WEB_PORT 80
#define DEFAULT_UPDATE_INTERVAL 2
@@ -38,7 +37,6 @@ extern std::string g_strUsername;
extern std::string g_strPassword;
extern std::string g_strIconPath;
extern std::string g_strRecordingPath;
-extern int g_iResponseTimeout;
extern int g_iUpdateInterval;
extern int g_iClientId;
extern unsigned int g_iPacketSequence;
@@ -49,6 +47,7 @@ extern bool g_bAutomaticTimerlistCleanup;
extern bool g_bCheckForGroupUpdates;
extern bool g_bCheckForChannelUpdates;
extern bool g_bOnlyCurrentLocation;
+extern bool g_bSetPowerstate;
extern std::string g_szUserPath;
extern std::string g_szClientPath;
extern std::string g_strChannelDataPath;

0 comments on commit 3cf4d2f

Please sign in to comment.