3 * Copyright (C) 2005-2013 Team XBMC
6 * This Program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
11 * This Program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with XBMC; see the file COPYING. If not, see
18 * <http://www.gnu.org/licenses/>.
23 #include "XBDateTime.h"
24 #include "utils/ScraperUrl.h"
25 #include "utils/Fanart.h"
26 #include "utils/ISortable.h"
27 #include "utils/StreamDetails.h"
28 #include "video/Bookmark.h"
36 SActorInfo() : order(-1) {};
37 bool operator<(const SActorInfo &right) const
39 return order < right.order;
48 class CVideoInfoTag : public IArchivable, public ISerializable, public ISortable
51 CVideoInfoTag() { Reset(); };
53 /* \brief Load information to a videoinfotag from an XML element
54 There are three types of tags supported:
55 1. Single-value tags, such as <title>. These are set if available, else are left untouched.
56 2. Additive tags, such as <set> or <genre>. These are appended to or replaced (if available) based on the value
57 of the prioritise parameter. In addition, a clear attribute is available in the XML to clear the current value prior
59 3. Image tags such as <thumb> and <fanart>. If the prioritise value is specified, any additional values are prepended
60 to the existing values.
62 \param element the root XML element to parse.
63 \param append whether information should be added to the existing tag, or whether it should be reset first.
64 \param prioritise if appending, whether additive tags should be prioritised (i.e. replace or prepend) over existing values. Defaults to false.
68 bool Load(const TiXmlElement *element, bool append = false, bool prioritise = false);
69 bool Save(TiXmlNode *node, const CStdString &tag, bool savePathInfo = true, const TiXmlElement *additionalNode = NULL);
70 virtual void Archive(CArchive& ar);
71 virtual void Serialize(CVariant& value) const;
72 virtual void ToSortable(SortItem& sortable, Field field) const;
73 const CStdString GetCast(bool bIncludeRole = false) const;
74 bool HasStreamDetails() const;
77 const CStdString& GetPath() const
79 if (m_strFileNameAndPath.empty())
81 return m_strFileNameAndPath;
84 /*! \brief retrieve the duration in seconds.
85 Prefers the duration from stream details if available.
87 unsigned int GetDuration() const;
89 /*! \brief get the duration in seconds from a minute string
90 \param runtime the runtime string from a scraper or similar
91 \return the time in seconds, if decipherable.
93 static unsigned int GetDurationFromMinuteString(const std::string &runtime);
95 CStdString m_basePath; // the base path of the video, for folder-based lookups
96 int m_parentPathID; // the parent path id where the base path of the video lies
97 std::vector<std::string> m_director;
98 std::vector<std::string> m_writingCredits;
99 std::vector<std::string> m_genre;
100 std::vector<std::string> m_country;
101 CStdString m_strTagLine;
102 CStdString m_strPlotOutline;
103 CStdString m_strTrailer;
104 CStdString m_strPlot;
105 CScraperUrl m_strPictureURL;
106 CStdString m_strTitle;
107 CStdString m_strSortTitle;
108 CStdString m_strVotes;
109 std::vector<std::string> m_artist;
110 std::vector< SActorInfo > m_cast;
111 typedef std::vector< SActorInfo >::const_iterator iCast;
114 std::vector<std::string> m_tags;
115 CStdString m_strFile;
116 CStdString m_strPath;
117 CStdString m_strIMDBNumber;
118 CStdString m_strMPAARating;
119 CStdString m_strFileNameAndPath;
120 CStdString m_strOriginalTitle;
121 CStdString m_strEpisodeGuide;
122 CDateTime m_premiered;
123 CStdString m_strStatus;
124 CStdString m_strProductionCode;
125 CDateTime m_firstAired;
126 CStdString m_strShowTitle;
127 std::vector<std::string> m_studio;
128 CStdString m_strAlbum;
129 CDateTime m_lastPlayed;
130 std::vector<std::string> m_showLink;
131 CStdString m_strShowPath;
137 CStdString m_strUniqueId;
140 int m_iSpecialSortSeason;
141 int m_iSpecialSortEpisode;
149 CStreamDetails m_streamDetails;
150 CBookmark m_resumePoint;
151 CDateTime m_dateAdded;
153 int m_duration; ///< duration in seconds
156 /* \brief Parse our native XML format for video info.
157 See Load for a description of the available tag types.
159 \param element the root XML element to parse.
160 \param prioritise whether additive tags should be replaced (or prepended) by the content of the tags, or appended to.
163 void ParseNative(const TiXmlElement* element, bool prioritise);
166 typedef std::vector<CVideoInfoTag> VECMOVIES;