Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic PVR API impl #833

Open
wants to merge 2 commits into
base: Omega
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Addon settings for catchup:
- `with and without catchup mode (all channels)` - Include all channels ignoring any catchup mode from the M3U.
* **Catchup correction**: Adjust the time used for catchup stream URL generation by this value, from -12 hours to +14 hours. Useful for catchup streams which are geo mis-matched to the wrong time. Note that this value can be overridden by values in the M3U file, see [Supported M3U and XMLTV elements](#supported-m3u-and-xmltv-elements).
* **Play from EPG in Live TV mode (using timeshift)**: When disabled any catchup show from the past will be played like a video (bounded by start and end times). If enabled, it will instead act like a live stream with timeshift, also allowing the ability to skip back and forward programmes. Note that the only effect this option has on streams that do not support timeshifting is whether or not to apply the before/after buffer.
* **Play from Live TV in EPG mode (video playback)**: When disabled any catchup channel will be played using the Live OSD. If enabled, it will instead act like a video (bounded by start and end times), also allowing the ability to skip back and forward programmes, if the previous and next programmes support catchup.
* **Buffer before programme start**: The amount of buffer to give before the playback start point of an EPG entry that will be watched as a video.
* **Buffer after programme end**: The amount of buffer to give after the playback end point of an EPG entry that will be watched as a video.
* **Catchup only available on finished programmes**: When selected from the EPG the current live programme cannot be watched as catchup until finished.
Expand Down
8 changes: 8 additions & 0 deletions pvr.iptvsimple/resources/instance-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,14 @@
</dependencies>
<control type="toggle" />
</setting>
<setting id="catchupPlayLiveAsEpg" type="boolean" label="30129" help="30711">
<level>0</level>
<default>false</default>
<dependencies>
<dependency type="enable" setting="catchupEnabled" operator="is">true</dependency>
</dependencies>
<control type="toggle" />
</setting>
<setting id="catchupWatchEpgBeginBufferMins" type="integer" parent="catchupPlayEpgAsLive" label="30107" help="30706">
<level>0</level>
<default>5</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,12 @@ msgctxt "#30128"
msgid "Catchup correction"
msgstr ""

#empty strings from id 30129 to 30449
#. label: Catchup - catchupPlayLiveAsEpg
msgctxt "#30129"
msgid "Play from Live TV in EPG mode (video playback)"
msgstr ""

#empty strings from id 30130 to 30449

#. category-lavel: Media
#. group-label: Media - Media
Expand Down Expand Up @@ -1024,7 +1029,12 @@ msgctxt "#30710"
msgid "Adjust the time used for catchup stream URL generation by this value, from -12 hours to +14 hours. Useful for catchup streams which are geo mis-matched to the wrong time. Note that this value can be overridden by values in the M3U file."
msgstr ""

#empty strings from id 30711 to 307019
#. help: Catchup - catchupPlayLiveAsEpg
msgctxt "#30711"
msgid "When disabled any catchup channel will be played using the Live OSD. If enabled, it will instead act like a video (bounded by start and end times), also allowing the ability to skip back and forward programmes, if the previous and next programmes support catchup."
msgstr ""

#empty strings from id 30712 to 307019

#. help info - Timeshift

Expand Down
14 changes: 13 additions & 1 deletion src/IptvSimple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ PVR_ERROR IptvSimple::GetChannels(bool radio, kodi::addon::PVRChannelsResultSet&
return m_channels.GetChannels(results, radio);
}

PVR_ERROR IptvSimple::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, std::vector<kodi::addon::PVRStreamProperty>& properties)
PVR_ERROR IptvSimple::GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, PVR_SOURSE source, std::vector<kodi::addon::PVRStreamProperty>& properties)
{
Logger::Log(LogLevel::LEVEL_INFO, "%s - XXXXX fromEpgAsLive: %d", __FUNCTION__, source);


if (GetChannel(channel, m_currentChannel))
{
std::string streamURL = m_currentChannel.GetStreamURL();
Expand Down Expand Up @@ -436,6 +439,15 @@ PVR_ERROR IptvSimple::GetSignalStatus(int channelUid, kodi::addon::PVRSignalStat
return PVR_ERROR_NO_ERROR;
}

/***************************************************************************
* Stream State
**************************************************************************/

void IptvSimple::StreamClosed()
{
Logger::Log(LEVEL_INFO, "%s - XXXX Stream Closed", __FUNCTION__);
}

/***************************************************************************
* InstanceSettings
**************************************************************************/
Expand Down
4 changes: 3 additions & 1 deletion src/IptvSimple.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ATTR_DLL_LOCAL IptvSimple : public iptvsimple::IConnectionListener

PVR_ERROR GetChannelsAmount(int& amount) override;
PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results) override;
PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, std::vector<kodi::addon::PVRStreamProperty>& properties) override;
PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel& channel, std::vector<kodi::addon::PVRStreamProperty>& properties, bool fromEpgAsLive) override;

