Skip to content

Commit

Permalink
Add expert option to force the entire playlist to be Media. Useful no…
Browse files Browse the repository at this point in the history
…w that multiple instances are supported
  • Loading branch information
phunkyfish committed Apr 10, 2023
1 parent e98946e commit 2b8e5fa
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ More detail on these can be found in [Supported M3U and XMLTV elements](#support
- `Never` - Never use it.
- `Always append` - Always append it.
- `When no media-dir is present` - Only use the group title of the M3U when no media-dir is provided.
* **Force all M3U entries to be media**: Force the full playlist to be media, regardless of what tags are present. Since the introduction of multiple instances for PVR add-ons this option can be useful.
* **Include VODs as media**: Show VOD as recordings if enabled. If disabled only M3U entries with media attributes will be shown as PVR recordings.

### Timeshift
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 @@ -610,6 +610,14 @@
</constraints>
<control type="spinner" format="integer" />
</setting>
<setting id="mediaForcePlaylist" type="boolean" parent="mediaEnabled" label="30160" help="30807">
<level>2</level>
<default>false</default>
<dependencies>
<dependency type="enable" setting="mediaEnabled" operator="is">true</dependency>
</dependencies>
<control type="toggle" />
</setting>
<setting id="mediaVODAsRecordings" type="boolean" parent="mediaEnabled" label="30154" help="30804">
<level>2</level>
<default>true</default>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ msgctxt "#30159"
msgid "When no media-dir is present"
msgstr ""

#. label: Media - mediaForcePlaylist
msgctxt "#30160"
msgid "Force all M3U entries to be media"
msgstr ""

#empty strings from id 30161 to 30449

#. label: TV
Expand Down Expand Up @@ -1093,4 +1098,9 @@ msgstr ""
#. label: Media - mediaM3UGroupPath
msgctxt "#30806"
msgid "Select how to use the M3U group title in the path. Note that it will only be used if a single group name is provided. The options are: [B]Never[/B] - Never use it; [B]Always append[/B] - Always append it; [B]When no media-dir is present[/B] - Only use the group title of the M3U when no media-dir is provided."
msgstr ""

#. label: Media - mediaForcePlaylist
msgctxt "#30806"
msgid "Force the full playlist to be media, regardless of what tags are present. Since the introduction of multiple instances for PVR add-ons this option can be useful."
msgstr ""
5 changes: 4 additions & 1 deletion src/iptvsimple/InstanceSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ void InstanceSettings::ReadSettings()
m_instance.CheckInstanceSettingEnum<EpgLogosMode>("logoFromEpg", m_epgLogosMode);
m_instance.CheckInstanceSettingBoolean("useLogosLocalPathOnly", m_useLocalLogosOnly);

// Media m_mediaEnabled
// Media
m_instance.CheckInstanceSettingBoolean("mediaEnabled", m_mediaEnabled);
m_instance.CheckInstanceSettingBoolean("mediaVODAsRecordings", m_showVodAsRecordings);
m_instance.CheckInstanceSettingBoolean("mediaGroupByTitle", m_groupMediaByTitle);
m_instance.CheckInstanceSettingBoolean("mediaGroupBySeason", m_groupMediaBySeason);
m_instance.CheckInstanceSettingEnum<MediaUseM3UGroupPathMode>("mediaM3UGroupPath", m_mediaUseM3UGroupPathMode);
m_instance.CheckInstanceSettingBoolean("mediaForcePlaylist", m_mediaForcePlaylist);
m_instance.CheckInstanceSettingBoolean("mediaTitleSeasonEpisode", m_includeShowInfoInMediaTitle);

// Timeshift
Expand Down Expand Up @@ -282,6 +283,8 @@ ADDON_STATUS InstanceSettings::SetSetting(const std::string& settingName, const
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_includeShowInfoInMediaTitle, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "mediaM3UGroupPath")
return SetEnumSetting<MediaUseM3UGroupPathMode, ADDON_STATUS>(settingName, settingValue, m_mediaUseM3UGroupPathMode, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "mediaForcePlaylist")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_mediaForcePlaylist, ADDON_STATUS_OK, ADDON_STATUS_OK);
else if (settingName == "mediaVODAsRecordings")
return SetSetting<bool, ADDON_STATUS>(settingName, settingValue, m_showVodAsRecordings, ADDON_STATUS_OK, ADDON_STATUS_OK);
// Timeshift
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/InstanceSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ namespace iptvsimple
bool GroupMediaByTitle() const { return m_groupMediaByTitle; }
bool GroupMediaBySeason() const { return m_groupMediaBySeason; }
const MediaUseM3UGroupPathMode& GetMediaUseM3UGroupPathMode() { return m_mediaUseM3UGroupPathMode; }
bool MediaForcePlaylist() const { return m_mediaForcePlaylist; }
bool IncludeShowInfoInMediaTitle() const { return m_includeShowInfoInMediaTitle; }

bool IsTimeshiftEnabled() const { return m_timeshiftEnabled; }
Expand Down Expand Up @@ -305,7 +306,7 @@ namespace iptvsimple
bool m_groupMediaBySeason = true;
bool m_includeShowInfoInMediaTitle = false;
MediaUseM3UGroupPathMode m_mediaUseM3UGroupPathMode = MediaUseM3UGroupPathMode::IGNORE_GROUP_NAME;

bool m_mediaForcePlaylist = false;
bool m_showVodAsRecordings = true;

// Timeshift
Expand Down
3 changes: 2 additions & 1 deletion src/iptvsimple/PlaylistLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ bool PlaylistLoader::LoadPlayList()

isMediaEntry = line.find(MEDIA) != std::string::npos ||
line.find(MEDIA_DIR) != std::string::npos ||
line.find(MEDIA_SIZE) != std::string::npos;
line.find(MEDIA_SIZE) != std::string::npos ||
m_settings->MediaForcePlaylist();

const std::string groupNamesListString = ParseIntoChannel(line, tmpChannel, tmpMediaEntry, currentChannelGroupIdList, epgTimeShift, catchupCorrectionSecs, xeevCatchup);

Expand Down

0 comments on commit 2b8e5fa

Please sign in to comment.