[SCM] kodi-pvr-vdr-vnsi/master: adapt to Kodi API changes
tiber-guest at users.alioth.debian.org
tiber-guest at users.alioth.debian.org
Fri Nov 4 00:20:19 UTC 2016
The following commit has been merged in the master branch:
commit de2507bd0bc4b8da6d7b7627310102a2ccd01a05
Author: Rainer Hochecker <fernetmenta at online.de>
Date: Sun Feb 28 17:19:29 2016 +0100
adapt to Kodi API changes
diff --git a/pvr.vdr.vnsi/resources/language/resource.language.en_gb/strings.po b/pvr.vdr.vnsi/resources/language/resource.language.en_gb/strings.po
index f56f043..03ee6f0 100644
--- a/pvr.vdr.vnsi/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.vdr.vnsi/resources/language/resource.language.en_gb/strings.po
@@ -279,3 +279,25 @@ msgstr ""
msgctxt "#30114"
msgid "Provider Unknown"
msgstr ""
+
+#empty strings from id 30114 to 30199
+
+msgctxt "#30200"
+msgid "Single"
+msgstr ""
+
+msgctxt "#30201"
+msgid "Repeating"
+msgstr ""
+
+msgctxt "#30202"
+msgid "EGP"
+msgstr ""
+
+msgctxt "#30203"
+msgid "VPS"
+msgstr ""
+
+msgctxt "#30204"
+msgid "Search EPG"
+msgstr ""
\ No newline at end of file
diff --git a/src/VNSIData.cpp b/src/VNSIData.cpp
index f40d189..98f67fa 100644
--- a/src/VNSIData.cpp
+++ b/src/VNSIData.cpp
@@ -359,8 +359,10 @@ PVR_ERROR cVNSIData::GetTimerInfo(unsigned int timernumber, PVR_TIMER &tag)
return PVR_ERROR_SERVER_ERROR;
}
- /* TODO: Implement own timer types to get support for the timer features introduced with PVR API 1.9.7 */
- tag.iTimerType = PVR_TIMER_TYPE_NONE;
+ if (GetProtocol() >= 9)
+ {
+ tag.iTimerType = vresp->extract_U32();
+ }
tag.iClientIndex = vresp->extract_U32();
int iActive = vresp->extract_U32();
@@ -383,6 +385,12 @@ PVR_ERROR cVNSIData::GetTimerInfo(unsigned int timernumber, PVR_TIMER &tag)
char *strTitle = vresp->extract_String();
strncpy(tag.strTitle, strTitle, sizeof(tag.strTitle) - 1);
+ if (GetProtocol() >= 9)
+ {
+ char *epgSearch = vresp->extract_String();
+ strncpy(tag.strEpgSearchString, epgSearch, sizeof(tag.strEpgSearchString) - 1);
+ }
+
return PVR_ERROR_NO_ERROR;
}
@@ -406,8 +414,10 @@ bool cVNSIData::GetTimersList(ADDON_HANDLE handle)
PVR_TIMER tag;
memset(&tag, 0, sizeof(tag));
- /* TODO: Implement own timer types to get support for the timer features introduced with PVR API 1.9.7 */
- tag.iTimerType = PVR_TIMER_TYPE_NONE;
+ if (GetProtocol() >= 9)
+ {
+ tag.iTimerType = vresp->extract_U32();
+ }
tag.iClientIndex = vresp->extract_U32();
int iActive = vresp->extract_U32();
@@ -432,6 +442,12 @@ bool cVNSIData::GetTimersList(ADDON_HANDLE handle)
tag.iMarginStart = 0;
tag.iMarginEnd = 0;
+ if (GetProtocol() >= 9)
+ {
+ char *epgSearch = vresp->extract_String();
+ strncpy(tag.strEpgSearchString, epgSearch, sizeof(tag.strEpgSearchString) - 1);
+ }
+
PVR->TransferTimerEntry(handle, &tag);
}
}
@@ -499,6 +515,11 @@ PVR_ERROR cVNSIData::AddTimer(const PVR_TIMER &timerinfo)
uint32_t starttime = timerinfo.startTime - timerinfo.iMarginStart*60;
uint32_t endtime = timerinfo.endTime + timerinfo.iMarginEnd*60;
+ if (GetProtocol() >= 9)
+ {
+ vrp.add_U32(timerinfo.iTimerType);
+ }
+
vrp.add_U32(timerinfo.state == PVR_TIMER_STATE_SCHEDULED);
vrp.add_U32(timerinfo.iPriority);
vrp.add_U32(timerinfo.iLifetime);
@@ -510,6 +531,11 @@ PVR_ERROR cVNSIData::AddTimer(const PVR_TIMER &timerinfo)
vrp.add_String(path.c_str());
vrp.add_String("");
+ if (GetProtocol() >= 9)
+ {
+ vrp.add_String(timerinfo.strEpgSearchString);
+ }
+
auto vresp = ReadResult(&vrp);
if (vresp == NULL || vresp->noResponse())
{
@@ -572,7 +598,12 @@ PVR_ERROR cVNSIData::UpdateTimer(const PVR_TIMER &timerinfo)
cRequestPacket vrp;
vrp.init(VNSI_TIMER_UPDATE);
+
vrp.add_U32(timerinfo.iClientIndex);
+ if (GetProtocol() >= 9)
+ {
+ vrp.add_U32(timerinfo.iTimerType);
+ }
vrp.add_U32(timerinfo.state == PVR_TIMER_STATE_SCHEDULED);
vrp.add_U32(timerinfo.iPriority);
vrp.add_U32(timerinfo.iLifetime);
@@ -584,6 +615,11 @@ PVR_ERROR cVNSIData::UpdateTimer(const PVR_TIMER &timerinfo)
vrp.add_String(timerinfo.strTitle);
vrp.add_String("");
+ if (GetProtocol() >= 9)
+ {
+ vrp.add_String(timerinfo.strEpgSearchString);
+ }
+
auto vresp = ReadResult(&vrp);
if (vresp == NULL || vresp->noResponse())
{
@@ -600,6 +636,72 @@ PVR_ERROR cVNSIData::UpdateTimer(const PVR_TIMER &timerinfo)
return PVR_ERROR_NO_ERROR;
}
+PVR_ERROR cVNSIData::GetTimerTypes(PVR_TIMER_TYPE types[], int *size)
+{
+ *size = 0;
+ // One-shot manual
+ memset(&types[*size], 0, sizeof(types[*size]));
+ types[*size].iId = VNSI_TIMER_TYPE_MAN;
+ strncpy(types[*size].strDescription, XBMC->GetLocalizedString(30200), 64);
+ types[*size].iAttributes = PVR_TIMER_TYPE_IS_MANUAL |
+ PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE |
+ PVR_TIMER_TYPE_SUPPORTS_CHANNELS |
+ PVR_TIMER_TYPE_SUPPORTS_START_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_END_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_PRIORITY |
+ PVR_TIMER_TYPE_SUPPORTS_LIFETIME |
+ PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS;
+
+ (*size)++;
+
+ // Repeating manual
+ memset(&types[*size], 0, sizeof(types[*size]));
+ types[*size].iId = VNSI_TIMER_TYPE_MAN_REPEAT;
+ strncpy(types[*size].strDescription, XBMC->GetLocalizedString(30201), 64);
+ types[*size].iAttributes = PVR_TIMER_TYPE_IS_MANUAL |
+ PVR_TIMER_TYPE_IS_REPEATING |
+ PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE |
+ PVR_TIMER_TYPE_SUPPORTS_CHANNELS |
+ PVR_TIMER_TYPE_SUPPORTS_START_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_END_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_PRIORITY |
+ PVR_TIMER_TYPE_SUPPORTS_LIFETIME |
+ PVR_TIMER_TYPE_SUPPORTS_FIRST_DAY |
+ PVR_TIMER_TYPE_SUPPORTS_WEEKDAYS |
+ PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS;
+ (*size)++;
+
+ // One-shot epg-based
+ memset(&types[*size], 0, sizeof(types[*size]));
+ types[*size].iId = VNSI_TIMER_TYPE_EPG;
+ strncpy(types[*size].strDescription, XBMC->GetLocalizedString(30202), 64);
+ types[*size].iAttributes = PVR_TIMER_TYPE_SUPPORTS_ENABLE_DISABLE |
+ PVR_TIMER_TYPE_REQUIRES_EPG_TAG_ON_CREATE |
+ PVR_TIMER_TYPE_SUPPORTS_CHANNELS |
+ PVR_TIMER_TYPE_SUPPORTS_START_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_END_TIME |
+ PVR_TIMER_TYPE_SUPPORTS_PRIORITY |
+ PVR_TIMER_TYPE_SUPPORTS_LIFETIME |
+ PVR_TIMER_TYPE_SUPPORTS_RECORDING_FOLDERS;
+ (*size)++;
+
+ // addition timer supported by backend
+ if (GetProtocol() >= 9)
+ {
+ cRequestPacket vrp;
+ vrp.init(VNSI_TIMER_GETTYPES);
+ auto vresp = ReadResult(&vrp);
+ if (!vresp)
+ {
+ XBMC->Log(LOG_ERROR, "%s - Can't get response packed", __FUNCTION__);
+ return PVR_ERROR_NO_ERROR;
+ }
+ uint32_t types = vresp->extract_U32();
+ }
+
+ return PVR_ERROR_NO_ERROR;
+}
+
int cVNSIData::GetRecordingsCount()
{
cRequestPacket vrp;
@@ -641,6 +743,25 @@ PVR_ERROR cVNSIData::GetRecordingsList(ADDON_HANDLE handle)
char *strChannelName = vresp->extract_String();
strncpy(tag.strChannelName, strChannelName, sizeof(tag.strChannelName) - 1);
+ if (GetProtocol() >= 9)
+ {
+ tag.iChannelUid = -1;
+ uint32_t uuid = vresp->extract_U32();
+ if (uuid > 0)
+ tag.iChannelUid = uuid;
+ uint8_t type = vresp->extract_U8();
+ if (type == 1)
+ tag.iChannelUid = PVR_RECORDING_CHANNEL_TYPE_TV;
+ else if (type == 2)
+ tag.iChannelUid = PVR_RECORDING_CHANNEL_TYPE_RADIO;
+ else
+ tag.channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
+ }
+ else
+ {
+ tag.iChannelUid = PVR_CHANNEL_INVALID_UID;
+ tag.channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
+ }
char *strTitle = vresp->extract_String();
strncpy(tag.strTitle, strTitle, sizeof(tag.strTitle) - 1);
@@ -656,14 +777,6 @@ PVR_ERROR cVNSIData::GetRecordingsList(ADDON_HANDLE handle)
strRecordingId.Format("%i", vresp->extract_U32());
strncpy(tag.strRecordingId, strRecordingId.c_str(), sizeof(tag.strRecordingId) - 1);
-
- /* TODO: PVR API 5.0.0: Implement this */
- tag.iChannelUid = PVR_CHANNEL_INVALID_UID;
-
- /* TODO: PVR API 5.1.0: Implement this */
- tag.channelType = PVR_RECORDING_CHANNEL_TYPE_UNKNOWN;
-
- PVR->TransferRecordingEntry(handle, &tag);
}
return PVR_ERROR_NO_ERROR;
@@ -793,6 +906,12 @@ PVR_ERROR cVNSIData::GetDeletedRecordingsList(ADDON_HANDLE handle)
char *strChannelName = vresp->extract_String();
strncpy(tag.strChannelName, strChannelName, sizeof(tag.strChannelName) - 1);
+ if (GetProtocol() >= 9)
+ {
+ tag.iChannelUid = vresp->extract_S32();
+ }
+ else
+ tag.iChannelUid = PVR_CHANNEL_INVALID_UID;
char *strTitle = vresp->extract_String();
strncpy(tag.strTitle, strTitle, sizeof(tag.strTitle) - 1);
@@ -809,9 +928,6 @@ PVR_ERROR cVNSIData::GetDeletedRecordingsList(ADDON_HANDLE handle)
strRecordingId.Format("%i", vresp->extract_U32());
strncpy(tag.strRecordingId, strRecordingId.c_str(), sizeof(tag.strRecordingId) - 1);
- /* TODO: PVR API 5.0.0: Implement this */
- tag.iChannelUid = PVR_CHANNEL_INVALID_UID;
-
PVR->TransferRecordingEntry(handle, &tag);
}
diff --git a/src/VNSIData.h b/src/VNSIData.h
index cc147f5..0bcb006 100644
--- a/src/VNSIData.h
+++ b/src/VNSIData.h
@@ -59,6 +59,7 @@ public:
PVR_ERROR DeleteTimer(const PVR_TIMER &timerinfo, bool force = false);
PVR_ERROR RenameTimer(const PVR_TIMER &timerinfo, const char *newname);
PVR_ERROR UpdateTimer(const PVR_TIMER &timerinfo);
+ PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *size);
int GetRecordingsCount();
PVR_ERROR GetRecordingsList(ADDON_HANDLE handle);
diff --git a/src/client.cpp b/src/client.cpp
index 9d159ed..2b2fcd2 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -26,6 +26,7 @@
#include "VNSIData.h"
#include "VNSIChannelScan.h"
#include "VNSIAdmin.h"
+#include "vnsicommand.h"
#include "p8-platform/util/util.h"
#include <sstream>
@@ -218,7 +219,8 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
}
free(buffer);
- try {
+ try
+ {
VNSIData = new cVNSIData;
if (!VNSIData->Open(g_szHostname, g_iPort, NULL, g_szWolMac))
{
@@ -240,7 +242,9 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
return m_CurStatus;
}
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
ADDON_Destroy();
m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
@@ -530,7 +534,6 @@ PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio)
}
}
-
/*******************************************/
/** PVR Channelgroups Functions **/
@@ -576,26 +579,39 @@ PVR_ERROR GetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP &g
}
}
-
/*******************************************/
/** PVR Timer Functions **/
+
PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *size)
{
- /* TODO: Implement this to get support for the timer features introduced with PVR API 1.9.7 */
- return PVR_ERROR_NOT_IMPLEMENTED;
+ if (!VNSIData)
+ return PVR_ERROR_SERVER_ERROR;
+
+ try
+ {
+ return VNSIData->GetTimerTypes(types, size);
+ }
+ catch (std::exception e)
+ {
+ XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
+ return PVR_ERROR_SERVER_ERROR;
+ }
}
int GetTimersAmount(void)
{
if (!VNSIData)
- return 0;
+ return PVR_ERROR_SERVER_ERROR;
- try {
+ try
+ {
return VNSIData->GetTimersCount();
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
- return 0;
+ return PVR_ERROR_SERVER_ERROR;
}
}
@@ -604,10 +620,12 @@ PVR_ERROR GetTimers(ADDON_HANDLE handle)
if (!VNSIData)
return PVR_ERROR_SERVER_ERROR;
- try {
- /* TODO: Change implementation to get support for the timer features introduced with PVR API 1.9.7 */
+ try
+ {
return (VNSIData->GetTimersList(handle) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
return PVR_ERROR_SERVER_ERROR;
}
@@ -618,9 +636,12 @@ PVR_ERROR AddTimer(const PVR_TIMER &timer)
if (!VNSIData)
return PVR_ERROR_SERVER_ERROR;
- try {
+ try
+ {
return VNSIData->AddTimer(timer);
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
return PVR_ERROR_SERVER_ERROR;
}
@@ -631,9 +652,12 @@ PVR_ERROR DeleteTimer(const PVR_TIMER &timer, bool bForce)
if (!VNSIData)
return PVR_ERROR_SERVER_ERROR;
- try {
+ try
+ {
return VNSIData->DeleteTimer(timer, bForce);
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
return PVR_ERROR_SERVER_ERROR;
}
@@ -644,9 +668,12 @@ PVR_ERROR UpdateTimer(const PVR_TIMER &timer)
if (!VNSIData)
return PVR_ERROR_SERVER_ERROR;
- try {
+ try
+ {
return VNSIData->UpdateTimer(timer);
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
return PVR_ERROR_SERVER_ERROR;
}
@@ -935,14 +962,17 @@ bool OpenRecordedStream(const PVR_RECORDING &recording)
CloseRecordedStream();
VNSIRecording = new cVNSIRecording;
- try {
+ try
+ {
return VNSIRecording->OpenRecording(recording);
- } catch (std::exception e) {
+ }
+ catch (std::exception e)
+ {
XBMC->Log(LOG_ERROR, "%s - %s", __FUNCTION__, e.what());
VNSIRecording->Close();
delete VNSIRecording;
VNSIRecording = NULL;
- return NULL;
+ return false;
}
}
diff --git a/src/vnsicommand.h b/src/vnsicommand.h
index b506fcb..495d747 100644
--- a/src/vnsicommand.h
+++ b/src/vnsicommand.h
@@ -23,7 +23,7 @@
#define VNSI_COMMAND_H
/** Current VNSI Protocol Version number */
-#define VNSI_PROTOCOLVERSION 8
+#define VNSI_PROTOCOLVERSION 9
/** Start of RDS support protocol Version */
#define VNSI_RDS_PROTOCOLVERSION 8
@@ -91,6 +91,7 @@
#define VNSI_TIMER_ADD 83
#define VNSI_TIMER_DELETE 84
#define VNSI_TIMER_UPDATE 85
+#define VNSI_TIMER_GETTYPES 86
/* OPCODE 100 - 119: VNSI network functions for recording access */
#define VNSI_RECORDINGS_DISKSIZE 100
@@ -158,6 +159,13 @@
#define VNSI_STATUS_RECORDINGSCHANGE 5
#define VNSI_STATUS_EPGCHANGE 6
+/** Timer */
+#define VNSI_TIMER_TYPE_MAN 1
+#define VNSI_TIMER_TYPE_MAN_REPEAT 2
+#define VNSI_TIMER_TYPE_EPG 3
+#define VNSI_TIMER_TYPE_VPS 4
+#define VNSI_TIMER_TYPE_EPG_SEARCH 5
+
/** Packet return codes */
#define VNSI_RET_OK 0
#define VNSI_RET_RECRUNNING 1
--
kodi-pvr-vdr-vnsi packaging
More information about the pkg-multimedia-commits
mailing list