Skip to content

Commit

Permalink
Merge pull request #9 from ksooo/pvr-api-1-9-7
Browse files Browse the repository at this point in the history
Minimal support for PVR Addon API 1.9.7
  • Loading branch information
ksooo committed Jul 3, 2015
2 parents ff263c3 + 738ba74 commit 001a939
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pvr.wmc/addon.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.wmc"
version="0.5.6"
version="0.6.0"
name="PVR WMC Client"
provider-name="KrustyReturns and scarecrow420">
<requires>
<c-pluff version="0.1"/>
<import addon="xbmc.pvr" version="1.9.6"/>
<import addon="xbmc.pvr" version="1.9.7"/>
<import addon="xbmc.gui" version="5.8.0"/>
</requires>
<extension
Expand Down
3 changes: 3 additions & 0 deletions pvr.wmc/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.6.0
- Updated to PVR API v1.9.7

0.5.6
- Updated Language files from Transifex

Expand Down
12 changes: 10 additions & 2 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ extern "C" {
pCapabilities->bSupportsChannelScan = false;
pCapabilities->bHandlesInputStream = true;
pCapabilities->bHandlesDemuxing = false;
pCapabilities->bSupportsRecordingFolders = false;
pCapabilities->bSupportsRecordingPlayCount = true;
pCapabilities->bSupportsLastPlayedPosition = g_bEnableMultiResume;
pCapabilities->bSupportsRecordingEdl = false;
Expand Down Expand Up @@ -439,6 +438,12 @@ extern "C" {


// 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;
}

int GetTimersAmount(void)
{
if (_wmc)
Expand All @@ -449,6 +454,7 @@ extern "C" {

PVR_ERROR GetTimers(ADDON_HANDLE handle)
{
/* TODO: Change implementation to get support for the timer features introduced with PVR API 1.9.7 */
if (_wmc)
return _wmc->GetTimers(handle);

Expand All @@ -470,8 +476,10 @@ extern "C" {
return PVR_ERROR_NO_ERROR;
}

PVR_ERROR DeleteTimer(const PVR_TIMER &timer, bool bForceDelete)
PVR_ERROR DeleteTimer(const PVR_TIMER &timer, bool bForceDelete, bool /*bDeleteScheduled*/)
{
/* TODO: Change implementation to support bDeleteScheduled (introduced with PVR API 1.9.7 */

if (_wmc)
return _wmc->DeleteTimer(timer, bForceDelete);
return PVR_ERROR_NO_ERROR;
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@

inline CStdString PVRWMC_GetClientVersion()
{
return "0.5.3"; // ALSO CHANGE IN REV NUMBER in 'pvr.wmc/addon.xml'
return "0.6.0"; // ALSO CHANGE IN REV NUMBER in 'pvr.wmc/addon.xml'
}
8 changes: 5 additions & 3 deletions src/pvr2wmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ CStdString Pvr2Wmc::Timer2String(const PVR_TIMER &xTmr)

tStr.Format("|%d|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d", // format for 11 params:
xTmr.iClientIndex, xTmr.iClientChannelUid, xTmr.startTime, xTmr.endTime, PVR_TIMER_STATE_NEW, // 5 params
xTmr.strTitle, xTmr.iPriority, xTmr.iMarginStart, xTmr.iMarginEnd, xTmr.bIsRepeating, // 5 params
xTmr.strTitle, xTmr.iPriority, xTmr.iMarginStart, xTmr.iMarginEnd, xTmr.iWeekdays != PVR_WEEKDAY_NONE, // 5 params
xTmr.iEpgUid); // 1 param

return tStr;
Expand All @@ -664,7 +664,7 @@ PVR_ERROR Pvr2Wmc::DeleteTimer(const PVR_TIMER &xTmr, bool bForceDelete)

bool deleteSeries = false;

if (xTmr.bIsRepeating) // if timer is a series timer, ask if want to cancel series
if (xTmr.iWeekdays != PVR_WEEKDAY_NONE) // if timer is a series timer, ask if want to cancel series
{
CDialogDeleteTimer vWindow(deleteSeries, xTmr.strTitle);
int dlogResult = vWindow.DoModal();
Expand Down Expand Up @@ -724,6 +724,9 @@ PVR_ERROR Pvr2Wmc::GetTimers(ADDON_HANDLE handle)
continue;
}

/* TODO: Implement own timer types to get support for the timer features introduced with PVR API 1.9.7 */
xTmr.iTimerType = PVR_TIMER_TYPE_NONE;

xTmr.iClientIndex = atoi(v[0].c_str()); // timer index (set to same as Entry ID)
xTmr.iClientChannelUid = atoi(v[1].c_str()); // channel id
xTmr.startTime = atoi(v[2].c_str()); // start time
Expand All @@ -734,7 +737,6 @@ PVR_ERROR Pvr2Wmc::GetTimers(ADDON_HANDLE handle)
STRCPY(xTmr.strDirectory, v[6].c_str()); // rec directory
STRCPY(xTmr.strSummary, v[7].c_str()); // currently set to episode title
xTmr.iPriority = atoi(v[8].c_str()); // rec priority
xTmr.bIsRepeating = Str2Bool(v[9].c_str()); // repeating rec (set to series flag)

xTmr.iEpgUid = atoi(v[10].c_str()); // epg ID (same as client ID, except for a 'manual' record)
xTmr.iMarginStart = atoi(v[11].c_str()); // rec margin at start (sec)
Expand Down

0 comments on commit 001a939

Please sign in to comment.