Skip to content

Commit

Permalink
multi resume setting added, changed the way length live stream is ret…
Browse files Browse the repository at this point in the history
…urned
  • Loading branch information
krustyreturns committed Dec 7, 2013
1 parent fa1a6e0 commit 8fca2bc
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 25 deletions.
4 changes: 4 additions & 0 deletions addons/pvr.wmc/addon/resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ msgctxt "#30015"
msgid "Refresh SignalStatus Interval (sec)"
msgstr ""

msgctxt "#30016"
msgid "Store viewing resume times on server"
msgstr ""

msgctxt "#30020"
msgid "All tuners for this channel are busy"
msgstr ""
Expand Down
1 change: 1 addition & 0 deletions addons/pvr.wmc/addon/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<settings>
<setting id="host" type="text" label="30000" default="127.0.0.1" />
<setting id="port" type="number" label="30002" default="9080" />
<setting id="multiResume" type="bool" label="30016" default="true" />
<setting id="signal" type="bool" label="30014" default="false" />
<setting id="signal_throttle" type="number" label="30015" default="10" />
</settings>
30 changes: 16 additions & 14 deletions addons/pvr.wmc/src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ using namespace ADDON;
#define DEFAULT_PORT 9080
#define DEFAULT_SIGNAL_ENABLE false
#define DEFAULT_SIGNAL_THROTTLE 10
#define DEFAULT_MULTI_RESUME true

Pvr2Wmc* _wmc = NULL;
bool _bCreated = false;
Expand All @@ -47,6 +48,7 @@ CStdString g_strClientName; // the name of the computer running addon
int g_port;
bool g_bSignalEnable;
int g_signalThrottle;
bool g_bEnableMultiResume;
CStdString g_clientOS; // OS of client, passed to server

/* User adjustable settings are saved here.
Expand Down Expand Up @@ -75,6 +77,7 @@ extern "C" {
g_port = DEFAULT_PORT;
g_bSignalEnable = DEFAULT_SIGNAL_ENABLE;
g_signalThrottle = DEFAULT_SIGNAL_THROTTLE;
g_bEnableMultiResume = DEFAULT_MULTI_RESUME;

/* Read setting "port" from settings.xml */
if (!XBMC->GetSetting("port", &g_port))
Expand All @@ -101,6 +104,12 @@ extern "C" {
{
XBMC->Log(LOG_ERROR, "Couldn't get 'signal_throttle' setting, using '%s'", DEFAULT_SIGNAL_THROTTLE);
}

if (!XBMC->GetSetting("multiResume", &g_bEnableMultiResume))
{
XBMC->Log(LOG_ERROR, "Couldn't get 'multiResume' setting, using '%s'", DEFAULT_MULTI_RESUME);
}


// get the name of the computer client is running on
#ifdef TARGET_WINDOWS
Expand Down Expand Up @@ -293,11 +302,7 @@ extern "C" {
pCapabilities->bHandlesInputStream = true;
pCapabilities->bHandlesDemuxing = false;
pCapabilities->bSupportsChannelScan = false;
#ifdef _GOTHAM_
pCapabilities->bSupportsLastPlayedPosition = true;
#else
pCapabilities->bSupportsLastPlayedPosition = false;
#endif
pCapabilities->bSupportsLastPlayedPosition = g_bEnableMultiResume;

return PVR_ERROR_NO_ERROR;
}
Expand Down Expand Up @@ -614,23 +619,20 @@ extern "C" {
return PVR_ERROR_NO_ERROR;
}

#ifdef _GOTHAM_

PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition)
{
if (_wmc)
if (_wmc && g_bEnableMultiResume)
return _wmc->SetRecordingLastPlayedPosition(recording, lastplayedposition);
return PVR_ERROR_NOT_IMPLEMENTED;
}
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
{
if (_wmc)
if (_wmc && g_bEnableMultiResume)
return _wmc->GetRecordingLastPlayedPosition(recording);
return -1;
}
#else
PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition) { return PVR_ERROR_NOT_IMPLEMENTED; }
int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording) { return -1; }
#endif


#ifdef _GOTHAM_
PVR_ERROR CallMenuHook(const PVR_MENUHOOK &menuhook, const PVR_MENUHOOK_DATA &item)
Expand Down Expand Up @@ -661,8 +663,8 @@ extern "C" {
#ifdef _GOTHAM_
PVR_ERROR GetRecordingEdl(const PVR_RECORDING&, PVR_EDL_ENTRY[], int*) { return PVR_ERROR_NOT_IMPLEMENTED; };
time_t GetPlayingTime() { return 0; }
time_t GetBufferTimeStart() { return 0; }
time_t GetBufferTimeEnd() { return 0; }
time_t GetBufferTimeStart() { return 0; }
time_t GetBufferTimeEnd() { return 0; }
#endif

}
1 change: 1 addition & 0 deletions addons/pvr.wmc/src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extern CStdString g_clientOS; // OS of client, passed to server
extern int g_port;
extern bool g_bSignalEnable;
extern int g_signalThrottle;
extern bool g_bEnableMultiResume;
extern ADDON::CHelper_libXBMC_addon *XBMC;
extern CHelper_libXBMC_pvr *PVR;
extern CHelper_libXBMC_gui *GUI;
4 changes: 2 additions & 2 deletions addons/pvr.wmc/src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
inline CStdString PVRWMC_GetClientVersion()
{
#ifdef _GOTHAM_
return "0.2.92, Gotham 1014"; // ALSO CHANGE IN REV NUMBER in 'addon.xml.in'
return "0.2.92"; // ALSO CHANGE IN REV NUMBER in 'addon.xml.in'
#else
return "0.1.92, build 1014"; // ALSO CHANGE IN REV NUMBER in 'addon.xml.in'
return "0.1.92"; // ALSO CHANGE IN REV NUMBER in 'addon.xml.in'
#endif
}
16 changes: 7 additions & 9 deletions addons/pvr.wmc/src/pvr2wmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,9 @@ PVR_ERROR Pvr2Wmc::GetRecordings(ADDON_HANDLE handle)
xRec.iLifetime = atoi(v[12].c_str());
xRec.iGenreType = atoi(v[13].c_str());
xRec.iGenreSubType = atoi(v[14].c_str());
#ifdef _GOTHAM_
xRec.iLastPlayedPosition = atoi(v[15].c_str());
#endif
if (g_bEnableMultiResume)
xRec.iLastPlayedPosition = atoi(v[15].c_str());

PVR->TransferRecordingEntry(handle, &xRec);
}
Expand Down Expand Up @@ -669,7 +669,7 @@ PVR_ERROR Pvr2Wmc::SetRecordingLastPlayedPosition(const PVR_RECORDING &recording
int Pvr2Wmc::GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
{
CStdString command;
command.Format("GetResumePosition|%s", recording.strRecordingId);
command.Format("GetResumePosition|%s", recording.strRecordingId);
int pos = _socketClient.GetInt(command);
return pos;
}
Expand Down Expand Up @@ -925,11 +925,9 @@ long long Pvr2Wmc::ActualFileSize(int count)
// return the length of the current stream file
long long Pvr2Wmc::LengthLiveStream(void)
{
long long fSize = ActualFileSize(0);
if (fSize > 0)
return fSize;
else
return -1;
if (_lastStreamSize > 0)
return _lastStreamSize;
return -1;
}

void Pvr2Wmc::PauseStream(bool bPaused)
Expand Down

0 comments on commit 8fca2bc

Please sign in to comment.