Skip to content

Commit

Permalink
Merge pull request #437 from phunkyfish/timeshift-other-streams
Browse files Browse the repository at this point in the history
Timeshift other streams
  • Loading branch information
phunkyfish authored Oct 6, 2020
2 parents a1587b4 + 26173b2 commit 2d74e93
Show file tree
Hide file tree
Showing 20 changed files with 101 additions and 1,375 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ set(IPTV_SOURCES src/PVRIptvData.cpp
src/iptvsimple/utilities/FileUtils.cpp
src/iptvsimple/utilities/Logger.cpp
src/iptvsimple/utilities/StreamUtils.cpp
src/iptvsimple/utilities/StringUtils.cpp
src/iptvsimple/utilities/WebUtils.cpp)

set(IPTV_HEADERS src/PVRIptvData.h
Expand All @@ -53,7 +52,6 @@ set(IPTV_HEADERS src/PVRIptvData.h
src/iptvsimple/utilities/FileUtils.h
src/iptvsimple/utilities/Logger.h
src/iptvsimple/utilities/StreamUtils.h
src/iptvsimple/utilities/StringUtils.h
src/iptvsimple/utilities/WebUtils.h
src/iptvsimple/utilities/XMLUtils.h)

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ For any TS stream an additional property should be added to every M3U entry usin
```

* **Enable timeshift**: Enable the timeshift feature.
* **Enable timeshift for all streams**: Enable the timeshift feature for all streams. Will only apply to streams that do not select a specific inputstream addon for playback. The `inputstream.ffmpegdirect` addon will be used for timeshift."
* **Enable timeshift for HTTP based streams**: Enable the timeshift feature for HTTP based streams. Will only apply to streams that do not select a specific inputstream addon for playback. The `inputstream.ffmpegdirect` addon will be used for timeshift."
* **Enable timeshift for UDP based streams**: Enable the timeshift feature for UDP based streams. Will only apply to streams that do not select a specific inputstream addon for playback. The `inputstream.ffmpegdirect` addon will be used for timeshift."
* **Always enable timeshift stream mode if missing**: If a `stream_mode` property is not specified along with an `inputstream.ffmpegdirect` property always add it for any supported stream types. Note that this setting has no effect on catchup VOD streams that are not live.
* **Modify inputstream.ffmpegdirect settings..**: Open settings dialog for inputstream.ffmpegdirect for modification of timeshift and other settings.

Expand Down
7 changes: 6 additions & 1 deletion pvr.iptvsimple/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.iptvsimple"
version="6.3.2"
version="6.4.0"
name="PVR IPTV Simple Client"
provider-name="nightik and Ross Nicholson">
<requires>@ADDON_DEPENDS@
Expand Down Expand Up @@ -169,6 +169,11 @@
<icon>icon.png</icon>
</assets>
<news>
v6.4.0
- Added: Add options to support both UDP and all stream types when using timeshift feature
- Fixed: README spelling corrections
- Update: Use add-on supplied StringUtils and remove local version

v6.3.2
- Update: Remove p8-platforms and add local StringUtils for cpp17

Expand Down
5 changes: 5 additions & 0 deletions pvr.iptvsimple/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v6.4.0
- Added: Add options to support both UDP and all stream types when using timeshift feature
- Fixed: README spelling corrections
- Update: Use add-on supplied StringUtils and remove local version

v6.3.2
- Update: Remove p8-platforms and add local StringUtils for cpp17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ msgctxt "#30121"
msgid "Enable timeshift"
msgstr ""

#. label: Timeshift - timeshiftHttp
#. label: Timeshift - timeshiftEnabledHttp
msgctxt "#30122"
msgid "Enable timeshift for HTTP based streams"
msgstr ""
Expand All @@ -395,7 +395,17 @@ msgctxt "#30125"
msgid "Always enable timeshift stream mode if missing"
msgstr ""

#empty strings from id 30126 to 30449
#. label: Timeshift - timeshiftEnabledAll
msgctxt "#30126"
msgid "Enable timeshift for all streams"
msgstr ""

#. label: Timeshift - timeshiftEnabledUdp
msgctxt "#30127"
msgid "Enable timeshift for UDP based streams"
msgstr ""

#empty strings from id 30128 to 30449

#. label: TV
msgctxt "#30450"
Expand Down Expand Up @@ -693,7 +703,7 @@ msgstr ""

#. help: Timeshift - timeshiftEnabledHttp
msgctxt "#30722"
msgid "Enable the timeshift feature for HTTP based streams. Will only apply to streams that do not select a specific inputstream addon for playback. . The `inputstream.ffmpegdirect` addon will be used for timeshift."
msgid "Enable the timeshift feature for HTTP based streams. Will only apply to streams that do not select a specific inputstream addon for playback. . The inputstream.ffmpegdirect addon will be used for timeshift."
msgstr ""

#. help: Timeshift - timeshiftFFmpegdirectSettings
Expand All @@ -705,3 +715,13 @@ msgstr ""
msgctxt "#30724"
msgid "If a stream_mode property is not specified along with an inputstream.ffmpegdirect property always add it for any supported stream types. Note that this setting has no effect on catchup VOD streams that are not live."
msgstr ""

#. help: Timeshift - timeshiftEnabledAll
msgctxt "#30725"
msgid "Enable the timeshift feature for all streams. Will only apply to streams that do not select a specific inputstream addon for playback. The inputstream.ffmpegdirect addon will be used for timeshift."
msgstr ""

#. help: Timeshift - timeshiftEnabledUdp
msgctxt "#30726"
msgid "Enable the timeshift feature for UDP based streams. Will only apply to streams that do not select a specific inputstream addon for playback. The inputstream.ffmpegdirect addon will be used for timeshift."
msgstr ""
28 changes: 27 additions & 1 deletion pvr.iptvsimple/resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,40 @@
<default>false</default>
<control type="toggle" />
</setting>
<setting id="timeshiftEnabledHttp" type="boolean" parent="timeshiftEnabled" label="30122" help="30722">
<setting id="timeshiftEnabledAll" type="boolean" parent="timeshiftEnabled" label="30126" help="30725">
<level>0</level>
<default>true</default>
<dependencies>
<dependency type="enable" setting="timeshiftEnabled" operator="is">true</dependency>
</dependencies>
<control type="toggle" />
</setting>
<setting id="timeshiftEnabledHttp" type="boolean" parent="timeshiftEnabledAll" label="30122" help="30722">
<level>0</level>
<default>true</default>
<dependencies>
<dependency type="enable">
<and>
<condition setting="timeshiftEnabled" operator="is">true</condition>
<condition setting="timeshiftEnabledAll" operator="!is">true</condition>
</and>
</dependency>
</dependencies>
<control type="toggle" />
</setting>
<setting id="timeshiftEnabledUdp" type="boolean" parent="timeshiftEnabledAll" label="30127" help="30726">
<level>0</level>
<default>true</default>
<dependencies>
<dependency type="enable">
<and>
<condition setting="timeshiftEnabled" operator="is">true</condition>
<condition setting="timeshiftEnabledAll" operator="!is">true</condition>
</and>
</dependency>
</dependencies>
<control type="toggle" />
</setting>
<setting id="timeshiftEnabledCustom" type="boolean" parent="timeshiftEnabled" label="30125" help="30724">
<level>2</level>
<default>false</default>
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/CatchupController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@
#include "Settings.h"
#include "data/Channel.h"
#include "utilities/Logger.h"
#include "utilities/StringUtils.h"

#include <regex>

#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down
4 changes: 3 additions & 1 deletion src/iptvsimple/Channels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
#include "Settings.h"
#include "utilities/FileUtils.h"
#include "utilities/Logger.h"
#include "utilities/StringUtils.h"

#include <regex>

#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/Epg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
#include "utilities/FileUtils.h"
#include "utilities/Logger.h"
#include "utilities/XMLUtils.h"
#include "utilities/StringUtils.h"

#include <chrono>
#include <regex>
#include <thread>

#include <kodi/tools/StringUtils.h>
#include <pugixml.hpp>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "utilities/FileUtils.h"
#include "utilities/Logger.h"
#include "utilities/WebUtils.h"
#include "utilities/StringUtils.h"

#include <chrono>
#include <cstdlib>
Expand All @@ -22,7 +21,9 @@
#include <vector>

#include <kodi/General.h>
#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down
6 changes: 6 additions & 0 deletions src/iptvsimple/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ void Settings::ReadFromAddon(const std::string& userPath, const std::string& cli

// Timeshift
m_timeshiftEnabled = kodi::GetSettingBoolean("timeshiftEnabled", false);
m_timeshiftEnabledAll = kodi::GetSettingBoolean("timeshiftEnabledAll", false);
m_timeshiftEnabledHttp = kodi::GetSettingBoolean("timeshiftEnabledHttp", false);
m_timeshiftEnabledUdp = kodi::GetSettingBoolean("timeshiftEnabledUdp", false);
m_timeshiftEnabledCustom = kodi::GetSettingBoolean("timeshiftEnabledCustom", false);

// Catchup
Expand Down Expand Up @@ -143,8 +145,12 @@ ADDON_STATUS Settings::SetValue(const std::string& settingName, const kodi::CSet
// Timeshift
else if (settingName == "timeshiftEnabled")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_timeshiftEnabled, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "timeshiftEnabledAll")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_timeshiftEnabledAll, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "timeshiftEnabledHttp")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_timeshiftEnabledHttp, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "timeshiftEnabledUdp")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_timeshiftEnabledUdp, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "timeshiftEnabledCustom")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_timeshiftEnabledCustom, ADDON_STATUS_OK, ADDON_STATUS_OK);
// Catchup
Expand Down
4 changes: 4 additions & 0 deletions src/iptvsimple/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ namespace iptvsimple
const EpgLogosMode& GetEpgLogosMode() const { return m_epgLogosMode; }

bool IsTimeshiftEnabled() const { return m_timeshiftEnabled; }
bool IsTimeshiftEnabledAll() const { return m_timeshiftEnabledAll; }
bool IsTimeshiftEnabledHttp() const { return m_timeshiftEnabledHttp; }
bool IsTimeshiftEnabledUdp() const { return m_timeshiftEnabledUdp; }
bool AlwaysEnableTimeshiftModeIfMissing() const { return m_timeshiftEnabledCustom; }

bool IsCatchupEnabled() const { return m_catchupEnabled; }
Expand Down Expand Up @@ -226,7 +228,9 @@ namespace iptvsimple

// Timeshift
bool m_timeshiftEnabled = false;
bool m_timeshiftEnabledAll = false;
bool m_timeshiftEnabledHttp = false;
bool m_timeshiftEnabledUdp = false;
bool m_timeshiftEnabledCustom = false;

// Catchup
Expand Down
10 changes: 7 additions & 3 deletions src/iptvsimple/data/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
#include "../utilities/FileUtils.h"
#include "../utilities/Logger.h"
#include "../utilities/StreamUtils.h"
#include "../utilities/StringUtils.h"
#include "../utilities/WebUtils.h"

#include <regex>

#include <kodi/General.h>
#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down Expand Up @@ -213,8 +214,11 @@ bool Channel::IsCatchupSupported() const

bool Channel::SupportsLiveStreamTimeshifting() const
{
return Settings::GetInstance().IsTimeshiftEnabled() && Settings::GetInstance().IsTimeshiftEnabledHttp() &&
GetProperty(PVR_STREAM_PROPERTY_ISREALTIMESTREAM) == "true" && StringUtils::StartsWith(m_streamURL, "http");
return Settings::GetInstance().IsTimeshiftEnabled() && GetProperty(PVR_STREAM_PROPERTY_ISREALTIMESTREAM) == "true" &&
(Settings::GetInstance().IsTimeshiftEnabledAll() ||
(Settings::GetInstance().IsTimeshiftEnabledHttp() && StringUtils::StartsWith(m_streamURL, "http")) ||
(Settings::GetInstance().IsTimeshiftEnabledUdp() && StringUtils::StartsWith(m_streamURL, "udp"))
);
}

namespace
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/data/EpgEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
#include "EpgEntry.h"

#include "../Settings.h"
#include "../utilities/StringUtils.h"
#include "../utilities/XMLUtils.h"

#include <cmath>
#include <cstdlib>
#include <regex>

#include <kodi/tools/StringUtils.h>
#include <pugixml.hpp>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace pugi;
Expand Down
4 changes: 3 additions & 1 deletion src/iptvsimple/data/EpgGenre.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
#include "EpgGenre.h"

#include "../utilities/XMLUtils.h"
#include "../utilities/StringUtils.h"

#include <cstdlib>

#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace pugi;
Expand Down
4 changes: 3 additions & 1 deletion src/iptvsimple/utilities/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

#include "Logger.h"

#include "StringUtils.h"

#include <cstdarg>

#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple::utilities;

Logger::Logger()
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/utilities/StreamUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
#include "../Settings.h"
#include "FileUtils.h"
#include "Logger.h"
#include "StringUtils.h"
#include "WebUtils.h"

#include <kodi/General.h>
#include <kodi/tools/StringUtils.h>

using namespace kodi::tools;
using namespace iptvsimple;
using namespace iptvsimple::data;
using namespace iptvsimple::utilities;
Expand Down
Loading

0 comments on commit 2d74e93

Please sign in to comment.