1 /* 2 * Copyright (C) 2005-2021 Team Kodi (https://kodi.tv) 3 * 4 * SPDX-License-Identifier: GPL-2.0-or-later 5 * See LICENSE.md for more information. 6 */ 7 8 #pragma once 9 10 #include "Channels.h" 11 #include "ChannelGroups.h" 12 13 #include <string> 14 15 #include <kodi/addon-instance/PVR.h> 16 17 namespace iptvsimple 18 { 19 static const std::string M3U_START_MARKER = "#EXTM3U"; 20 static const std::string M3U_INFO_MARKER = "#EXTINF"; 21 static const std::string M3U_GROUP_MARKER = "#EXTGRP:"; 22 static const std::string TVG_URL_MARKER = "x-tvg-url="; 23 static const std::string TVG_URL_OTHER_MARKER = "url-tvg="; 24 static const std::string TVG_INFO_ID_MARKER = "tvg-id="; 25 static const std::string TVG_INFO_ID_MARKER_UC = "tvg-ID="; //some provider incorrectly use an uppercase ID 26 static const std::string TVG_INFO_NAME_MARKER = "tvg-name="; 27 static const std::string TVG_INFO_LOGO_MARKER = "tvg-logo="; 28 static const std::string TVG_INFO_SHIFT_MARKER = "tvg-shift="; 29 static const std::string TVG_INFO_CHNO_MARKER = "tvg-chno="; 30 static const std::string TVG_INFO_REC = "tvg-rec="; // some providers use 'tvg-rec' instead of 'catchup-days' 31 static const std::string GROUP_NAME_MARKER = "group-title="; 32 static const std::string CATCHUP = "catchup="; 33 static const std::string CATCHUP_TYPE = "catchup-type="; 34 static const std::string CATCHUP_DAYS = "catchup-days="; 35 static const std::string CATCHUP_SOURCE = "catchup-source="; 36 static const std::string CATCHUP_SIPTV = "timeshift="; 37 static const std::string CATCHUP_CORRECTION = "catchup-correction="; 38 static const std::string KODIPROP_MARKER = "#KODIPROP:"; 39 static const std::string EXTVLCOPT_MARKER = "#EXTVLCOPT:"; 40 static const std::string EXTVLCOPT_DASH_MARKER = "#EXTVLCOPT--"; 41 static const std::string RADIO_MARKER = "radio="; 42 static const std::string PLAYLIST_TYPE_MARKER = "#EXT-X-PLAYLIST-TYPE:"; 43 44 class PlaylistLoader 45 { 46 public: 47 PlaylistLoader(kodi::addon::CInstancePVRClient* client, iptvsimple::Channels& channels, iptvsimple::ChannelGroups& channelGroups); 48 49 bool Init(); 50 51 bool LoadPlayList(); 52 void ReloadPlayList(); 53 54 private: 55 static std::string ReadMarkerValue(const std::string& line, const std::string& markerName); 56 static void ParseSinglePropertyIntoChannel(const std::string& line, iptvsimple::data::Channel& channel, const std::string& markerName); 57 58 std::string ParseIntoChannel(const std::string& line, iptvsimple::data::Channel& channel, std::vector<int>& groupIdList, int epgTimeShift, int catchupCorrectionSecs, bool xeevCatchup); 59 void ParseAndAddChannelGroups(const std::string& groupNamesListString, std::vector<int>& groupIdList, bool isRadio); 60 61 std::string m_m3uLocation; 62 std::string m_logoLocation; 63 64 iptvsimple::ChannelGroups& m_channelGroups; 65 iptvsimple::Channels& m_channels; 66 kodi::addon::CInstancePVRClient* m_client; 67 }; 68 } //namespace iptvsimple 69