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 "EpgGenre.h" 11 12 #include <string> 13 #include <vector> 14 15 #include <kodi/addon-instance/pvr/EPG.h> 16 #include <pugixml.hpp> 17 18 namespace iptvsimple 19 { 20 namespace data 21 { 22 static const float STAR_RATING_SCALE = 10.0f; 23 constexpr int DATESTRING_LENGTH = 8; 24 25 class EpgEntry 26 { 27 public: GetBroadcastId()28 int GetBroadcastId() const { return m_broadcastId; } SetBroadcastId(int value)29 void SetBroadcastId(int value) { m_broadcastId = value; } 30 GetChannelId()31 int GetChannelId() const { return m_channelId; } SetChannelId(int value)32 void SetChannelId(int value) { m_channelId = value; } 33 GetGenreType()34 int GetGenreType() const { return m_genreType; } SetGenreType(int value)35 void SetGenreType(int value) { m_genreType = value; } 36 GetGenreSubType()37 int GetGenreSubType() const { return m_genreSubType; } SetGenreSubType(int value)38 void SetGenreSubType(int value) { m_genreSubType = value; } 39 GetYear()40 int GetYear() const { return m_year; } SetYear(int value)41 void SetYear(int value) { m_year = value; } 42 GetStarRating()43 int GetStarRating() const { return m_starRating; } SetStarRating(int value)44 void SetStarRating(int value) { m_starRating = value; } 45 GetEpisodeNumber()46 int GetEpisodeNumber() const { return m_episodeNumber; } SetEpisodeNumber(int value)47 void SetEpisodeNumber(int value) { m_episodeNumber = value; } 48 GetEpisodePartNumber()49 int GetEpisodePartNumber() const { return m_episodePartNumber; } SetEpisodePartNumber(int value)50 void SetEpisodePartNumber(int value) { m_episodePartNumber = value; } 51 GetSeasonNumber()52 int GetSeasonNumber() const { return m_seasonNumber; } SetSeasonNumber(int value)53 void SetSeasonNumber(int value) { m_seasonNumber = value; } 54 GetStartTime()55 time_t GetStartTime() const { return m_startTime; } SetStartTime(time_t value)56 void SetStartTime(time_t value) { m_startTime = value; } 57 GetEndTime()58 time_t GetEndTime() const { return m_endTime; } SetEndTime(time_t value)59 void SetEndTime(time_t value) { m_endTime = value; } 60 GetFirstAired()61 const std::string& GetFirstAired() const { return m_firstAired; } SetFirstAired(const std::string & value)62 void SetFirstAired(const std::string& value) { m_firstAired = value; } 63 GetTitle()64 const std::string& GetTitle() const { return m_title; } SetTitle(const std::string & value)65 void SetTitle(const std::string& value) { m_title = value; } 66 GetEpisodeName()67 const std::string& GetEpisodeName() const { return m_episodeName; } SetEpisodeName(const std::string & value)68 void SetEpisodeName(const std::string& value) { m_episodeName = value; } 69 GetPlotOutline()70 const std::string& GetPlotOutline() const { return m_plotOutline; } SetPlotOutline(const std::string & value)71 void SetPlotOutline(const std::string& value) { m_plotOutline = value; } 72 GetPlot()73 const std::string& GetPlot() const { return m_plot; } SetPlot(const std::string & value)74 void SetPlot(const std::string& value) { m_plot = value; } 75 GetIconPath()76 const std::string& GetIconPath() const { return m_iconPath; } SetIconPath(const std::string & value)77 void SetIconPath(const std::string& value) { m_iconPath = value; } 78 GetGenreString()79 const std::string& GetGenreString() const { return m_genreString; } SetGenreString(const std::string & value)80 void SetGenreString(const std::string& value) { m_genreString = value; } 81 GetCast()82 const std::string& GetCast() const { return m_cast; } SetCast(const std::string & value)83 void SetCast(const std::string& value) { m_cast = value; } 84 GetDirector()85 const std::string& GetDirector() const { return m_director; } SetDirector(const std::string & value)86 void SetDirector(const std::string& value) { m_director = value; } 87 GetWriter()88 const std::string& GetWriter() const { return m_writer; } SetWriter(const std::string & value)89 void SetWriter(const std::string& value) { m_writer = value; } 90 GetCatchupId()91 const std::string& GetCatchupId() const { return m_catchupId; } SetCatchupId(const std::string & value)92 void SetCatchupId(const std::string& value) { m_catchupId = value; } 93 IsNew()94 bool IsNew() const { return m_new; } SetNew(int value)95 void SetNew(int value) { m_new = value; } 96 IsPremiere()97 bool IsPremiere() const { return m_premiere; } SetPremiere(int value)98 void SetPremiere(int value) { m_premiere = value; } 99 100 void UpdateTo(kodi::addon::PVREPGTag& left, int iChannelUid, int timeShift, const std::vector<EpgGenre>& genres); 101 bool UpdateFrom(const pugi::xml_node& channelNode, const std::string& id, 102 int start, int end, int minShiftTime, int maxShiftTime); 103 104 private: 105 bool SetEpgGenre(std::vector<EpgGenre> genreMappings); 106 bool ParseEpisodeNumberInfo(std::vector<std::pair<std::string, std::string>>& episodeNumbersList); 107 bool ParseXmltvNsEpisodeNumberInfo(const std::string& episodeNumberString); 108 bool ParseOnScreenEpisodeNumberInfo(const std::string& episodeNumberString); 109 110 int m_broadcastId; 111 int m_channelId; 112 int m_genreType; 113 int m_genreSubType; 114 int m_year; 115 int m_starRating; 116 int m_episodeNumber = EPG_TAG_INVALID_SERIES_EPISODE; 117 int m_episodePartNumber = EPG_TAG_INVALID_SERIES_EPISODE; 118 int m_seasonNumber = EPG_TAG_INVALID_SERIES_EPISODE; 119 time_t m_startTime; 120 time_t m_endTime; 121 std::string m_firstAired; 122 std::string m_title; 123 std::string m_episodeName; 124 std::string m_plotOutline; 125 std::string m_plot; 126 std::string m_iconPath; 127 std::string m_genreString; 128 std::string m_cast; 129 std::string m_director; 130 std::string m_writer; 131 std::string m_catchupId; 132 bool m_new = false; 133 bool m_premiere = false; 134 }; 135 } //namespace data 136 } //namespace iptvsimple 137