Skip to content

Commit

Permalink
Add setting to work around broken HLS streams provided by pluto.tv (r…
Browse files Browse the repository at this point in the history
…equires inputstream.adaptive > 21.4.5).
  • Loading branch information
ksooo committed Apr 22, 2024
1 parent f11bcc2 commit b737906
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pvr.plutotv/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.plutotv"
version="21.1.1"
version="21.2.0"
name="Pluto.tv PVR Client"
provider-name="Team Kodi, flubshi">
<requires>@ADDON_DEPENDS@
Expand Down
3 changes: 3 additions & 0 deletions pvr.plutotv/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v21.2.0
- Add setting to work around broken HLS streams provided by pluto.tv (requires inputstream.adaptive > 21.4.5)

v21.1.1
- Translations updates from Weblate
- af_za, am_et, ar_sa, ast_es, az_az, be_by, bg_bg, bs_ba, ca_es, cs_cz, cy_gb, da_dk, de_de, el_gr, en_au, en_nz, en_us, eo, es_ar, es_es, es_mx, et_ee, eu_es, fa_af, fa_ir, fi_fi, fo_fo, fr_ca, fr_fr, gl_es, he_il, hi_in, hr_hr, hu_hu, hy_am, id_id, is_is, it_it, ja_jp, ko_kr, lt_lt, lv_lv, mi, mk_mk, ml_in, mn_mn, ms_my, mt_mt, my_mm, nb_no, nl_nl, pl_pl, pt_br, pt_pt, ro_ro, ru_ru, si_lk, sk_sk, sl_si, sq_al, sr_rs, sr_rs@latin, sv_se, szl, ta_in, te_in, tg_tj, th_th, tr_tr, uk_ua, uz_uz, vi_vn, zh_cn, zh_tw
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ msgctxt "#30008"
msgid "First channel number"
msgstr ""

msgctxt "#30009"
msgid "Workaround for broken streams (requires inputstream.adaptive > 21.4.5)"
msgstr ""

msgctxt "#30040"
msgid "Debug"
msgstr ""
Expand Down
24 changes: 12 additions & 12 deletions pvr.plutotv/resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<settings version="1">
<section id="pvr.plutotv">
<category id="credentials" label="30001" help="">
<category id="general" label="30001" help="">
<group id="1" label="">
<setting id="start_channelnum" type="integer" label="30008" help="">
<level>0</level>
Expand All @@ -11,8 +11,12 @@
</constraints>
<control type="edit" format="integer" />
</setting>
<setting id="install_widevine" type="string" label="30007"
help="">
<setting id="workaround_broken_streams" type="boolean" label="30009" help="-1">
<level>2</level>
<default>true</default>
<control type="toggle"/>
</setting>
<setting id="install_widevine" type="string" label="30007" help="">
<level>0</level>
<default />
<constraints>
Expand All @@ -25,8 +29,7 @@
<dependency type="visible" operator="!is"
setting="system.platform.android">true</dependency>
</setting>
<setting id="run_is_info" type="string" label="30006"
help="">
<setting id="run_is_info" type="string" label="30006" help="">
<level>0</level>
<default />
<constraints>
Expand All @@ -35,24 +38,21 @@
<control type="button" format="action">
<data>RunScript(script.module.inputstreamhelper,info)</data>
</control>
<dependency type="visible" operator="!is"
setting="system.platform.android">true</dependency>
<dependency type="visible" operator="!is" setting="system.platform.android">true</dependency>
</setting>
</group>
</category>
<category id="debug" label="30040" help="">
<group id="1" label="">
<setting id="internal_sid" type="string" label="30041"
help="">
<setting id="internal_sid" type="string" label="30041" help="">
<level>3</level>
<default />
<constraints>
<allowempty>true</allowempty>
</constraints>
<control type="edit" format="string"></control>
</setting>
<setting id="internal_deviceid" type="string" label="30042"
help="">
<setting id="internal_deviceid" type="string" label="30042" help="">
<level>3</level>
<default />
<constraints>
Expand All @@ -63,4 +63,4 @@
</group>
</category>
</section>
</settings>
</settings>
11 changes: 8 additions & 3 deletions src/PlutotvData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ void PlutotvData::SetStreamProperties(std::vector<kodi::addon::PVRStreamProperty
properties.emplace_back(PVR_STREAM_PROPERTY_INPUTSTREAM, "inputstream.adaptive");
properties.emplace_back(PVR_STREAM_PROPERTY_ISREALTIMESTREAM, realtime ? "true" : "false");
// HLS
kodi::Log(ADDON_LOG_DEBUG, "[PLAY STREAM] hls");
properties.emplace_back("inputstream.adaptive.manifest_type", "hls");
properties.emplace_back(PVR_STREAM_PROPERTY_MIMETYPE, "application/x-mpegURL");
properties.emplace_back("inputstream.adaptive.manifest_update_parameter", "full");
if (GetSettingsWorkaroundBrokenStreams())
properties.emplace_back("inputstream.adaptive.manifest_config",
"{\"hls_ignore_endlist\":true,\"hls_fix_mediasequence\":true,\"hls_fix_discsequence\":true}");
}

bool PlutotvData::LoadChannelsData()
Expand Down Expand Up @@ -268,6 +268,11 @@ int PlutotvData::GetSettingsStartChannel() const
return kodi::addon::GetSettingInt("start_channelnum", 1);
}

bool PlutotvData::GetSettingsWorkaroundBrokenStreams() const
{
return kodi::addon::GetSettingBoolean("workaround_broken_streams", true);
}

std::string PlutotvData::GetChannelStreamURL(int uniqueId)
{
LoadChannelsData();
Expand Down
1 change: 1 addition & 0 deletions src/PlutotvData.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class ATTR_DLL_LOCAL PlutotvData : public kodi::addon::CAddonBase,
std::string GetChannelStreamURL(int uniqueId);
std::string GetSettingsUUID(const std::string& setting);
int GetSettingsStartChannel() const;
bool GetSettingsWorkaroundBrokenStreams() const;
void SetStreamProperties(std::vector<kodi::addon::PVRStreamProperty>& properties,
const std::string& url,
bool realtime);
Expand Down

0 comments on commit b737906

Please sign in to comment.