PVR_ERROR GetChannelGroupsAmount(int& amount) override;
PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& results) override;
Expand All @@ -71,6 +71,8 @@ class ATTR_DLL_LOCAL IptvSimple : public iptvsimple::IConnectionListener

PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus& signalStatus) override;

void StreamClosed() override;

PVR_ERROR GetRecordingsAmount(bool deleted, int& amount) override;
PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results) override;
PVR_ERROR GetRecordingStreamProperties(const kodi::addon::PVRRecording& recording, std::vector<kodi::addon::PVRStreamProperty>& properties) override;
Expand Down
3 changes: 3 additions & 0 deletions src/iptvsimple/CatchupController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ void CatchupController::ProcessChannelForPlayback(const Channel& channel, std::m
{
m_programmeCatchupId = liveEpgEntry->GetCatchupId();
UpdateProgrammeFrom(*liveEpgEntry, channel.GetTvgShift());

if (m_settings->CatchupPlayLiveAsEpg())
catchupProperties.insert({PVR_STREAM_PROPERTY_LIVEPLAYBACKASEPG, "true"});
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/iptvsimple/InstanceSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void InstanceSettings::ReadSettings()
m_instance.CheckInstanceSettingEnum<CatchupOverrideMode>("catchupOverrideMode", m_catchupOverrideMode);
m_instance.CheckInstanceSettingFloat("catchupCorrection", m_catchupCorrectionHours);
m_instance.CheckInstanceSettingBoolean("catchupPlayEpgAsLive", m_catchupPlayEpgAsLive);
m_instance.CheckInstanceSettingBoolean("catchupPlayLiveAsEpg", m_catchupPlayLiveAsEpg);
m_instance.CheckInstanceSettingInt("catchupWatchEpgBeginBufferMins", m_catchupWatchEpgBeginBufferMins);
m_instance.CheckInstanceSettingInt("catchupWatchEpgEndBufferMins", m_catchupWatchEpgEndBufferMins);
m_instance.CheckInstanceSettingBoolean("catchupOnlyOnFinishedProgrammes", m_catchupOnlyOnFinishedProgrammes);
Expand Down Expand Up @@ -319,6 +320,8 @@ ADDON_STATUS InstanceSettings::SetSetting(const std::string& settingName, const
return SetSetting<float, ADDON_STATUS>(settingName, settingValue, m_catchupCorrectionHours, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "catchupPlayEpgAsLive")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_catchupPlayEpgAsLive, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "catchupPlayLiveAsEpg")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_catchupPlayLiveAsEpg, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "catchupWatchEpgBeginBufferMins")
return SetSetting<int, ADDON_STATUS>(settingName, settingValue, m_catchupWatchEpgBeginBufferMins, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "catchupWatchEpgEndBufferMins")
Expand Down
2 changes: 2 additions & 0 deletions src/iptvsimple/InstanceSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ namespace iptvsimple
float GetCatchupCorrectionHours() const { return m_catchupCorrectionHours; }
int GetCatchupCorrectionSecs() const { return static_cast<int>(m_catchupCorrectionHours * 60 * 60); }
bool CatchupPlayEpgAsLive() const { return m_catchupPlayEpgAsLive; }
bool CatchupPlayLiveAsEpg() const { return m_catchupPlayLiveAsEpg; }
int GetCatchupWatchEpgBeginBufferMins() const { return m_catchupWatchEpgBeginBufferMins; }
time_t GetCatchupWatchEpgBeginBufferSecs() const { return static_cast<time_t>(m_catchupWatchEpgBeginBufferMins) * 60; }
int GetCatchupWatchEpgEndBufferMins() const { return m_catchupWatchEpgEndBufferMins; }
Expand Down Expand Up @@ -329,6 +330,7 @@ namespace iptvsimple
CatchupOverrideMode m_catchupOverrideMode = CatchupOverrideMode::WITHOUT_TAGS;
float m_catchupCorrectionHours = 0;
bool m_catchupPlayEpgAsLive = false;
bool m_catchupPlayLiveAsEpg = false;
int m_catchupWatchEpgBeginBufferMins = 5;
int m_catchupWatchEpgEndBufferMins = 15;
bool m_catchupOnlyOnFinishedProgrammes = false;
Expand Down
Loading