2 #include <QCoreApplication>
15 static int x0 = qRegisterMetaType< RefCountHandler<MetadataLookup> >();
33 QStringList categories,
34 const float userrating,
46 QString chanplaybackfilters,
60 QString certification,
62 const float popularity,
69 const QDate releasedate,
70 QDateTime lastupdated,
71 std::chrono::minutes runtime,
72 std::chrono::seconds runtimesecs,
74 QString collectionref,
87 m_data(
std::move(data)),
89 m_automatic(automatic),
90 m_handleImages(handleimages),
91 m_allowOverwrites(allowoverwrites),
92 m_allowGeneric(allowgeneric),
93 m_dvdOrder(preferdvdorder),
94 m_host(
std::move(host)),
97 m_network(
std::move(network)),
98 m_status(
std::move(status)),
99 m_categories(
std::move(categories)),
100 m_userRating(userrating),
101 m_ratingCount(ratingcount),
102 m_language(
std::move(language)),
103 m_subtitle(
std::move(subtitle)),
104 m_tagline(
std::move(tagline)),
105 m_description(
std::move(description)),
109 m_chanNum(
std::move(channum)),
110 m_chanSign(
std::move(chansign)),
111 m_chanName(
std::move(channame)),
112 m_chanPlaybackFilters(
std::move(chanplaybackfilters)),
113 m_recGroup(
std::move(recgroup)),
114 m_playGroup(
std::move(playgroup)),
115 m_seriesId(
std::move(seriesid)),
116 m_programid(
std::move(programid)),
117 m_storageGroup(
std::move(storagegroup)),
118 m_startTs(
std::move(startts)),
119 m_endTs(
std::move(endts)),
120 m_recStartTs(
std::move(recstartts)),
121 m_recEndTs(
std::move(recendts)),
122 m_programFlags(programflags),
123 m_audioProperties(audioproperties),
124 m_videoProperties(videoproperties),
125 m_subtitleType(subtitletype),
126 m_certification(
std::move(certification)),
128 m_popularity(popularity),
131 m_album(
std::move(album)),
132 m_trackNum(tracknum),
133 m_system(
std::move(system)),
135 m_releaseDate(releasedate),
136 m_lastUpdated(
std::move(lastupdated)),
138 m_runtimeSecs(runtimesecs),
139 m_inetRef(
std::move(inetref)),
140 m_collectionRef(
std::move(collectionref)),
141 m_tmsRef(
std::move(tmsref)),
142 m_imdb(
std::move(imdb)),
143 m_people(
std::move(people)),
144 m_studios(
std::move(studios)),
145 m_homepage(
std::move(homepage)),
146 m_trailerURL(
std::move(trailerURL)),
147 m_artwork(
std::move(artwork)),
148 m_downloads(
std::move(downloads))
150 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
163 bool allowoverwrites,
168 const QString &
title,
169 QStringList categories,
170 const float userrating,
177 QString chanplaybackfilters,
182 QString storagegroup,
185 QDateTime recstartts,
188 uint audioproperties,
189 uint videoproperties,
192 const QDate releasedate,
193 QDateTime lastupdated,
194 std::chrono::minutes runtime,
195 std::chrono::seconds runtimesecs) :
200 m_data(
std::move(data)),
202 m_automatic(automatic),
203 m_handleImages(handleimages),
204 m_allowOverwrites(allowoverwrites),
205 m_allowGeneric(allowgeneric),
206 m_dvdOrder(preferdvdorder),
207 m_host(
std::move(host)),
210 m_categories(
std::move(categories)),
211 m_userRating(userrating),
212 m_subtitle(
std::move(subtitle)),
213 m_description(
std::move(description)),
215 m_chanNum(
std::move(channum)),
216 m_chanSign(
std::move(chansign)),
217 m_chanName(
std::move(channame)),
218 m_chanPlaybackFilters(
std::move(chanplaybackfilters)),
219 m_recGroup(
std::move(recgroup)),
220 m_playGroup(
std::move(playgroup)),
221 m_seriesId(
std::move(seriesid)),
222 m_programid(
std::move(programid)),
223 m_storageGroup(
std::move(storagegroup)),
224 m_startTs(
std::move(startts)),
225 m_endTs(
std::move(endts)),
226 m_recStartTs(
std::move(recstartts)),
227 m_recEndTs(
std::move(recendts)),
228 m_programFlags(programflags),
229 m_audioProperties(audioproperties),
230 m_videoProperties(videoproperties),
231 m_subtitleType(subtitletype),
233 m_releaseDate(releasedate),
234 m_lastUpdated(
std::move(lastupdated)),
236 m_runtimeSecs(runtimesecs)
238 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
251 bool allowoverwrites,
256 const QString &
title,
257 QStringList categories,
258 const float userrating,
264 QString certification,
266 const QDate releasedate,
267 std::chrono::minutes runtime,
268 std::chrono::seconds runtimesecs,
278 m_data(
std::move(data)),
280 m_automatic(automatic),
281 m_handleImages(handleimages),
282 m_allowOverwrites(allowoverwrites),
283 m_allowGeneric(allowgeneric),
284 m_dvdOrder(preferdvdorder),
285 m_host(
std::move(host)),
288 m_categories(
std::move(categories)),
289 m_userRating(userrating),
290 m_subtitle(
std::move(subtitle)),
291 m_tagline(
std::move(tagline)),
292 m_description(
std::move(description)),
295 m_certification(
std::move(certification)),
297 m_releaseDate(releasedate),
299 m_runtimeSecs(runtimesecs),
300 m_inetRef(
std::move(inetref)),
301 m_people(
std::move(people)),
302 m_trailerURL(
std::move(trailerURL)),
303 m_artwork(
std::move(artwork)),
304 m_downloads(
std::move(downloads))
306 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
313 QList<PersonInfo> ret;
321 while (it.hasPrevious())
322 ret.append(it.previous());
338 while (it.hasPrevious())
339 ret.append(it.previous());
347 metadataMap[
"title"] =
m_title;
351 metadataMap[
"userrating"] = QString::number(
m_userRating);
356 metadataMap[
"description0"] = metadataMap[
"description"] =
m_description;
357 metadataMap[
"season"] = QString::number(
m_season);
358 metadataMap[
"episode"] = QString::number(
m_episode);
359 metadataMap[
"chanid"] = QString::number(
m_chanId);
375 metadataMap[
"popularity"] = QString::number(
m_popularity);
376 metadataMap[
"budget"] = QString::number(
m_budget);
377 metadataMap[
"revenue"] = QString::number(
m_revenue);
378 metadataMap[
"album"] =
m_album;
379 metadataMap[
"tracknum"] = QString::number(
m_trackNum);
381 metadataMap[
"year"] = QString::number(
m_year);
387 metadataMap[
"runtime"] = QCoreApplication::translate(
"(Common)",
393 metadataMap[
"runtimesecs"] = QCoreApplication::translate(
"(Common)",
400 metadataMap[
"imdb"] =
m_imdb;
401 metadataMap[
"studios"] =
m_studios.join(
", ");
411 auto runtime = duration_cast<std::chrono::minutes>(runtimesecs);
414 QVariant::fromValue(pginfo),
kLookupData,
false,
false,
false,
false,
false,
438 QDomDocument
doc(
"MythMetadataXML");
440 QDomElement
root =
doc.createElement(
"metadata");
443 for (
const auto & item : qAsConst(list))
451 QDomDocument
doc(
"MythMetadataXML");
453 QDomElement
root =
doc.createElement(
"metadata");
463 QDomDocument
doc(
"MythMetadataXML");
476 QDomElement placetoadd,
477 QDomDocument docroot)
482 QDomElement item = docroot.createElement(
"item");
483 placetoadd.appendChild(item);
484 QString RFC822(
"ddd, d MMMM yyyy hh:mm:ss");
489 QDomElement language = docroot.createElement(
"language");
490 item.appendChild(language);
491 language.appendChild(docroot.createTextNode(lookup->
GetLanguage()));
496 QDomElement
title = docroot.createElement(
"title");
497 item.appendChild(
title);
498 title.appendChild(docroot.createTextNode(lookup->
GetTitle()));
503 QDomElement subtitle = docroot.createElement(
"subtitle");
504 item.appendChild(subtitle);
505 subtitle.appendChild(docroot.createTextNode(lookup->
GetSubtitle()));
510 QDomElement network = docroot.createElement(
"network");
511 item.appendChild(network);
512 network.appendChild(docroot.createTextNode(lookup->
GetNetwork()));
517 QDomElement status = docroot.createElement(
"status");
518 item.appendChild(status);
519 status.appendChild(docroot.createTextNode(lookup->
GetStatus()));
524 QDomElement season = docroot.createElement(
"season");
525 item.appendChild(season);
526 season.appendChild(docroot.createTextNode(
532 QDomElement episode = docroot.createElement(
"episode");
533 item.appendChild(episode);
534 episode.appendChild(docroot.createTextNode(
540 QDomElement tagline = docroot.createElement(
"tagline");
541 item.appendChild(tagline);
542 tagline.appendChild(docroot.createTextNode(lookup->
GetTagline()));
547 QDomElement desc = docroot.createElement(
"description");
548 item.appendChild(desc);
549 desc.appendChild(docroot.createTextNode(lookup->
GetDescription()));
554 QDomElement albumname = docroot.createElement(
"albumname");
555 item.appendChild(albumname);
556 albumname.appendChild(docroot.createTextNode(lookup->
GetAlbumTitle()));
561 QDomElement inetref = docroot.createElement(
"inetref");
562 item.appendChild(inetref);
563 inetref.appendChild(docroot.createTextNode(lookup->
GetInetref()));
568 QDomElement collectionref = docroot.createElement(
"collectionref");
569 item.appendChild(collectionref);
570 collectionref.appendChild(docroot.createTextNode(lookup->
GetCollectionref()));
575 QDomElement tmsref = docroot.createElement(
"tmsref");
576 item.appendChild(tmsref);
577 tmsref.appendChild(docroot.createTextNode(lookup->
GetTMSref()));
580 if (!lookup->
GetIMDB().isEmpty())
582 QDomElement imdb = docroot.createElement(
"imdb");
583 item.appendChild(imdb);
584 imdb.appendChild(docroot.createTextNode(lookup->
GetIMDB()));
589 QDomElement homepage = docroot.createElement(
"homepage");
590 item.appendChild(homepage);
591 homepage.appendChild(docroot.createTextNode(lookup->
GetHomepage()));
596 QDomElement trailer = docroot.createElement(
"trailer");
597 item.appendChild(trailer);
598 trailer.appendChild(docroot.createTextNode(lookup->
GetTrailerURL()));
603 QDomElement chanid = docroot.createElement(
"chanid");
604 item.appendChild(chanid);
605 chanid.appendChild(docroot.createTextNode(
611 QDomElement channum = docroot.createElement(
"channum");
612 item.appendChild(channum);
613 channum.appendChild(docroot.createTextNode(lookup->
GetChanNum()));
618 QDomElement callsign = docroot.createElement(
"chansign");
619 item.appendChild(callsign);
620 callsign.appendChild(docroot.createTextNode(lookup->
GetChanSign()));
625 QDomElement channame = docroot.createElement(
"channame");
626 item.appendChild(channame);
627 channame.appendChild(docroot.createTextNode(lookup->
GetChanName()));
632 QDomElement filters = docroot.createElement(
"filters");
633 item.appendChild(filters);
634 filters.appendChild(docroot.createTextNode(
640 QDomElement recgroup = docroot.createElement(
"recgroup");
641 item.appendChild(recgroup);
642 recgroup.appendChild(docroot.createTextNode(lookup->
GetRecGroup()));
647 QDomElement playgroup = docroot.createElement(
"playgroup");
648 item.appendChild(playgroup);
649 playgroup.appendChild(docroot.createTextNode(lookup->
GetPlayGroup()));
654 QDomElement seriesid = docroot.createElement(
"seriesid");
655 item.appendChild(seriesid);
656 seriesid.appendChild(docroot.createTextNode(lookup->
GetSeriesId()));
661 QDomElement programid = docroot.createElement(
"programid");
662 item.appendChild(programid);
663 programid.appendChild(docroot.createTextNode(lookup->
GetProgramId()));
668 QDomElement sgroup = docroot.createElement(
"storagegroup");
669 item.appendChild(sgroup);
675 QDomElement startts = docroot.createElement(
"startts");
676 item.appendChild(startts);
677 startts.appendChild(docroot.createTextNode(
683 QDomElement endts = docroot.createElement(
"endts");
684 item.appendChild(endts);
685 endts.appendChild(docroot.createTextNode(
686 lookup->
GetEndTS().toString(RFC822)));
691 QDomElement recstartts = docroot.createElement(
"recstartts");
692 item.appendChild(recstartts);
693 recstartts.appendChild(docroot.createTextNode(
699 QDomElement recendts = docroot.createElement(
"recendts");
700 item.appendChild(recendts);
701 recendts.appendChild(docroot.createTextNode(
707 QDomElement progflags = docroot.createElement(
"programflags");
708 item.appendChild(progflags);
709 progflags.appendChild(docroot.createTextNode(
715 QDomElement audioprops = docroot.createElement(
"audioproperties");
716 item.appendChild(audioprops);
717 audioprops.appendChild(docroot.createTextNode(
723 QDomElement videoprops = docroot.createElement(
"videoproperties");
724 item.appendChild(videoprops);
725 videoprops.appendChild(docroot.createTextNode(
731 QDomElement subprops = docroot.createElement(
"subtitletype");
732 item.appendChild(subprops);
733 subprops.appendChild(docroot.createTextNode(
739 QDomElement releasedate = docroot.createElement(
"releasedate");
740 item.appendChild(releasedate);
741 releasedate.appendChild(docroot.createTextNode(
747 QDomElement lastupdated = docroot.createElement(
"lastupdated");
748 item.appendChild(lastupdated);
749 lastupdated.appendChild(docroot.createTextNode(
755 QDomElement userrating = docroot.createElement(
"userrating");
756 item.appendChild(userrating);
757 userrating.appendChild(docroot.createTextNode(QString::number(
763 QDomElement ratingcount = docroot.createElement(
"ratingcount");
764 item.appendChild(ratingcount);
765 ratingcount.appendChild(docroot.createTextNode(QString::number(
771 QDomElement tracknum = docroot.createElement(
"tracknum");
772 item.appendChild(tracknum);
773 tracknum.appendChild(docroot.createTextNode(QString::number(
779 QDomElement popularity = docroot.createElement(
"popularity");
780 item.appendChild(popularity);
781 popularity.appendChild(docroot.createTextNode(QString::number(
787 QDomElement budget = docroot.createElement(
"budget");
788 item.appendChild(budget);
789 budget.appendChild(docroot.createTextNode(QString::number(
795 QDomElement revenue = docroot.createElement(
"revenue");
796 item.appendChild(revenue);
797 revenue.appendChild(docroot.createTextNode(QString::number(
804 QDomElement runtime = docroot.createElement(
"runtime");
805 item.appendChild(runtime);
806 runtime.appendChild(docroot.createTextNode(QString::number(
813 QDomElement runtimesecs = docroot.createElement(
"runtimesecs");
814 item.appendChild(runtimesecs);
815 runtimesecs.appendChild(docroot.createTextNode(QString::number(
830 QDomElement placetoadd,
831 QDomDocument docroot)
834 QDomElement certifications = docroot.createElement(
"certifications");
835 placetoadd.appendChild(certifications);
837 QDomElement cert = docroot.createElement(
"certification");
838 certifications.appendChild(cert);
840 cert.setAttribute(
"name", certstr);
844 QDomElement placetoadd,
845 QDomDocument docroot)
848 QDomElement categories = docroot.createElement(
"categories");
849 placetoadd.appendChild(categories);
851 for (
const auto & str : qAsConst(cats))
853 QDomElement
cat = docroot.createElement(
"category");
854 categories.appendChild(
cat);
855 cat.setAttribute(
"type",
"genre");
856 cat.setAttribute(
"name", str);
861 QDomElement placetoadd,
862 QDomDocument docroot)
865 QDomElement studios = docroot.createElement(
"studios");
866 placetoadd.appendChild(studios);
868 for (
const auto & str : qAsConst(studs))
870 QDomElement stud = docroot.createElement(
"studio");
871 studios.appendChild(stud);
872 stud.setAttribute(
"name", str);
877 QDomElement placetoadd,
878 QDomDocument docroot)
881 QDomElement
countries = docroot.createElement(
"countries");
884 for (
const auto & str : qAsConst(counts))
886 QDomElement count = docroot.createElement(
"country");
888 count.setAttribute(
"name", str);
902 uint programflags = 0;
903 uint audioproperties = 0;
904 uint videoproperties = 0;
905 uint subtitletype = 0;
910 uint ratingcount = 0;
917 QString certification;
921 QString chanplaybackfilters;
926 QString storagegroup;
930 QString collectionref;
936 QStringList categories;
939 float userrating = 0;
940 float popularity = 0;
942 QDateTime lastupdated;
945 QDateTime recstartts;
951 language = item.firstChildElement(
"language").text();
959 inetref = item.firstChildElement(
"inetref").text();
960 collectionref = item.firstChildElement(
"collectionref").text();
961 tmsref = item.firstChildElement(
"tmsref").text();
962 imdb = item.firstChildElement(
"imdb").text();
963 homepage = item.firstChildElement(
"homepage").text();
964 trailerURL = item.firstChildElement(
"trailer").text();
967 chanid = item.firstChildElement(
"chanid").text().toUInt();
968 channum = item.firstChildElement(
"channum").text();
969 chansign = item.firstChildElement(
"chansign").text();
970 channame = item.firstChildElement(
"channame").text();
971 chanplaybackfilters = item.firstChildElement(
"chanplaybackfilters").text();
972 recgroup = item.firstChildElement(
"recgroup").text();
973 playgroup = item.firstChildElement(
"playgroup").text();
974 seriesid = item.firstChildElement(
"seriesid").text();
975 programid = item.firstChildElement(
"programid").text();
976 storagegroup = item.firstChildElement(
"storagegroup").text();
978 firstChildElement(
"startts").text());
980 firstChildElement(
"endts").text());
982 firstChildElement(
"recstartts").text());
984 firstChildElement(
"recendts").text());
985 programflags = item.firstChildElement(
"programflags").text().toUInt();
986 audioproperties = item.firstChildElement(
"audioproperties").text().toUInt();
987 videoproperties = item.firstChildElement(
"videoproperties").text().toUInt();
988 subtitletype = item.firstChildElement(
"subtitletype").text().toUInt();
990 QString tmpDate = item.firstChildElement(
"releasedate").text();
991 if (!tmpDate.isEmpty())
994 firstChildElement(
"lastupdated").text());
996 userrating = item.firstChildElement(
"userrating").text().toFloat();
997 ratingcount = item.firstChildElement(
"ratingcount").text().toUInt();
998 tracknum = item.firstChildElement(
"tracknum").text().toUInt();
999 popularity = item.firstChildElement(
"popularity").text().toFloat();
1000 budget = item.firstChildElement(
"budget").text().toUInt();
1001 revenue = item.firstChildElement(
"revenue").text().toUInt();
1002 year = item.firstChildElement(
"year").text().toUInt();
1003 if (!year && !releasedate.isNull())
1004 year = releasedate.toString(
"yyyy").toUInt();
1005 auto runtime = std::chrono::minutes(item.firstChildElement(
"runtime").text().toUInt());
1006 auto runtimesecs = std::chrono::seconds(item.firstChildElement(
"runtimesecs").text().toUInt());
1008 QDomElement systems = item.firstChildElement(
"systems");
1009 if (!systems.isNull())
1011 QDomElement firstSystem = systems.firstChildElement(
"system");
1012 if (!firstSystem.isNull())
1013 system = firstSystem.text();
1018 QDomElement certifications = item.firstChildElement(
"certifications");
1019 QVector< QPair<QString,QString> > ratinglist;
1020 if (!certifications.isNull())
1022 QDomElement cert = certifications.firstChildElement(
"certification");
1025 while (!cert.isNull())
1027 if (cert.hasAttribute(
"locale") && cert.hasAttribute(
"name"))
1029 QPair<QString,QString> newcert(cert.attribute(
"locale"),
1030 cert.attribute(
"name"));
1031 ratinglist.append(newcert);
1033 cert = cert.nextSiblingElement(
"certification");
1038 if (!ratinglist.isEmpty())
1039 certification = ratinglist.takeFirst().second;
1042 QDomElement categoriesxml = item.firstChildElement(
"categories");
1043 if (!categoriesxml.isNull())
1045 QDomElement
cat = categoriesxml.firstChildElement(
"category");
1048 while (!
cat.isNull())
1050 if (
cat.hasAttribute(
"name"))
1051 categories.append(
cat.attribute(
"name"));
1052 cat =
cat.nextSiblingElement(
"category");
1058 QDomElement countriesxml = item.firstChildElement(
"countries");
1059 if (!countriesxml.isNull())
1061 QDomElement cntry = countriesxml.firstChildElement(
"country");
1062 if (!cntry.isNull())
1064 while (!cntry.isNull())
1066 if (cntry.hasAttribute(
"name"))
1067 countries.append(cntry.attribute(
"name"));
1068 cntry = cntry.nextSiblingElement(
"country");
1074 QDomElement studiosxml = item.firstChildElement(
"studios");
1075 if (!studiosxml.isNull())
1077 QDomElement studio = studiosxml.firstChildElement(
"studio");
1078 if (!studio.isNull())
1080 while (!studio.isNull())
1082 if (studio.hasAttribute(
"name"))
1083 studios.append(studio.attribute(
"name"));
1084 studio = studio.nextSiblingElement(
"studio");
1090 QDomElement peoplexml = item.firstChildElement(
"people");
1091 if (!peoplexml.isNull())
1097 QDomElement artworkxml = item.firstChildElement(
"images");
1098 if (!artworkxml.isNull())
1117 season = item.firstChildElement(
"dvdseason").text().toUInt();
1121 episode = item.firstChildElement(
"dvdepisode").text().toUInt();
1127 season = item.firstChildElement(
"season").text().toUInt();
1131 episode = item.firstChildElement(
"episode").text().toUInt();
1133 LOG(VB_GENERAL, LOG_INFO, QString(
"Result Found, Season %1 Episode %2")
1134 .
arg(season).
arg(episode));
1141 ratingcount, language, subtitle, tagline, description, season,
1142 episode, chanid, channum, chansign, channame,
1143 chanplaybackfilters, recgroup, playgroup, seriesid, programid,
1144 storagegroup, startts, endts, recstartts, recendts, programflags,
1145 audioproperties, videoproperties, subtitletype, certification,
1146 countries, popularity, budget, revenue, album, tracknum, system, year,
1147 releasedate, lastupdated, runtime, runtimesecs, inetref, collectionref,
1148 tmsref, imdb, people, studios, homepage, trailerURL, artwork,
DownloadMap());
1163 QString description;
1166 QString certification;
1167 float userrating = 0;
1169 QStringList categories;
1174 if (item.tagName() ==
"movie")
1176 else if (item.tagName() ==
"episodedetails")
1178 userrating = item.firstChildElement(
"rating").text().toFloat();
1179 year = item.firstChildElement(
"year").text().toUInt();
1180 season = item.firstChildElement(
"season").text().toUInt();
1181 episode = item.firstChildElement(
"episode").text().toUInt();
1184 inetref = item.firstChildElement(
"id").text();
1185 trailer = item.firstChildElement(
"trailer").text();
1186 certification = item.firstChildElement(
"mpaa").text();
1187 categories.append(item.firstChildElement(
"genre").text());
1189 QString tmpDate = item.firstChildElement(
"releasedate").text();
1190 if (!tmpDate.isEmpty())
1196 std::chrono::minutes(item.firstChildElement(
"runtime").text()
1197 .remove(QRegularExpression(
"[A-Za-z]"))
1198 .trimmed().toUInt());
1200 QDomElement actor = item.firstChildElement(
"actor");
1201 if (!actor.isNull())
1203 while (!actor.isNull())
1206 info.
name = actor.firstChildElement(
"name").text();
1207 info.
role = actor.firstChildElement(
"role").text();
1208 info.
thumbnail = actor.firstChildElement(
"thumb").text();
1210 actor = actor.nextSiblingElement(
"actor");
1214 QString director = item.firstChildElement(
"director").text();
1215 if (!director.isEmpty())
1218 info.
name = director;
1228 userrating, subtitle, tagline, description, season, episode,
1229 certification, year, releasedate, runtime, runtime,
1230 inetref, people, trailer, artwork,
DownloadMap());
1237 QDomElement person = people.firstChildElement(
"person");
1238 if (!person.isNull())
1240 while (!person.isNull())
1242 if (person.hasAttribute(
"job"))
1244 QString jobstring = person.attribute(
"job");
1246 if (jobstring.toLower() ==
"actor")
1248 else if (jobstring.toLower() ==
"author")
1250 else if (jobstring.toLower() ==
"producer")
1252 else if (jobstring.toLower() ==
"executive producer")
1254 else if (jobstring.toLower() ==
"director")
1256 else if (jobstring.toLower() ==
"cinematographer")
1258 else if (jobstring.toLower() ==
"composer")
1260 else if (jobstring.toLower() ==
"editor")
1262 else if (jobstring.toLower() ==
"casting")
1264 else if (jobstring.toLower() ==
"artist")
1266 else if (jobstring.toLower() ==
"album artist")
1268 else if (jobstring.toLower() ==
"guest star")
1274 if (person.hasAttribute(
"name"))
1275 info.
name = person.attribute(
"name");
1276 if (person.hasAttribute(
"character"))
1277 info.
role = person.attribute(
"character");
1278 if (person.hasAttribute(
"thumb"))
1279 info.
thumbnail = person.attribute(
"thumb");
1280 if (person.hasAttribute(
"url"))
1281 info.
url = person.attribute(
"url");
1283 ret.insert(
type,info);
1285 person = person.nextSiblingElement(
"person");
1295 QDomElement image = artwork.firstChildElement(
"image");
1296 if (!image.isNull())
1298 while (!image.isNull())
1300 if (image.hasAttribute(
"type"))
1302 QString typestring = image.attribute(
"type");
1304 if (typestring.toLower() ==
"coverart")
1306 else if (typestring.toLower() ==
"fanart")
1308 else if (typestring.toLower() ==
"banner")
1310 else if (typestring.toLower() ==
"screenshot")
1312 else if (typestring.toLower() ==
"poster")
1314 else if (typestring.toLower() ==
"back cover")
1316 else if (typestring.toLower() ==
"inside cover")
1318 else if (typestring.toLower() ==
"cd image")
1324 if (image.hasAttribute(
"thumb"))
1325 info.
thumbnail = image.attribute(
"thumb");
1326 if (image.hasAttribute(
"url"))
1327 info.
url = image.attribute(
"url");
1328 if (image.hasAttribute(
"width"))
1329 info.
width = image.attribute(
"width").toUInt();
1332 if (image.hasAttribute(
"height"))
1333 info.
height = image.attribute(
"height").toUInt();
1337 ret.insert(
type,info);
1339 image = image.nextSiblingElement(
"image");
1347 #define D( i, j ) d[(i) * n + (j)]
1348 int m = s.length() + 1;
1349 int n =
t.length() + 1;
1350 int *
d =
new int[m * n];
1352 for (
int i = 0; i < m; i++ )
1354 for (
int j = 0; j < n; j++ )
1356 for (
int i = 1; i < m; i++ )
1358 for (
int j = 1; j < n; j++ )
1360 if ( s[i - 1] ==
t[j - 1] )
1361 D( i, j ) =
D( i - 1, j - 1 );
1364 int x =
D( i - 1, j );
1365 int y =
D( i - 1, j - 1 );
1366 int z =
D( i, j - 1 );
1367 D( i, j ) = 1 + qMin( qMin(x, y), z );
1371 int result =
D( m - 1, n - 1 );
1377 QString
nearestName(
const QString& actual,
const QStringList& candidates)
1379 int deltaBest = 10000;
1384 QStringList::ConstIterator i = candidates.begin();
1385 while ( i != candidates.end() )
1387 QString candidate = *i;
1388 int delta =
editDistance( actual.toLower(), candidate.toLower() );
1389 if ( delta < deltaBest )
1395 else if ( delta == deltaBest )
1402 if ( numBest == 1 && deltaBest <= tolerance &&
1403 actual.length() + best.length() >= 5 )
1410 QMap<QString, int> TimezoneOffsets;
1415 QString time =
t.simplified();
1416 short int hoursShift = 0;
1417 short int minutesShift = 0;
1419 QStringList
tmp = time.split(
' ');
1422 if (
tmp.at(0).contains(QRegularExpression(
"\\D")))
1424 if (
tmp.size() != 5)
1426 QString ltimezone =
tmp.takeAt(
tmp.size() -1);
1427 if (ltimezone.size() == 5)
1430 int tz = ltimezone.toInt(&ok);
1433 hoursShift = tz / 100;
1434 minutesShift = tz % 100;
1438 hoursShift = TimezoneOffsets.value(ltimezone, 0);
1440 if (
tmp.at(0).size() == 1)
1441 tmp[0].prepend(
"0");
1442 tmp [1].truncate(3);
1444 time =
tmp.join(
" ");
1447 if (
tmp.at(2).size() == 4)
1448 result = QLocale::c().toDateTime(time,
"dd MMM yyyy hh:mm:ss");
1450 result = QLocale::c().toDateTime(time,
"dd MMM yy hh:mm:ss");
1451 if (result.isNull() || !result.isValid())
1453 result = result.addSecs(hoursShift * 3600 * (-1) + minutesShift *60 * (-1));
1454 result.setTimeSpec(Qt::UTC);