Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / video / VideoInfoTag.h
1 #pragma once
2 /*
3  *      Copyright (C) 2005-2008 Team XBMC
4  *      http://www.xbmc.org
5  *
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)
9  *  any later version.
10  *
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.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with XBMC; see the file COPYING.  If not, write to
18  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19  *  http://www.gnu.org/copyleft/gpl.html
20  *
21  */
22
23
24 #include <vector>
25 #include "XBDateTime.h"
26 #include "utils/ScraperUrl.h"
27 #include "utils/Fanart.h"
28 #include "utils/ISortable.h"
29 #include "utils/StreamDetails.h"
30 #include "video/Bookmark.h"
31 #include "XBDateTime.h"
32
33 class CArchive;
34 class TiXmlNode;
35 class TiXmlElement;
36
37 struct SActorInfo
38 {
39   CStdString strName;
40   CStdString strRole;
41   CScraperUrl thumbUrl;
42   CStdString thumb;
43 };
44
45 class CVideoInfoTag : public IArchivable, public ISerializable, public ISortable
46 {
47 public:
48   CVideoInfoTag() { Reset(); };
49   void Reset();
50   /* \brief Load information to a videoinfotag from an XML element
51    There are three types of tags supported:
52     1. Single-value tags, such as <title>.  These are set if available, else are left untouched.
53     2. Additive tags, such as <set> or <genre>.  These are appended to or replaced (if available) based on the value
54        of the prioritise parameter.  In addition, a clear attribute is available in the XML to clear the current value prior
55        to appending.
56     3. Image tags such as <thumb> and <fanart>.  If the prioritise value is specified, any additional values are prepended
57        to the existing values.
58
59    \param element    the root XML element to parse.
60    \param append     whether information should be added to the existing tag, or whether it should be reset first.
61    \param prioritise if appending, whether additive tags should be prioritised (i.e. replace or prepend) over existing values. Defaults to false.
62
63    \sa ParseNative
64    */
65   bool Load(const TiXmlElement *element, bool append = false, bool prioritise = false);
66   bool Save(TiXmlNode *node, const CStdString &tag, bool savePathInfo = true, const TiXmlElement *additionalNode = NULL);
67   virtual void Archive(CArchive& ar);
68   virtual void Serialize(CVariant& value);
69   virtual void ToSortable(SortItem& sortable);
70   const CStdString GetCast(bool bIncludeRole = false) const;
71   bool HasStreamDetails() const;
72   bool IsEmpty() const;
73
74   const CStdString& GetPath() const
75   {
76     if (m_strFileNameAndPath.IsEmpty())
77       return m_strPath;
78     return m_strFileNameAndPath;
79   };
80
81   CStdString m_basePath; // the base path of the video, for folder-based lookups
82   int m_parentPathID;      // the parent path id where the base path of the video lies
83   std::vector<std::string> m_director;
84   std::vector<std::string> m_writingCredits;
85   std::vector<std::string> m_genre;
86   std::vector<std::string> m_country;
87   CStdString m_strTagLine;
88   CStdString m_strPlotOutline;
89   CStdString m_strTrailer;
90   CStdString m_strPlot;
91   CScraperUrl m_strPictureURL;
92   CStdString m_strTitle;
93   CStdString m_strSortTitle;
94   CStdString m_strVotes;
95   std::vector<std::string> m_artist;
96   std::vector< SActorInfo > m_cast;
97   typedef std::vector< SActorInfo >::const_iterator iCast;
98   std::vector<std::string> m_set;
99   std::vector<int> m_setId;
100   std::vector<std::string> m_tags;
101   CStdString m_strRuntime;
102   CStdString m_strFile;
103   CStdString m_strPath;
104   CStdString m_strIMDBNumber;
105   CStdString m_strMPAARating;
106   CStdString m_strFileNameAndPath;
107   CStdString m_strOriginalTitle;
108   CStdString m_strEpisodeGuide;
109   CDateTime m_premiered;
110   CStdString m_strStatus;
111   CStdString m_strProductionCode;
112   CDateTime m_firstAired;
113   CStdString m_strShowTitle;
114   std::vector<std::string> m_studio;
115   CStdString m_strAlbum;
116   CDateTime m_lastPlayed;
117   std::vector<std::string> m_showLink;
118   CStdString m_strShowPath;
119   int m_playCount;
120   int m_iTop250;
121   int m_iYear;
122   int m_iSeason;
123   int m_iEpisode;
124   int m_iDbId;
125   int m_iFileId;
126   int m_iSpecialSortSeason;
127   int m_iSpecialSortEpisode;
128   int m_iTrack;
129   float m_fRating;
130   float m_fEpBookmark;
131   int m_iBookmarkId;
132   int m_iIdShow;
133   int m_iIdSeason;
134   CFanart m_fanart;
135   CStreamDetails m_streamDetails;
136   CBookmark m_resumePoint;
137   CDateTime m_dateAdded;
138   CStdString m_type;
139
140 private:
141   /* \brief Parse our native XML format for video info.
142    See Load for a description of the available tag types.
143
144    \param element    the root XML element to parse.
145    \param prioritise whether additive tags should be replaced (or prepended) by the content of the tags, or appended to.
146    \sa Load
147    */
148   void ParseNative(const TiXmlElement* element, bool prioritise);
149 };
150
151 typedef std::vector<CVideoInfoTag> VECMOVIES;