Skip to content

Commit

Permalink
Merge pull request kodi-pvr#285 from Glenn-1990/revert_PR257
Browse files Browse the repository at this point in the history
Revert "[htsp v26] implement server based playcount and playposition"
  • Loading branch information
ksooo committed Feb 9, 2017
2 parents fb5933a + 0345957 commit 1caa390
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 94 deletions.
2 changes: 1 addition & 1 deletion pvr.hts/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hts"
version="4.0.7"
version="4.0.8"
name="Tvheadend HTSP Client"
provider-name="Adam Sutton, Sam Stenvall, Lars Op den Kamp, Kai Sommerfeld">
<requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.hts/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
4.0.8
- revert server based playstatus, tvheadend is not compatible at the moment

4.0.7
- fixed duplicate 'prevent duplicate episodes' timer settings values

Expand Down
60 changes: 1 addition & 59 deletions src/Tvheadend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,10 +452,6 @@ PVR_ERROR CTvheadend::GetRecordings ( ADDON_HANDLE handle )
/* Lifetime (based on retention or removal) */
rec.iLifetime = recording.GetLifetime();

/* Play status */
rec.iPlayCount = recording.GetPlayCount();
rec.iLastPlayedPosition = recording.GetPlayPosition();

/* Directory */
// TODO: Move this logic to GetPath(), alternatively GetMangledPath()
if (recording.GetPath() != "")
Expand Down Expand Up @@ -602,51 +598,6 @@ PVR_ERROR CTvheadend::RenameRecording ( const PVR_RECORDING &rec )
return SendDvrUpdate(m);
}

PVR_ERROR CTvheadend::SetPlayCount ( const PVR_RECORDING &rec, int playCount )
{
if (m_conn.GetProtocol() < 26)
return PVR_ERROR_NOT_IMPLEMENTED;

Logger::Log(LogLevel::LEVEL_DEBUG, "Setting play count to %i for recording %s", playCount, rec.strRecordingId);

/* Build message */
htsmsg_t *m = htsmsg_create_map();
htsmsg_add_u32(m, "id", atoi(rec.strRecordingId));
htsmsg_add_u32(m, "playcount", playCount);
return SendDvrUpdate(m);
}

PVR_ERROR CTvheadend::SetPlayPosition ( const PVR_RECORDING &rec, int playPosition )
{
if (m_conn.GetProtocol() < 26)
return PVR_ERROR_NOT_IMPLEMENTED;

Logger::Log(LogLevel::LEVEL_DEBUG, "Setting play position to %i for recording %s", playPosition, rec.strRecordingId);

/* Build message */
htsmsg_t *m = htsmsg_create_map();
htsmsg_add_u32(m, "id", atoi(rec.strRecordingId));
htsmsg_add_u32(m, "playposition", playPosition);
return SendDvrUpdate(m);
}

int CTvheadend::GetPlayPosition ( const PVR_RECORDING &rec )
{
if (m_conn.GetProtocol() < 26)
return PVR_ERROR_NOT_IMPLEMENTED;

const auto &it = m_recordings.find(atoi(rec.strRecordingId));
if (it != m_recordings.end() && it->second.IsRecording())
{
int playPosition = it->second.GetPlayPosition();
Logger::Log(LogLevel::LEVEL_DEBUG, "Getting play position %i for recording %s", playPosition, rec.strRecordingId);

return it->second.GetPlayPosition();
}

return PVR_ERROR_INVALID_PARAMETERS;
}

namespace
{
struct TimerType : PVR_TIMER_TYPE
Expand Down Expand Up @@ -1937,7 +1888,7 @@ void CTvheadend::ParseChannelDelete ( htsmsg_t *msg )
void CTvheadend::ParseRecordingAddOrUpdate ( htsmsg_t *msg, bool bAdd )
{
const char *state, *str;
uint32_t id, channel, eventId, retention, removal, priority, enabled, playCount, playPosition;
uint32_t id, channel, eventId, retention, removal, priority, enabled;
int64_t start, stop, startExtra, stopExtra;

/* Channels must be complete */
Expand Down Expand Up @@ -2155,15 +2106,6 @@ void CTvheadend::ParseRecordingAddOrUpdate ( htsmsg_t *msg, bool bAdd )
}
}

/* Play status (optional) */
if (m_conn.GetProtocol() >= 26)
{
if (!htsmsg_get_u32(msg, "playcount", &playCount))
rec.SetPlayCount(playCount);
if (!htsmsg_get_u32(msg, "playposition", &playPosition))
rec.SetPlayPosition(playPosition);
}

