From b5176220b9c8cb2ccd4a4009139c4f7d3c3168f6 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Sat, 7 Sep 2024 06:22:28 +0100 Subject: [PATCH 1/2] Move from recordings for IPTV library to PVR Media --- README.md | 10 ++-- .../resources/instance-settings.xml | 2 +- .../resource.language.en_gb/strings.po | 10 ++-- src/IptvSimple.cpp | 38 ++++++--------- src/IptvSimple.h | 6 +-- src/iptvsimple/Epg.cpp | 2 +- src/iptvsimple/InstanceSettings.cpp | 6 +-- src/iptvsimple/InstanceSettings.h | 4 +- src/iptvsimple/Media.cpp | 16 +++---- src/iptvsimple/Media.h | 6 +-- src/iptvsimple/PlaylistLoader.cpp | 11 ++++- src/iptvsimple/PlaylistLoader.h | 1 + src/iptvsimple/data/MediaEntry.cpp | 47 ++++++++++++++----- src/iptvsimple/data/MediaEntry.h | 9 +++- .../utilities/SettingsMigration.cpp | 6 ++- 15 files changed, 103 insertions(+), 71 deletions(-) diff --git a/README.md b/README.md index 9ff59438e..a84324f93 100644 --- a/README.md +++ b/README.md @@ -178,7 +178,7 @@ Settings related to Channel Logos. - `Prefer XMLTV` - Use the channel logo from the XMLTV file if available otherwise use the M3U logo. ### Media -Media entries can be used to access the Video-On-Demand (VOD) library provided by IPTV services. The IPTV media library can be organized either as a plain list of channels or the hierarchy tree made of folders and PVR recordings. +Media entries can be used to access the Video-On-Demand (VOD) library provided by IPTV services. The IPTV media library can be organized either as a plain list of channels or the hierarchy tree made of folders and PVR media items. An M3U entry can denote that it's media by having: * an M3U property of `EXT-X-PLAYLIST-TYPE` set to `VOD`, @@ -188,7 +188,7 @@ More detail on these can be found in [Supported M3U and XMLTV elements](#support Note that the media item will read from the XMLTV file, where it will read just the first entry. The entry must have a start time greater than now and be within the boundaries of the Kodi PVR Guide settings. -* **Show media as recordings**: If enabled, all IPTV media entries can be shown as PVR recordings. Otherwise, they appear as regular PVR channels. +* **Show media as media**: If enabled, all IPTV media entries can be shown as PVR media items. Otherwise, they appear as regular PVR channels. * **Group entries by title**: If multiple entries exist with matching titles, create a virtual folder to group them together. * **Group entries by season**: If multiple entries exist with matching titles, try additionally grouping them in sub-folders representing seasons. * **Include season and episode number in title**: Prepend the season and episode numbers to the title. @@ -197,7 +197,7 @@ Note that the media item will read from the XMLTV file, where it will read just - `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. +* **Include VODs as media**: Show VOD as media if enabled. If disabled only M3U entries with media attributes will be shown as PVR media items. ### Timeshift Timeshift settings for pausing/rewinding and fast-forwarding live streams. @@ -447,7 +447,7 @@ plugin://plugin.video.my-vod-addon/play/catalog/channels/d8659669-b964-414c-aa9c http://path-to-stream/live/channel-l.mkv #EXTINF:-1 media="true",Channel M http://path-to-stream/live/channel-m.mkv -#EXTINF:-1 radio="true" media="true" media-size="102400000",Channel N +#EXTINF:-1 radio="true" media="true" media-size="102400000" media-type="tv-show",Channel N http://path-to-stream/live/channel-n.mkv #EXTINF:-1 media-dir="/movies/scifi",Channel O http://path-to-stream/live/channel-o.mkv @@ -467,7 +467,7 @@ http://path-to-stream/live/channel-o.mkv - For `Channel K` this is an example of a VOD style entry which uses a default `catchup-source` of `{catchup-id}` and will allow playback of any EPG entry with a `catchup-id` past, present or future via a Kodi plugin URL. - For `Channel L` this is a tv media entry specified by the M3U `EXT-X-PLAYLIST-TYPE` property. - For `Channel M` this is a tv media entry specified by the `media` attribute on the M3U entry. -- For `Channel N` this is a radio media entry of size 102400000 bytes. +- For `Channel N` this is a radio media entry of size 102400000 bytes, and the type is a TV show. Available `media-type` values are: `tv-show`, `movie`, `music-video`, `music`, `radio-show` and `podcast`. - For `Channel O` this is a tv media entry specifying a directory path. *Channel k Plugin example:* diff --git a/pvr.iptvsimple/resources/instance-settings.xml b/pvr.iptvsimple/resources/instance-settings.xml index a55fb8481..45c111708 100644 --- a/pvr.iptvsimple/resources/instance-settings.xml +++ b/pvr.iptvsimple/resources/instance-settings.xml @@ -650,7 +650,7 @@ - + 2 true diff --git a/pvr.iptvsimple/resources/language/resource.language.en_gb/strings.po b/pvr.iptvsimple/resources/language/resource.language.en_gb/strings.po index a19e9c82e..57ebd190d 100644 --- a/pvr.iptvsimple/resources/language/resource.language.en_gb/strings.po +++ b/pvr.iptvsimple/resources/language/resource.language.en_gb/strings.po @@ -621,14 +621,14 @@ msgctxt "#30153" msgid "Include season and episode number in title" msgstr "" -#. label: Media - mediaVODAsRecordings +#. label: Media - mediaVODAsMedia msgctxt "#30154" msgid "Include VODs as media" msgstr "" #. label: Media - mediaEnabled msgctxt "#30155" -msgid "Show Media as recordings" +msgid "Show Media as media items" msgstr "" #. label: Media - mediaUseM3UGroupForGrouping @@ -1111,14 +1111,14 @@ msgctxt "#30803" msgid "Prepend the season and episode numbers to the title." msgstr "" -#. help: Media - mediaVODAsRecordings +#. help: Media - mediaVODAsMedia msgctxt "#30804" -msgid "Show VOD as recordings if enabled. If disabled only M3U entries with media attributes will be shown as recordings." +msgid "Show VOD as media if enabled. If disabled only M3U entries with media attributes will be shown as media items." msgstr "" #. label: Media - mediaEnabled msgctxt "#30805" -msgid "If enabled, all IPTV media entries can be shown as PVR recordings. Otherwise, they appear as regular PVR channels." +msgid "If enabled, all IPTV media entries can be shown as PVR media. Otherwise, they appear as regular PVR channels." msgstr "" #. label: Media - mediaM3UGroupPath diff --git a/src/IptvSimple.cpp b/src/IptvSimple.cpp index 2c9fe8ba4..4e47f546d 100644 --- a/src/IptvSimple.cpp +++ b/src/IptvSimple.cpp @@ -106,11 +106,9 @@ PVR_ERROR IptvSimple::GetCapabilities(kodi::addon::PVRCapabilities& capabilities capabilities.SetSupportsRadio(true); capabilities.SetSupportsChannelGroups(true); capabilities.SetSupportsProviders(true); - capabilities.SetSupportsRecordingsRename(false); - capabilities.SetSupportsRecordingsLifetimeChange(false); capabilities.SetSupportsDescrambleInfo(false); - capabilities.SetSupportsRecordings(true); - capabilities.SetSupportsRecordingsDelete(false); + capabilities.SetSupportsMedia(true); + capabilities.SetSupportsMediaTagSize(false); return PVR_ERROR_NO_ERROR; } @@ -380,40 +378,34 @@ PVR_ERROR IptvSimple::SetEPGMaxFutureDays(int epgMaxFutureDays) * Media **************************************************************************/ -PVR_ERROR IptvSimple::GetRecordingsAmount(bool deleted, int& amount) +PVR_ERROR IptvSimple::GetMediaAmount(int& amount) { std::lock_guard lock(m_mutex); - if (deleted) - amount = 0; - else - amount = m_media.GetNumMedia(); + amount = m_media.GetNumMedia(); return PVR_ERROR_NO_ERROR; } -PVR_ERROR IptvSimple::GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet& results) +PVR_ERROR IptvSimple::GetMedia(kodi::addon::PVRMediaTagsResultSet& results) { - if (!deleted) + std::vector media; { - std::vector media; - { - std::lock_guard lock(m_mutex); - m_media.GetMedia(media); - } + std::lock_guard lock(m_mutex); + m_media.GetMedia(media); + } - for (const auto& mediaTag : media) - results.Add(mediaTag); + for (const auto& mediaTag : media) + results.Add(mediaTag); - Logger::Log(LEVEL_DEBUG, "%s - media available '%d'", __func__, media.size()); - } + Logger::Log(LEVEL_DEBUG, "%s - media available '%d'", __func__, media.size()); return PVR_ERROR_NO_ERROR; } -PVR_ERROR IptvSimple::GetRecordingStreamProperties(const kodi::addon::PVRRecording& recording, std::vector& properties) +PVR_ERROR IptvSimple::GetMediaTagStreamProperties(const kodi::addon::PVRMediaTag& mediaTag, std::vector& properties) { - auto mediaEntry = m_media.GetMediaEntry(recording); - std::string url = m_media.GetMediaEntryURL(recording); + auto mediaEntry = m_media.GetMediaEntry(mediaTag); + std::string url = m_media.GetMediaEntryURL(mediaTag); if (!mediaEntry.GetMediaEntryId().empty() && !url.empty()) { diff --git a/src/IptvSimple.h b/src/IptvSimple.h index a4a78a197..38044c080 100644 --- a/src/IptvSimple.h +++ b/src/IptvSimple.h @@ -73,9 +73,9 @@ class ATTR_DLL_LOCAL IptvSimple : public iptvsimple::IConnectionListener PVR_ERROR 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& properties) override; + PVR_ERROR GetMediaAmount(int& amount) override; + PVR_ERROR GetMedia(kodi::addon::PVRMediaTagsResultSet& results) override; + PVR_ERROR GetMediaTagStreamProperties(const kodi::addon::PVRMediaTag& mediaTag, std::vector& properties) override; //@} diff --git a/src/iptvsimple/Epg.cpp b/src/iptvsimple/Epg.cpp index 9ac6286be..0a6195ba7 100644 --- a/src/iptvsimple/Epg.cpp +++ b/src/iptvsimple/Epg.cpp @@ -356,7 +356,7 @@ void Epg::ReloadEPG() for (const auto& myChannel : m_channels.GetChannelsList()) m_client->TriggerEpgUpdate(myChannel.GetUniqueId()); - m_client->TriggerRecordingUpdate(); + m_client->TriggerMediaUpdate(); } } diff --git a/src/iptvsimple/InstanceSettings.cpp b/src/iptvsimple/InstanceSettings.cpp index 612fbebf7..1a5132e2e 100644 --- a/src/iptvsimple/InstanceSettings.cpp +++ b/src/iptvsimple/InstanceSettings.cpp @@ -121,7 +121,7 @@ void InstanceSettings::ReadSettings() // Media m_instance.CheckInstanceSettingBoolean("mediaEnabled", m_mediaEnabled); - m_instance.CheckInstanceSettingBoolean("mediaVODAsRecordings", m_showVodAsRecordings); + m_instance.CheckInstanceSettingBoolean("mediaVODAsMedia", m_showVodAsMedia); m_instance.CheckInstanceSettingBoolean("mediaGroupByTitle", m_groupMediaByTitle); m_instance.CheckInstanceSettingBoolean("mediaGroupBySeason", m_groupMediaBySeason); m_instance.CheckInstanceSettingEnum("mediaM3UGroupPath", m_mediaUseM3UGroupPathMode); @@ -291,8 +291,8 @@ ADDON_STATUS InstanceSettings::SetSetting(const std::string& settingName, const return SetEnumSetting(settingName, settingValue, m_mediaUseM3UGroupPathMode, ADDON_STATUS_OK, ADDON_STATUS_OK); else if (settingName == "mediaForcePlaylist") return SetSetting(settingName, settingValue, m_mediaForcePlaylist, ADDON_STATUS_OK, ADDON_STATUS_OK); - else if (settingName == "mediaVODAsRecordings") - return SetSetting(settingName, settingValue, m_showVodAsRecordings, ADDON_STATUS_OK, ADDON_STATUS_OK); + else if (settingName == "mediaVODAsMedia") + return SetSetting(settingName, settingValue, m_showVodAsMedia, ADDON_STATUS_OK, ADDON_STATUS_OK); // Timeshift else if (settingName == "timeshiftEnabled") return SetSetting(settingName, settingValue, m_timeshiftEnabled, ADDON_STATUS_OK, ADDON_STATUS_OK); diff --git a/src/iptvsimple/InstanceSettings.h b/src/iptvsimple/InstanceSettings.h index 7ed875b87..927dee770 100644 --- a/src/iptvsimple/InstanceSettings.h +++ b/src/iptvsimple/InstanceSettings.h @@ -142,7 +142,7 @@ namespace iptvsimple bool UseLocalLogosOnlyIgnoreM3U() const { return m_useLocalLogosOnly; } bool IsMediaEnabled() const { return m_mediaEnabled; } - bool ShowVodAsRecordings() const { return m_showVodAsRecordings; } + bool ShowVodAsMedia() const { return m_showVodAsMedia; } bool GroupMediaByTitle() const { return m_groupMediaByTitle; } bool GroupMediaBySeason() const { return m_groupMediaBySeason; } const MediaUseM3UGroupPathMode& GetMediaUseM3UGroupPathMode() { return m_mediaUseM3UGroupPathMode; } @@ -312,7 +312,7 @@ namespace iptvsimple bool m_includeShowInfoInMediaTitle = false; MediaUseM3UGroupPathMode m_mediaUseM3UGroupPathMode = MediaUseM3UGroupPathMode::IGNORE_GROUP_NAME; bool m_mediaForcePlaylist = false; - bool m_showVodAsRecordings = true; + bool m_showVodAsMedia = true; // Timeshift bool m_timeshiftEnabled = false; diff --git a/src/iptvsimple/Media.cpp b/src/iptvsimple/Media.cpp index 97968b64a..ec14738f0 100644 --- a/src/iptvsimple/Media.cpp +++ b/src/iptvsimple/Media.cpp @@ -22,16 +22,16 @@ Media::Media(std::shared_ptr& settings) : m_settin { } -void Media::GetMedia(std::vector& kodiRecordings) +void Media::GetMedia(std::vector& kodiMedia) { for (auto& mediaEntry : m_media) { Logger::Log(LEVEL_DEBUG, "%s - Transfer mediaEntry '%s', MediaEntry Id '%s'", __func__, mediaEntry.GetTitle().c_str(), mediaEntry.GetMediaEntryId().c_str()); - kodi::addon::PVRRecording kodiRecording; + kodi::addon::PVRMediaTag kodiMediaEntry; - mediaEntry.UpdateTo(kodiRecording, IsInVirtualMediaEntryFolder(mediaEntry), m_haveMediaTypes); + mediaEntry.UpdateTo(kodiMediaEntry, IsInVirtualMediaEntryFolder(mediaEntry), m_haveMediaTypes); - kodiRecordings.emplace_back(kodiRecording); + kodiMedia.emplace_back(kodiMediaEntry); } } @@ -136,18 +136,18 @@ bool Media::IsInVirtualMediaEntryFolder(const MediaEntry& mediaEntryToCheck) con return false; } -const MediaEntry Media::GetMediaEntry(const kodi::addon::PVRRecording& recording) +const MediaEntry Media::GetMediaEntry(const kodi::addon::PVRMediaTag& mediaTag) { Logger::Log(LEVEL_INFO, "%s", __func__); - return GetMediaEntry(recording.GetRecordingId()); + return GetMediaEntry(mediaTag.GetMediaTagId()); } -const std::string Media::GetMediaEntryURL(const kodi::addon::PVRRecording& recording) +const std::string Media::GetMediaEntryURL(const kodi::addon::PVRMediaTag& mediaTag) { Logger::Log(LEVEL_INFO, "%s", __func__); - auto mediaEntry = GetMediaEntry(recording.GetRecordingId()); + auto mediaEntry = GetMediaEntry(mediaTag.GetMediaTagId()); if (!mediaEntry.GetMediaEntryId().empty()) return mediaEntry.GetStreamURL(); diff --git a/src/iptvsimple/Media.h b/src/iptvsimple/Media.h index 57a58032c..8b416db16 100644 --- a/src/iptvsimple/Media.h +++ b/src/iptvsimple/Media.h @@ -22,11 +22,11 @@ namespace iptvsimple { public: Media(std::shared_ptr& settings); - void GetMedia(std::vector& kodiRecordings); + void GetMedia(std::vector& kodiMedia); int GetNumMedia() const; void Clear(); - const data::MediaEntry GetMediaEntry(const kodi::addon::PVRRecording& mediaEntry); - const std::string GetMediaEntryURL(const kodi::addon::PVRRecording& mediaEntry); + const data::MediaEntry GetMediaEntry(const kodi::addon::PVRMediaTag& mediaEntry); + const std::string GetMediaEntryURL(const kodi::addon::PVRMediaTag& mediaEntry); const iptvsimple::data::MediaEntry* FindMediaEntry(const std::string& id, const std::string& displayName) const; bool AddMediaEntry(iptvsimple::data::MediaEntry& entry, std::vector& groupIdList, iptvsimple::ChannelGroups& channelGroups, bool channelHadGroups); diff --git a/src/iptvsimple/PlaylistLoader.cpp b/src/iptvsimple/PlaylistLoader.cpp index eca0343cc..5153f1d01 100644 --- a/src/iptvsimple/PlaylistLoader.cpp +++ b/src/iptvsimple/PlaylistLoader.cpp @@ -175,6 +175,7 @@ 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_TYPE) != std::string::npos || m_settings->MediaForcePlaylist(); overrideRealTime = GetOverrideRealTime(line); @@ -224,7 +225,7 @@ bool PlaylistLoader::LoadPlayList() Logger::Log(LEVEL_DEBUG, "%s - Adding channel or Media Entry '%s' with URL: '%s'", __FUNCTION__, tmpChannel.GetChannelName().c_str(), line.c_str()); if (m_settings->IsMediaEnabled() && - (isMediaEntry || (m_settings->ShowVodAsRecordings() && !isRealTime))) + (isMediaEntry || (m_settings->ShowVodAsMedia() && !isRealTime))) { MediaEntry entry = tmpMediaEntry; entry.UpdateFrom(tmpChannel); @@ -340,6 +341,7 @@ std::string PlaylistLoader::ParseIntoChannel(const std::string& line, Channel& c std::string strMedia = ReadMarkerValue(infoLine, MEDIA); std::string strMediaDir = ReadMarkerValue(infoLine, MEDIA_DIR); std::string strMediaSize = ReadMarkerValue(infoLine, MEDIA_SIZE); + std::string strMediaType = ReadMarkerValue(infoLine, MEDIA_TYPE); kodi::UnknownToUTF8(strTvgName, strTvgName); kodi::UnknownToUTF8(strCatchupSource, strCatchupSource); @@ -521,6 +523,11 @@ std::string PlaylistLoader::ParseIntoChannel(const std::string& line, Channel& c if (!strMediaSize.empty()) mediaEntry.SetSizeInBytes(std::strtoll(strMediaSize.c_str(), nullptr, 10)); + if (!strMediaType.empty()) + { + mediaEntry.SetMediaType(strMediaType); + } + return groupNames; } @@ -595,7 +602,7 @@ void PlaylistLoader::ReloadPlayList() m_client->TriggerChannelUpdate(); m_client->TriggerChannelGroupsUpdate(); m_client->TriggerProvidersUpdate(); - m_client->TriggerRecordingUpdate(); + m_client->TriggerMediaUpdate(); } else { diff --git a/src/iptvsimple/PlaylistLoader.h b/src/iptvsimple/PlaylistLoader.h index 6366a50d1..15a77e3a2 100644 --- a/src/iptvsimple/PlaylistLoader.h +++ b/src/iptvsimple/PlaylistLoader.h @@ -48,6 +48,7 @@ namespace iptvsimple static const std::string MEDIA = "media="; static const std::string MEDIA_DIR = "media-dir="; static const std::string MEDIA_SIZE = "media-size="; + static const std::string MEDIA_TYPE = "media-type="; static const std::string REALTIME_OVERRIDE = "realtime=\""; static const std::string KODIPROP_MARKER = "#KODIPROP:"; static const std::string EXTVLCOPT_MARKER = "#EXTVLCOPT:"; diff --git a/src/iptvsimple/data/MediaEntry.cpp b/src/iptvsimple/data/MediaEntry.cpp index b01df07fa..a7fea8b4f 100644 --- a/src/iptvsimple/data/MediaEntry.cpp +++ b/src/iptvsimple/data/MediaEntry.cpp @@ -55,6 +55,7 @@ void MediaEntry::Reset() m_providerUniqueId = PVR_PROVIDER_INVALID_UID; m_directory.clear(); m_sizeInBytes = 0; + m_mediaType = PVR_MEDIA_TAG_TYPE_UNKNOWN; m_tvgShift = 0; } @@ -245,23 +246,23 @@ void MediaEntry::SetDirectory(const std::string& value) } -void MediaEntry::UpdateTo(kodi::addon::PVRRecording& left, bool isInVirtualMediaEntryFolder, bool haveMediaTypes) +void MediaEntry::UpdateTo(kodi::addon::PVRMediaTag& left, bool isInVirtualMediaEntryFolder, bool haveMediaTypes) { left.SetTitle(CreateTitle(m_title, m_seasonNumber, m_episodeNumber, m_settings)); left.SetPlotOutline(m_plotOutline); left.SetPlot(m_plot); - // left.SetCast(m_cast); - // left.SetDirector(m_director); - // left.SetWriter(m_writer); + left.SetCast(m_cast); + left.SetDirector(m_director); + left.SetWriter(m_writer); left.SetYear(m_year); left.SetIconPath(m_iconPath); left.SetGenreType(m_genreType); left.SetGenreSubType(m_genreSubType); left.SetGenreDescription(m_genreString); - // if (m_parentalRatingSystem.empty()) - // left.SetParentalRatingCode(m_parentalRating); - // else - // left.SetParentalRatingCode(m_parentalRatingSystem + "-" + m_parentalRating); + if (m_parentalRatingSystem.empty()) + left.SetParentalRatingCode(m_parentalRating); + else + left.SetParentalRatingCode(m_parentalRatingSystem + "-" + m_parentalRating); // left.SetStarRating(m_starRating); left.SetSeriesNumber(m_seasonNumber); left.SetEpisodeNumber(m_episodeNumber); @@ -276,18 +277,19 @@ void MediaEntry::UpdateTo(kodi::addon::PVRRecording& left, bool isInVirtualMedia left.SetFlags(iFlags); // From Media Tag - left.SetRecordingId(m_mediaEntryId); - left.SetRecordingTime(m_startTime); + left.SetMediaTagId(m_mediaEntryId); + left.SetMediaTagTime(m_startTime); left.SetDuration(m_duration); left.SetPlayCount(m_playCount); left.SetLastPlayedPosition(m_lastPlayedPosition); left.SetProviderName(m_providerName); left.SetClientProviderUid(m_providerUniqueId); if (m_radio) - left.SetChannelType(PVR_RECORDING_CHANNEL_TYPE_RADIO); + left.SetSectionType(PVR_MEDIA_TAG_SECTION_TYPE_RADIO); else - left.SetChannelType(PVR_RECORDING_CHANNEL_TYPE_TV); + left.SetSectionType(PVR_MEDIA_TAG_SECTION_TYPE_TV); left.SetSizeInBytes(m_sizeInBytes); + left.SetMediaType(m_mediaType); std::string newDirectory = FixPath(m_directory); if (m_settings->GroupMediaByTitle() && isInVirtualMediaEntryFolder) @@ -320,3 +322,24 @@ std::string MediaEntry::GetProperty(const std::string& propName) const return {}; } + +void MediaEntry::SetMediaType(const std::string& value) +{ + std::string valueLower = value; + StringUtils::ToLower(valueLower); + + if (valueLower == "tv-show") + m_mediaType = PVR_MEDIA_TAG_TYPE_TV_SHOW; + else if (valueLower == "movie") + m_mediaType = PVR_MEDIA_TAG_TYPE_MOVIE; + else if (valueLower == "music-video") + m_mediaType = PVR_MEDIA_TAG_TYPE_MUSIC_VIDEO; + else if (valueLower == "music") + m_mediaType = PVR_MEDIA_TAG_TYPE_MUSIC; + else if (valueLower == "radio-show") + m_mediaType = PVR_MEDIA_TAG_TYPE_RADIO_SHOW; + else if (valueLower == "podcast") + m_mediaType = PVR_MEDIA_TAG_TYPE_PODCAST; + else + m_mediaType = PVR_MEDIA_TAG_TYPE_UNKNOWN; +} diff --git a/src/iptvsimple/data/MediaEntry.h b/src/iptvsimple/data/MediaEntry.h index 30b4def1c..c95220c71 100644 --- a/src/iptvsimple/data/MediaEntry.h +++ b/src/iptvsimple/data/MediaEntry.h @@ -15,7 +15,7 @@ #include #include -#include +#include namespace iptvsimple { @@ -68,6 +68,10 @@ namespace iptvsimple int64_t GetSizeInBytes() const { return m_sizeInBytes; } void SetSizeInBytes(int64_t value) { m_sizeInBytes = value; } + PVR_MEDIA_TAG_TYPE GetMediaType() const { return m_mediaType; } + void SetMediaType(const std::string& value); + void SetMediaType(PVR_MEDIA_TAG_TYPE value) { m_mediaType = value; } + const std::string& GetFolderTitle() const { return m_folderTitle; } void SetFolderTitle(const std::string& value); @@ -91,7 +95,7 @@ namespace iptvsimple void UpdateFrom(iptvsimple::data::Channel channel); void UpdateFrom(iptvsimple::data::EpgEntry epgEntry, const std::vector& genres); - void UpdateTo(kodi::addon::PVRRecording& left, bool isInVirtualMediaEntryFolder, bool haveMediaTypes); + void UpdateTo(kodi::addon::PVRMediaTag& left, bool isInVirtualMediaEntryFolder, bool haveMediaTypes); std::string GetMatchTextFromString(const std::string& text, const std::regex& pattern) { @@ -126,6 +130,7 @@ namespace iptvsimple int m_providerUniqueId = PVR_PROVIDER_INVALID_UID; std::string m_directory; int64_t m_sizeInBytes = 0; + PVR_MEDIA_TAG_TYPE m_mediaType = PVR_MEDIA_TAG_TYPE_UNKNOWN; std::string m_folderTitle; // EPG lookup diff --git a/src/iptvsimple/utilities/SettingsMigration.cpp b/src/iptvsimple/utilities/SettingsMigration.cpp index 7ccd7cd1d..a6f7a65db 100644 --- a/src/iptvsimple/utilities/SettingsMigration.cpp +++ b/src/iptvsimple/utilities/SettingsMigration.cpp @@ -185,7 +185,11 @@ void SettingsMigration::MigrateBoolSetting(const char* key, bool defaultValue) bool value; if (kodi::addon::CheckSettingBoolean(key, value) && value != defaultValue) { - m_target.SetInstanceSettingBoolean(key, value); + const std::string stringKey = key; + if (stringKey == "mediaVODAsRecordings") + m_target.SetInstanceSettingBoolean("mediaVODAsMedia", value); + else + m_target.SetInstanceSettingBoolean(key, value); m_changed = true; } } From af4cf2489941cea7875fa0b1648702e978ead9f8 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Sat, 5 Oct 2024 11:02:16 +0100 Subject: [PATCH 2/2] changelog and version 22.3.0 --- pvr.iptvsimple/addon.xml.in | 2 +- pvr.iptvsimple/changelog.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pvr.iptvsimple/addon.xml.in b/pvr.iptvsimple/addon.xml.in index 712b22b26..214f93486 100644 --- a/pvr.iptvsimple/addon.xml.in +++ b/pvr.iptvsimple/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.iptvsimple/changelog.txt b/pvr.iptvsimple/changelog.txt index 5116ada36..ab5847082 100644 --- a/pvr.iptvsimple/changelog.txt +++ b/pvr.iptvsimple/changelog.txt @@ -1,3 +1,6 @@ +v22.3.0 +- Move from recordings for IPTV library to PVR Media + v22.2.0 - Correctly set inputstream properties for media entries