Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 630 lines (600 sloc) 21.094 kb
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
1 /*
2 * Copyright (C) 2005-2008 Team XBMC
3 * http://www.xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 */
21
22 #include "VideoInfoTag.h"
c51b1189 » theuni
2011-01-24 Merged cptspiff's code-reshuffle branch.
23 #include "utils/XMLUtils.h"
24 #include "guilib/LocalizeStrings.h"
25 #include "settings/GUISettings.h"
26 #include "settings/AdvancedSettings.h"
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
27 #include "utils/log.h"
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
28 #include "utils/Variant.h"
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
29 #include "utils/CharsetConverter.h"
30
31 #include <sstream>
32
33 using namespace std;
34
35 void CVideoInfoTag::Reset()
36 {
37 m_strDirector = "";
38 m_strWritingCredits = "";
39 m_strGenre = "";
281d796d » jmarshallnz
2010-05-07 added: Ticket #8990 - Production country for movies, thanks to ventech
40 m_strCountry = "";
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
41 m_strTagLine = "";
42 m_strPlotOutline = "";
43 m_strPlot = "";
44 m_strPictureURL.Clear();
45 m_strTitle = "";
46 m_strOriginalTitle = "";
47 m_strSortTitle = "";
48 m_strVotes = "";
49 m_cast.clear();
50 m_strSet = "";
51 m_strFile = "";
52 m_strPath = "";
53 m_strIMDBNumber = "";
54 m_strMPAARating = "";
55 m_strPremiered= "";
56 m_strStatus= "";
57 m_strProductionCode= "";
58 m_strFirstAired= "";
59 m_strStudio = "";
60 m_strAlbum = "";
61 m_strArtist = "";
62 m_strTrailer = "";
63 m_iTop250 = 0;
64 m_iYear = 0;
65 m_iSeason = -1;
66 m_iEpisode = -1;
67 m_iSpecialSortSeason = -1;
68 m_iSpecialSortEpisode = -1;
69 m_fRating = 0.0f;
70 m_iDbId = -1;
71 m_iFileId = -1;
72 m_iBookmarkId = -1;
73 m_iTrack = -1;
74 m_fanart.m_xml = "";
75 m_strRuntime = "";
76 m_lastPlayed = "";
bf6162b2 » spiff_
2010-02-25 added: export/import movie<->tvshow links from nfo files. use <tvshow…
77 m_strShowLink = "";
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
78 m_streamDetails.Reset();
79 m_playCount = 0;
d8f77561 » spiff_
2010-02-25 added: import/export episode bookmarks in nfo files. tag is <epbookma…
80 m_fEpBookmark = 0;
606fcbc8 » Jonathan Marshall
2011-02-08 added: extra column to tables in video library to store the base path…
81 m_basePath = "";
bd909e1f » Jonathan Marshall
2011-05-01 add an extra column to the video database with the parent path id to …
82 m_parentPathID = -1;
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
83 }
84
85 bool CVideoInfoTag::Save(TiXmlNode *node, const CStdString &tag, bool savePathInfo)
86 {
87 if (!node) return false;
88
89 // we start with a <tag> tag
90 TiXmlElement movieElement(tag.c_str());
91 TiXmlNode *movie = node->InsertEndChild(movieElement);
92
93 if (!movie) return false;
94
95 XMLUtils::SetString(movie, "title", m_strTitle);
96 if (!m_strOriginalTitle.IsEmpty())
97 XMLUtils::SetString(movie, "originaltitle", m_strOriginalTitle);
98 if (!m_strSortTitle.IsEmpty())
99 XMLUtils::SetString(movie, "sorttitle", m_strSortTitle);
100 XMLUtils::SetFloat(movie, "rating", m_fRating);
d8f77561 » spiff_
2010-02-25 added: import/export episode bookmarks in nfo files. tag is <epbookma…
101 XMLUtils::SetFloat(movie, "epbookmark", m_fEpBookmark);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
102 XMLUtils::SetInt(movie, "year", m_iYear);
103 XMLUtils::SetInt(movie, "top250", m_iTop250);
104 if (tag == "episodedetails" || tag == "tvshow")
105 {
106 XMLUtils::SetInt(movie, "season", m_iSeason);
107 XMLUtils::SetInt(movie, "episode", m_iEpisode);
108 XMLUtils::SetInt(movie, "displayseason",m_iSpecialSortSeason);
109 XMLUtils::SetInt(movie, "displayepisode",m_iSpecialSortEpisode);
110 }
111 if (tag == "musicvideo")
112 {
113 XMLUtils::SetInt(movie, "track", m_iTrack);
114 XMLUtils::SetString(movie, "album", m_strAlbum);
115 }
116 XMLUtils::SetString(movie, "votes", m_strVotes);
117 XMLUtils::SetString(movie, "outline", m_strPlotOutline);
118 XMLUtils::SetString(movie, "plot", m_strPlot);
119 XMLUtils::SetString(movie, "tagline", m_strTagLine);
120 XMLUtils::SetString(movie, "runtime", m_strRuntime);
121 if (!m_strPictureURL.m_xml.empty())
122 {
123 TiXmlDocument doc;
d5c23e36 » spiff_
2010-01-08 cosmetics
124 doc.Parse(m_strPictureURL.m_xml);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
125 const TiXmlNode* thumb = doc.FirstChild("thumb");
126 while (thumb)
127 {
128 movie->InsertEndChild(*thumb);
129 thumb = thumb->NextSibling("thumb");
130 }
131 }
132 if (m_fanart.m_xml.size())
133 {
134 TiXmlDocument doc;
135 doc.Parse(m_fanart.m_xml);
136 movie->InsertEndChild(*doc.RootElement());
137 }
138 XMLUtils::SetString(movie, "mpaa", m_strMPAARating);
139 XMLUtils::SetInt(movie, "playcount", m_playCount);
140 XMLUtils::SetString(movie, "lastplayed", m_lastPlayed);
141 if (savePathInfo)
142 {
143 XMLUtils::SetString(movie, "file", m_strFile);
144 XMLUtils::SetString(movie, "path", m_strPath);
145 XMLUtils::SetString(movie, "filenameandpath", m_strFileNameAndPath);
606fcbc8 » Jonathan Marshall
2011-02-08 added: extra column to tables in video library to store the base path…
146 XMLUtils::SetString(movie, "basepath", m_basePath);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
147 }
148 if (!m_strEpisodeGuide.IsEmpty())
9b6a522f » spiff_
2010-01-07 fixed: broken exported episodeguide in nfo files. broken files are no…
149 {
150 TiXmlDocument doc;
151 doc.Parse(m_strEpisodeGuide);
152 if (doc.RootElement())
153 movie->InsertEndChild(*doc.RootElement());
154 else
155 XMLUtils::SetString(movie, "episodeguide", m_strEpisodeGuide);
156 }
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
157
158 XMLUtils::SetString(movie, "id", m_strIMDBNumber);
9a0b43ac » spiff_
2010-02-25 fixed: export additive strings using multiple xml tags instead of one…
159 XMLUtils::SetAdditiveString(movie, "genre",
160 g_advancedSettings.m_videoItemSeparator, m_strGenre);
281d796d » jmarshallnz
2010-05-07 added: Ticket #8990 - Production country for movies, thanks to ventech
161 XMLUtils::SetAdditiveString(movie, "country",
162 g_advancedSettings.m_videoItemSeparator, m_strCountry);
9a0b43ac » spiff_
2010-02-25 fixed: export additive strings using multiple xml tags instead of one…
163 XMLUtils::SetAdditiveString(movie, "set",
164 g_advancedSettings.m_videoItemSeparator, m_strSet);
165 XMLUtils::SetAdditiveString(movie, "credits",
166 g_advancedSettings.m_videoItemSeparator, m_strWritingCredits);
167 XMLUtils::SetAdditiveString(movie, "director",
168 g_advancedSettings.m_videoItemSeparator, m_strDirector);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
169 XMLUtils::SetString(movie, "premiered", m_strPremiered);
170 XMLUtils::SetString(movie, "status", m_strStatus);
171 XMLUtils::SetString(movie, "code", m_strProductionCode);
172 XMLUtils::SetString(movie, "aired", m_strFirstAired);
9a0b43ac » spiff_
2010-02-25 fixed: export additive strings using multiple xml tags instead of one…
173 XMLUtils::SetAdditiveString(movie, "studio",
174 g_advancedSettings.m_videoItemSeparator, m_strStudio);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
175 XMLUtils::SetString(movie, "trailer", m_strTrailer);
176
177 if (m_streamDetails.HasItems())
178 {
179 // it goes fileinfo/streamdetails/[video|audio|subtitle]
180 TiXmlElement fileinfo("fileinfo");
181 TiXmlElement streamdetails("streamdetails");
182 for (int iStream=1; iStream<=m_streamDetails.GetVideoStreamCount(); iStream++)
183 {
184 TiXmlElement stream("video");
185 XMLUtils::SetString(&stream, "codec", m_streamDetails.GetVideoCodec(iStream));
186 XMLUtils::SetFloat(&stream, "aspect", m_streamDetails.GetVideoAspect(iStream));
187 XMLUtils::SetInt(&stream, "width", m_streamDetails.GetVideoWidth(iStream));
188 XMLUtils::SetInt(&stream, "height", m_streamDetails.GetVideoHeight(iStream));
80f3eeda » jmarshallnz
2010-08-31 changed: Switch the duration stored in video library to seconds rathe…
189 XMLUtils::SetInt(&stream, "durationinseconds", m_streamDetails.GetVideoDuration(iStream));
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
190 streamdetails.InsertEndChild(stream);
191 }
192 for (int iStream=1; iStream<=m_streamDetails.GetAudioStreamCount(); iStream++)
193 {
194 TiXmlElement stream("audio");
195 XMLUtils::SetString(&stream, "codec", m_streamDetails.GetAudioCodec(iStream));
196 XMLUtils::SetString(&stream, "language", m_streamDetails.GetAudioLanguage(iStream));
197 XMLUtils::SetInt(&stream, "channels", m_streamDetails.GetAudioChannels(iStream));
198 streamdetails.InsertEndChild(stream);
199 }
200 for (int iStream=1; iStream<=m_streamDetails.GetSubtitleStreamCount(); iStream++)
201 {
202 TiXmlElement stream("subtitle");
203 XMLUtils::SetString(&stream, "language", m_streamDetails.GetSubtitleLanguage(iStream));
204 streamdetails.InsertEndChild(stream);
205 }
206 fileinfo.InsertEndChild(streamdetails);
207 movie->InsertEndChild(fileinfo);
208 } /* if has stream details */
209
210 // cast
211 for (iCast it = m_cast.begin(); it != m_cast.end(); ++it)
212 {
213 // add a <actor> tag
214 TiXmlElement cast("actor");
215 TiXmlNode *node = movie->InsertEndChild(cast);
216 TiXmlElement actor("name");
217 TiXmlNode *actorNode = node->InsertEndChild(actor);
218 TiXmlText name(it->strName);
219 actorNode->InsertEndChild(name);
220 TiXmlElement role("role");
221 TiXmlNode *roleNode = node->InsertEndChild(role);
222 TiXmlText character(it->strRole);
223 roleNode->InsertEndChild(character);
224 TiXmlElement thumb("thumb");
225 TiXmlNode *thumbNode = node->InsertEndChild(thumb);
226 TiXmlText th(it->thumbUrl.GetFirstThumb().m_url);
227 thumbNode->InsertEndChild(th);
228 }
9a0b43ac » spiff_
2010-02-25 fixed: export additive strings using multiple xml tags instead of one…
229 XMLUtils::SetAdditiveString(movie, "artist",
230 g_advancedSettings.m_videoItemSeparator, m_strArtist);
bf6162b2 » spiff_
2010-02-25 added: export/import movie<->tvshow links from nfo files. use <tvshow…
231 XMLUtils::SetAdditiveString(movie, "showlink",
232 g_advancedSettings.m_videoItemSeparator, m_strShowLink);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
233
234 return true;
235 }
236
237 bool CVideoInfoTag::Load(const TiXmlElement *movie, bool chained /* = false */)
238 {
239 if (!movie) return false;
240
241 // reset our details if we aren't chained.
242 if (!chained) Reset();
243
c3eac21e » vdrfan
2010-07-26 removed: outdated and unmaintained mymovies.xml parser, user the mymo…
244 ParseNative(movie);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
245
246 return true;
247 }
248
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
249 void CVideoInfoTag::Archive(CArchive& ar)
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
250 {
251 if (ar.IsStoring())
252 {
253 ar << m_strDirector;
254 ar << m_strWritingCredits;
255 ar << m_strGenre;
281d796d » jmarshallnz
2010-05-07 added: Ticket #8990 - Production country for movies, thanks to ventech
256 ar << m_strCountry;
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
257 ar << m_strTagLine;
258 ar << m_strPlotOutline;
259 ar << m_strPlot;
260 ar << m_strPictureURL.m_spoof;
261 ar << m_strPictureURL.m_xml;
262 ar << m_fanart.m_xml;
263 ar << m_strTitle;
264 ar << m_strSortTitle;
265 ar << m_strVotes;
266 ar << m_strStudio;
267 ar << m_strTrailer;
268 ar << (int)m_cast.size();
269 for (unsigned int i=0;i<m_cast.size();++i)
270 {
271 ar << m_cast[i].strName;
272 ar << m_cast[i].strRole;
273 ar << m_cast[i].thumbUrl.m_xml;
274 }
d5c23e36 » spiff_
2010-01-08 cosmetics
275
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
276 ar << m_strSet;
277 ar << m_strRuntime;
278 ar << m_strFile;
279 ar << m_strPath;
280 ar << m_strIMDBNumber;
281 ar << m_strMPAARating;
282 ar << m_strFileNameAndPath;
283 ar << m_strOriginalTitle;
284 ar << m_strEpisodeGuide;
285 ar << m_strPremiered;
286 ar << m_strStatus;
287 ar << m_strProductionCode;
288 ar << m_strFirstAired;
289 ar << m_strShowTitle;
290 ar << m_strAlbum;
291 ar << m_strArtist;
292 ar << m_playCount;
293 ar << m_lastPlayed;
294 ar << m_iTop250;
295 ar << m_iYear;
296 ar << m_iSeason;
297 ar << m_iEpisode;
298 ar << m_fRating;
299 ar << m_iDbId;
300 ar << m_iFileId;
301 ar << m_iSpecialSortSeason;
302 ar << m_iSpecialSortEpisode;
303 ar << m_iBookmarkId;
304 ar << m_iTrack;
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
305 ar << dynamic_cast<IArchivable&>(m_streamDetails);
bf6162b2 » spiff_
2010-02-25 added: export/import movie<->tvshow links from nfo files. use <tvshow…
306 ar << m_strShowLink;
d8f77561 » spiff_
2010-02-25 added: import/export episode bookmarks in nfo files. tag is <epbookma…
307 ar << m_fEpBookmark;
606fcbc8 » Jonathan Marshall
2011-02-08 added: extra column to tables in video library to store the base path…
308 ar << m_basePath;
bd909e1f » Jonathan Marshall
2011-05-01 add an extra column to the video database with the parent path id to …
309 ar << m_parentPathID;
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
310 }
311 else
312 {
313 ar >> m_strDirector;
314 ar >> m_strWritingCredits;
315 ar >> m_strGenre;
281d796d » jmarshallnz
2010-05-07 added: Ticket #8990 - Production country for movies, thanks to ventech
316 ar >> m_strCountry;
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
317 ar >> m_strTagLine;
318 ar >> m_strPlotOutline;
319 ar >> m_strPlot;
320 ar >> m_strPictureURL.m_spoof;
321 ar >> m_strPictureURL.m_xml;
322 m_strPictureURL.Parse();
323 ar >> m_fanart.m_xml;
324 m_fanart.Unpack();
325 ar >> m_strTitle;
326 ar >> m_strSortTitle;
327 ar >> m_strVotes;
328 ar >> m_strStudio;
329 ar >> m_strTrailer;
330 int iCastSize;
331 ar >> iCastSize;
332 for (int i=0;i<iCastSize;++i)
333 {
334 SActorInfo info;
335 ar >> info.strName;
336 ar >> info.strRole;
337 CStdString strXml;
338 ar >> strXml;
339 info.thumbUrl.ParseString(strXml);
340 m_cast.push_back(info);
341 }
d5c23e36 » spiff_
2010-01-08 cosmetics
342
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
343 ar >> m_strSet;
344 ar >> m_strRuntime;
345 ar >> m_strFile;
346 ar >> m_strPath;
347 ar >> m_strIMDBNumber;
348 ar >> m_strMPAARating;
349 ar >> m_strFileNameAndPath;
350 ar >> m_strOriginalTitle;
351 ar >> m_strEpisodeGuide;
352 ar >> m_strPremiered;
353 ar >> m_strStatus;
354 ar >> m_strProductionCode;
355 ar >> m_strFirstAired;
356 ar >> m_strShowTitle;
357 ar >> m_strAlbum;
358 ar >> m_strArtist;
359 ar >> m_playCount;
360 ar >> m_lastPlayed;
361 ar >> m_iTop250;
362 ar >> m_iYear;
363 ar >> m_iSeason;
364 ar >> m_iEpisode;
365 ar >> m_fRating;
366 ar >> m_iDbId;
367 ar >> m_iFileId;
368 ar >> m_iSpecialSortSeason;
369 ar >> m_iSpecialSortEpisode;
370 ar >> m_iBookmarkId;
371 ar >> m_iTrack;
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
372 ar >> dynamic_cast<IArchivable&>(m_streamDetails);
bf6162b2 » spiff_
2010-02-25 added: export/import movie<->tvshow links from nfo files. use <tvshow…
373 ar >> m_strShowLink;
d8f77561 » spiff_
2010-02-25 added: import/export episode bookmarks in nfo files. tag is <epbookma…
374 ar >> m_fEpBookmark;
606fcbc8 » Jonathan Marshall
2011-02-08 added: extra column to tables in video library to store the base path…
375 ar >> m_basePath;
bd909e1f » Jonathan Marshall
2011-05-01 add an extra column to the video database with the parent path id to …
376 ar >> m_parentPathID;
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
377 }
378 }
379
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
380 void CVideoInfoTag::Serialize(CVariant& value)
381 {
382 value["director"] = m_strDirector;
383 value["writingcredits"] = m_strWritingCredits;
384 value["genre"] = m_strGenre;
385 value["country"] = m_strCountry;
386 value["tagline"] = m_strTagLine;
387 value["plotoutline"] = m_strPlotOutline;
388 value["plot"] = m_strPlot;
389 value["title"] = m_strTitle;
390 value["votes"] = m_strVotes;
391 value["studio"] = m_strStudio;
392 value["trailer"] = m_strTrailer;
2467ee06 » Montellese
2011-02-28 JSONRPC: Migration of VideoLibrary
393 value["cast"] = CVariant(CVariant::VariantTypeArray);
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
394 for (unsigned int i = 0; i < m_cast.size(); ++i)
395 {
2467ee06 » Montellese
2011-02-28 JSONRPC: Migration of VideoLibrary
396 CVariant actor;
397 actor["name"] = m_cast[i].strName;
398 actor["role"] = m_cast[i].strRole;
399 value["cast"].push_back(actor);
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
400 }
401 value["set"] = m_strSet;
402 value["runtime"] = m_strRuntime;
403 value["file"] = m_strFile;
404 value["path"] = m_strPath;
405 value["imdbnumber"] = m_strIMDBNumber;
7033a63a » blinkseb
2011-01-16 added: mpaa rating support for json-rpc. Thanks giftie
406 value["mpaa"] = m_strMPAARating;
5d0f6cf2 » blinkseb
2010-11-02 added: ISerializable interface, in order to serialize object into a C…
407 value["filenameandpath"] = m_strFileNameAndPath;
408 value["originaltitle"] = m_strOriginalTitle;
409 value["episodeguide"] = m_strEpisodeGuide;
410 value["premiered"] = m_strPremiered;
411 value["status"] = m_strStatus;
412 value["productioncode"] = m_strProductionCode;
413 value["firstaired"] = m_strFirstAired;
414 value["showtitle"] = m_strShowTitle;
415 value["album"] = m_strAlbum;
416 value["artist"] = m_strArtist;
417 value["playcount"] = m_playCount;
418 value["lastPlayed"] = m_lastPlayed;
419 value["top250"] = m_iTop250;
420 value["year"] = m_iYear;
421 value["season"] = m_iSeason;
422 value["episode"] = m_iEpisode;
423 value["rating"] = m_fRating;
424 value["dbid"] = m_iDbId;
425 value["fileid"] = m_iFileId;
426 value["track"] = m_iTrack;
427 value["showlink"] = m_strShowLink;
428 m_streamDetails.Serialize(value["streamDetails"]);
429 }
430
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
431 const CStdString CVideoInfoTag::GetCast(bool bIncludeRole /*= false*/) const
432 {
433 CStdString strLabel;
434 for (iCast it = m_cast.begin(); it != m_cast.end(); ++it)
435 {
436 CStdString character;
437 if (it->strRole.IsEmpty() || !bIncludeRole)
438 character.Format("%s\n", it->strName.c_str());
439 else
440 character.Format("%s %s %s\n", it->strName.c_str(), g_localizeStrings.Get(20347).c_str(), it->strRole.c_str());
441 strLabel += character;
442 }
443 return strLabel.TrimRight("\n");
444 }
445
446 void CVideoInfoTag::ParseNative(const TiXmlElement* movie)
447 {
448 XMLUtils::GetString(movie, "title", m_strTitle);
449 XMLUtils::GetString(movie, "originaltitle", m_strOriginalTitle);
450 XMLUtils::GetString(movie, "sorttitle", m_strSortTitle);
451 XMLUtils::GetFloat(movie, "rating", m_fRating);
d8f77561 » spiff_
2010-02-25 added: import/export episode bookmarks in nfo files. tag is <epbookma…
452 XMLUtils::GetFloat(movie, "epbookmark", m_fEpBookmark);
538a6e92 » jmarshallnz
2009-10-14 added: max attribute to the <rating> tag for scrapers (or nfo files) …
453 int max_value = 10;
454 const TiXmlElement* rElement = movie->FirstChildElement("rating");
455 if (rElement && (rElement->QueryIntAttribute("max", &max_value) == TIXML_SUCCESS) && max_value>=1)
d5c23e36 » spiff_
2010-01-08 cosmetics
456 {
538a6e92 » jmarshallnz
2009-10-14 added: max attribute to the <rating> tag for scrapers (or nfo files) …
457 m_fRating = m_fRating / max_value * 10; // Normalise the Movie Rating to between 1 and 10
458 }
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
459 XMLUtils::GetInt(movie, "year", m_iYear);
460 XMLUtils::GetInt(movie, "top250", m_iTop250);
461 XMLUtils::GetInt(movie, "season", m_iSeason);
462 XMLUtils::GetInt(movie, "episode", m_iEpisode);
463 XMLUtils::GetInt(movie, "track", m_iTrack);
464 XMLUtils::GetInt(movie, "displayseason", m_iSpecialSortSeason);
465 XMLUtils::GetInt(movie, "displayepisode", m_iSpecialSortEpisode);
466 int after=0;
467 XMLUtils::GetInt(movie, "displayafterseason",after);
468 if (after > 0)
469 {
470 m_iSpecialSortSeason = after;
471 m_iSpecialSortEpisode = 0x1000; // should be more than any realistic episode number
472 }
473 XMLUtils::GetString(movie, "votes", m_strVotes);
474 XMLUtils::GetString(movie, "outline", m_strPlotOutline);
475 XMLUtils::GetString(movie, "plot", m_strPlot);
476 XMLUtils::GetString(movie, "tagline", m_strTagLine);
477 XMLUtils::GetString(movie, "runtime", m_strRuntime);
478 XMLUtils::GetString(movie, "mpaa", m_strMPAARating);
479 XMLUtils::GetInt(movie, "playcount", m_playCount);
480 XMLUtils::GetString(movie, "lastplayed", m_lastPlayed);
481 XMLUtils::GetString(movie, "file", m_strFile);
482 XMLUtils::GetString(movie, "path", m_strPath);
483 XMLUtils::GetString(movie, "id", m_strIMDBNumber);
484 XMLUtils::GetString(movie, "filenameandpath", m_strFileNameAndPath);
485 XMLUtils::GetString(movie, "premiered", m_strPremiered);
486 XMLUtils::GetString(movie, "status", m_strStatus);
487 XMLUtils::GetString(movie, "code", m_strProductionCode);
488 XMLUtils::GetString(movie, "aired", m_strFirstAired);
489 XMLUtils::GetString(movie, "album", m_strAlbum);
490 XMLUtils::GetString(movie, "trailer", m_strTrailer);
606fcbc8 » Jonathan Marshall
2011-02-08 added: extra column to tables in video library to store the base path…
491 XMLUtils::GetString(movie, "basepath", m_basePath);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
492
493 const TiXmlElement* thumb = movie->FirstChildElement("thumb");
494 while (thumb)
495 {
496 m_strPictureURL.ParseElement(thumb);
497 thumb = thumb->NextSiblingElement("thumb");
498 }
499
500 XMLUtils::GetAdditiveString(movie,"genre",g_advancedSettings.m_videoItemSeparator,m_strGenre);
281d796d » jmarshallnz
2010-05-07 added: Ticket #8990 - Production country for movies, thanks to ventech
501 XMLUtils::GetAdditiveString(movie,"country",g_advancedSettings.m_videoItemSeparator,m_strCountry);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
502 XMLUtils::GetAdditiveString(movie,"credits",g_advancedSettings.m_videoItemSeparator,m_strWritingCredits);
503 XMLUtils::GetAdditiveString(movie,"director",g_advancedSettings.m_videoItemSeparator,m_strDirector);
bf6162b2 » spiff_
2010-02-25 added: export/import movie<->tvshow links from nfo files. use <tvshow…
504 XMLUtils::GetAdditiveString(movie,"showlink",g_advancedSettings.m_videoItemSeparator,m_strShowLink);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
505
506 // cast
507 const TiXmlElement* node = movie->FirstChildElement("actor");
508 while (node)
509 {
510 const TiXmlNode *actor = node->FirstChild("name");
511 if (actor && actor->FirstChild())
512 {
513 SActorInfo info;
514 info.strName = actor->FirstChild()->Value();
515 const TiXmlNode *roleNode = node->FirstChild("role");
516 if (roleNode && roleNode->FirstChild())
517 info.strRole = roleNode->FirstChild()->Value();
518 const TiXmlElement* thumb = node->FirstChildElement("thumb");
519 while (thumb)
520 {
521 info.thumbUrl.ParseElement(thumb);
522 thumb = thumb->NextSiblingElement("thumb");
523 }
524 const char* clear=node->Attribute("clear");
525 if (clear && stricmp(clear,"true"))
526 m_cast.clear();
527 m_cast.push_back(info);
528 }
529 node = node->NextSiblingElement("actor");
530 }
531 XMLUtils::GetAdditiveString(movie,"set",g_advancedSettings.m_videoItemSeparator,m_strSet);
532 XMLUtils::GetAdditiveString(movie,"studio",g_advancedSettings.m_videoItemSeparator,m_strStudio);
533 // artists
534 node = movie->FirstChildElement("artist");
535 while (node)
536 {
537 const TiXmlNode* pNode = node->FirstChild("name");
538 const char* pValue=NULL;
539 if (pNode && pNode->FirstChild())
540 pValue = pNode->FirstChild()->Value();
541 else if (node->FirstChild())
542 pValue = node->FirstChild()->Value();
543 if (pValue)
544 {
545 const char* clear=node->Attribute("clear");
546 if (m_strArtist.IsEmpty() || (clear && stricmp(clear,"true")==0))
547 m_strArtist += pValue;
548 else
549 m_strArtist += g_advancedSettings.m_videoItemSeparator + pValue;
550 }
551 node = node->NextSiblingElement("artist");
552 }
553
554 m_streamDetails.Reset();
555 node = movie->FirstChildElement("fileinfo");
556 if (node)
557 {
d5c23e36 » spiff_
2010-01-08 cosmetics
558 // Try to pull from fileinfo/streamdetails/[video|audio|subtitle]
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
559 const TiXmlNode *nodeStreamDetails = node->FirstChild("streamdetails");
560 if (nodeStreamDetails)
561 {
562 const TiXmlNode *nodeDetail = NULL;
563 while ((nodeDetail = nodeStreamDetails->IterateChildren("audio", nodeDetail)))
564 {
565 CStreamDetailAudio *p = new CStreamDetailAudio();
566 XMLUtils::GetString(nodeDetail, "codec", p->m_strCodec);
567 XMLUtils::GetString(nodeDetail, "language", p->m_strLanguage);
568 XMLUtils::GetInt(nodeDetail, "channels", p->m_iChannels);
569 p->m_strCodec.MakeLower();
570 p->m_strLanguage.MakeLower();
571 m_streamDetails.AddStream(p);
572 }
573 nodeDetail = NULL;
574 while ((nodeDetail = nodeStreamDetails->IterateChildren("video", nodeDetail)))
575 {
576 CStreamDetailVideo *p = new CStreamDetailVideo();
577 XMLUtils::GetString(nodeDetail, "codec", p->m_strCodec);
578 XMLUtils::GetFloat(nodeDetail, "aspect", p->m_fAspect);
579 XMLUtils::GetInt(nodeDetail, "width", p->m_iWidth);
580 XMLUtils::GetInt(nodeDetail, "height", p->m_iHeight);
80f3eeda » jmarshallnz
2010-08-31 changed: Switch the duration stored in video library to seconds rathe…
581 XMLUtils::GetInt(nodeDetail, "durationinseconds", p->m_iDuration);
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
582 p->m_strCodec.MakeLower();
583 m_streamDetails.AddStream(p);
584 }
585 nodeDetail = NULL;
586 while ((nodeDetail = nodeStreamDetails->IterateChildren("subtitle", nodeDetail)))
587 {
588 CStreamDetailSubtitle *p = new CStreamDetailSubtitle();
589 XMLUtils::GetString(nodeDetail, "language", p->m_strLanguage);
590 p->m_strLanguage.MakeLower();
591 m_streamDetails.AddStream(p);
592 }
593 }
594 m_streamDetails.DetermineBestStreams();
595 } /* if fileinfo */
596
597 const TiXmlElement *epguide = movie->FirstChildElement("episodeguide");
598 if (epguide)
599 {
7f5634ef » jmarshallnz
2010-09-06 readded: support for loading old, depreciated <episodeguide>&lt;episo…
600 // DEPRECIATE ME - support for old XML-encoded <episodeguide> blocks.
601 if (epguide->FirstChild() && strnicmp("<episodeguide", epguide->FirstChild()->Value(), 13) == 0)
602 m_strEpisodeGuide = epguide->FirstChild()->Value();
603 else
604 {
605 stringstream stream;
606 stream << *epguide;
607 m_strEpisodeGuide = stream.str();
608 }
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
609 }
610
611 // fanart
612 const TiXmlElement *fanart = movie->FirstChildElement("fanart");
613 if (fanart)
614 {
615 m_fanart.m_xml << *fanart;
616 m_fanart.Unpack();
617 }
618 }
619
620 bool CVideoInfoTag::HasStreamDetails() const
621 {
7aa0d0f3 » arnova
2010-08-17 fixed: CVideoInfoTag::HasStreamDetails() was wrong since r30825 causi…
622 return m_streamDetails.HasItems();
45285e8a » AlTheKiller
2009-09-23 step 3/4: Move linuxport to trunk. How'd I get roped into this?
623 }
624
7eeb4255 » jmarshallnz
2009-11-08 fixed: Ticket #7605 - HasVideoInfoTag() returning true when all we ha…
625 bool CVideoInfoTag::IsEmpty() const
626 {
627 return (m_strTitle.IsEmpty() &&
628 m_strFile.IsEmpty() &&
629 m_strPath.IsEmpty());
630 }
Something went wrong with that request. Please try again.