/* Update */
if (rec != comparison)
{
Expand Down
3 changes: 0 additions & 3 deletions src/Tvheadend.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ class CTvheadend
int *num );
PVR_ERROR DeleteRecording ( const PVR_RECORDING &rec );
PVR_ERROR RenameRecording ( const PVR_RECORDING &rec );
PVR_ERROR SetPlayCount ( const PVR_RECORDING &rec, int playcount );
PVR_ERROR SetPlayPosition ( const PVR_RECORDING &rec, int playposition );
int GetPlayPosition ( const PVR_RECORDING &rec );
PVR_ERROR GetTimerTypes ( PVR_TIMER_TYPE types[], int *size );
int GetTimerCount ( void );
PVR_ERROR GetTimers ( ADDON_HANDLE handle );
Expand Down
33 changes: 16 additions & 17 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,6 @@ PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
pCapabilities->bHandlesInputStream = true;
pCapabilities->bHandlesDemuxing = true;
pCapabilities->bSupportsRecordingEdl = true;
pCapabilities->bSupportsRecordingPlayCount = (tvh->GetProtocol() >= 26);
pCapabilities->bSupportsLastPlayedPosition = (tvh->GetProtocol() >= 26);

return PVR_ERROR_NO_ERROR;
}
Expand Down Expand Up @@ -452,21 +450,6 @@ PVR_ERROR DeleteAllRecordingsFromTrash()
return PVR_ERROR_NOT_IMPLEMENTED;
}

PVR_ERROR SetRecordingPlayCount(const PVR_RECORDING &recording, int count)
{
return tvh->SetPlayCount(recording, count);
}

PVR_ERROR SetRecordingLastPlayedPosition(const PVR_RECORDING &recording, int lastplayedposition)
{
return tvh->SetPlayPosition(recording, lastplayedposition);
}

int GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
{
return tvh->GetPlayPosition(recording);
}

PVR_ERROR GetTimerTypes(PVR_TIMER_TYPE types[], int *size)
{
return tvh->GetTimerTypes(types, size);
Expand Down Expand Up @@ -537,6 +520,22 @@ long long LengthRecordedStream(void)

unsigned int GetChannelSwitchDelay(void) { return 0; }

/* Recording History */
PVR_ERROR SetRecordingPlayCount
(const PVR_RECORDING &_unused(recording), int _unused(count))
{
return PVR_ERROR_NOT_IMPLEMENTED;
}
PVR_ERROR SetRecordingLastPlayedPosition
(const PVR_RECORDING &_unused(recording), int _unused(lastplayedposition))
{
return PVR_ERROR_NOT_IMPLEMENTED;
}
int GetRecordingLastPlayedPosition(const PVR_RECORDING &_unused(recording))
{
return -1;
}

/* Channel Management */
PVR_ERROR OpenDialogChannelScan(void)
{
Expand Down
16 changes: 2 additions & 14 deletions src/tvheadend/entity/Recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ namespace tvheadend
m_stopExtra(0),
m_state(PVR_TIMER_STATE_ERROR),
m_lifetime(0),
m_priority(50), // Kodi default - "normal"
m_playCount(0),
m_playPosition(0)
m_priority(50) // Kodi default - "normal"
{
}

Expand All @@ -89,9 +87,7 @@ namespace tvheadend
m_state == other.m_state &&
m_error == other.m_error &&
m_lifetime == other.m_lifetime &&
m_priority == other.m_priority &&
m_playCount == other.m_playCount &&
m_playPosition == other.m_playPosition;
m_priority == other.m_priority;
}

bool operator!=(const Recording &other) const
Expand Down Expand Up @@ -191,12 +187,6 @@ namespace tvheadend
uint32_t GetPriority() const { return m_priority; }
void SetPriority(uint32_t priority) { m_priority = priority; }

uint32_t GetPlayCount() const { return m_playCount; }
void SetPlayCount(uint32_t playCount) { m_playCount = playCount; }

uint32_t GetPlayPosition() const { return m_playPosition; }
void SetPlayPosition(uint32_t playPosition) { m_playPosition = playPosition; }

private:
uint32_t m_enabled;
uint32_t m_channel;
Expand All @@ -217,8 +207,6 @@ namespace tvheadend
std::string m_error;
uint32_t m_lifetime;
uint32_t m_priority;
uint32_t m_playCount;
uint32_t m_playPosition;
};
}
}

0 comments on commit 1caa390

Please sign in to comment.