5 #include <QCoreApplication>
18 static int x0 = qRegisterMetaType< RefCountHandler<MetadataLookup> >();
36 QStringList categories,
37 const float userrating,
49 QString chanplaybackfilters,
63 QString certification,
64 QStringList countries,
65 const float popularity,
72 const QDate releasedate,
73 QDateTime lastupdated,
74 std::chrono::minutes runtime,
75 std::chrono::seconds runtimesecs,
77 QString collectionref,
90 m_data(
std::move(data)),
92 m_automatic(automatic),
93 m_handleImages(handleimages),
94 m_allowOverwrites(allowoverwrites),
95 m_allowGeneric(allowgeneric),
96 m_dvdOrder(preferdvdorder),
97 m_host(
std::move(host)),
100 m_network(
std::move(network)),
101 m_status(
std::move(status)),
102 m_categories(
std::move(categories)),
103 m_userRating(userrating),
104 m_ratingCount(ratingcount),
105 m_language(
std::move(language)),
106 m_subtitle(
std::move(subtitle)),
107 m_tagline(
std::move(tagline)),
108 m_description(
std::move(description)),
112 m_chanNum(
std::move(channum)),
113 m_chanSign(
std::move(chansign)),
114 m_chanName(
std::move(channame)),
115 m_chanPlaybackFilters(
std::move(chanplaybackfilters)),
116 m_recGroup(
std::move(recgroup)),
117 m_playGroup(
std::move(playgroup)),
118 m_seriesId(
std::move(seriesid)),
119 m_programid(
std::move(programid)),
120 m_storageGroup(
std::move(storagegroup)),
121 m_startTs(
std::move(startts)),
122 m_endTs(
std::move(endts)),
123 m_recStartTs(
std::move(recstartts)),
124 m_recEndTs(
std::move(recendts)),
125 m_programFlags(programflags),
126 m_audioProperties(audioproperties),
127 m_videoProperties(videoproperties),
128 m_subtitleType(subtitletype),
129 m_certification(
std::move(certification)),
130 m_countries(
std::move(countries)),
131 m_popularity(popularity),
134 m_album(
std::move(album)),
135 m_trackNum(tracknum),
136 m_system(
std::move(system)),
138 m_releaseDate(releasedate),
139 m_lastUpdated(
std::move(lastupdated)),
141 m_runtimeSecs(runtimesecs),
142 m_inetRef(
std::move(inetref)),
143 m_collectionRef(
std::move(collectionref)),
144 m_tmsRef(
std::move(tmsref)),
145 m_imdb(
std::move(imdb)),
146 m_people(
std::move(people)),
147 m_studios(
std::move(studios)),
148 m_homepage(
std::move(homepage)),
149 m_trailerURL(
std::move(trailerURL)),
150 m_artwork(
std::move(artwork)),
151 m_downloads(
std::move(downloads))
153 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
166 bool allowoverwrites,
171 const QString &title,
172 QStringList categories,
173 const float userrating,
180 QString chanplaybackfilters,
185 QString storagegroup,
188 QDateTime recstartts,
191 uint audioproperties,
192 uint videoproperties,
195 const QDate releasedate,
196 QDateTime lastupdated,
197 std::chrono::minutes runtime,
198 std::chrono::seconds runtimesecs) :
203 m_data(
std::move(data)),
205 m_automatic(automatic),
206 m_handleImages(handleimages),
207 m_allowOverwrites(allowoverwrites),
208 m_allowGeneric(allowgeneric),
209 m_dvdOrder(preferdvdorder),
210 m_host(
std::move(host)),
213 m_categories(
std::move(categories)),
214 m_userRating(userrating),
215 m_subtitle(
std::move(subtitle)),
216 m_description(
std::move(description)),
218 m_chanNum(
std::move(channum)),
219 m_chanSign(
std::move(chansign)),
220 m_chanName(
std::move(channame)),
221 m_chanPlaybackFilters(
std::move(chanplaybackfilters)),
222 m_recGroup(
std::move(recgroup)),
223 m_playGroup(
std::move(playgroup)),
224 m_seriesId(
std::move(seriesid)),
225 m_programid(
std::move(programid)),
226 m_storageGroup(
std::move(storagegroup)),
227 m_startTs(
std::move(startts)),
228 m_endTs(
std::move(endts)),
229 m_recStartTs(
std::move(recstartts)),
230 m_recEndTs(
std::move(recendts)),
231 m_programFlags(programflags),
232 m_audioProperties(audioproperties),
233 m_videoProperties(videoproperties),
234 m_subtitleType(subtitletype),
236 m_releaseDate(releasedate),
237 m_lastUpdated(
std::move(lastupdated)),
239 m_runtimeSecs(runtimesecs)
241 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
254 bool allowoverwrites,
259 const QString &title,
260 QStringList categories,
261 const float userrating,
267 QString certification,
269 const QDate releasedate,
270 std::chrono::minutes runtime,
271 std::chrono::seconds runtimesecs,
281 m_data(
std::move(data)),
283 m_automatic(automatic),
284 m_handleImages(handleimages),
285 m_allowOverwrites(allowoverwrites),
286 m_allowGeneric(allowgeneric),
287 m_dvdOrder(preferdvdorder),
288 m_host(
std::move(host)),
291 m_categories(
std::move(categories)),
292 m_userRating(userrating),
293 m_subtitle(
std::move(subtitle)),
294 m_tagline(
std::move(tagline)),
295 m_description(
std::move(description)),
298 m_certification(
std::move(certification)),
300 m_releaseDate(releasedate),
302 m_runtimeSecs(runtimesecs),
303 m_inetRef(
std::move(inetref)),
304 m_people(
std::move(people)),
305 m_trailerURL(
std::move(trailerURL)),
306 m_artwork(
std::move(artwork)),
307 m_downloads(
std::move(downloads))
309 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
316 QList<PersonInfo> ret;
324 while (it.hasPrevious())
325 ret.append(it.previous());
341 while (it.hasPrevious())
342 ret.append(it.previous());
350 metadataMap[
"title"] =
m_title;
354 metadataMap[
"userrating"] = QString::number(
m_userRating);
359 metadataMap[
"description0"] = metadataMap[
"description"] =
m_description;
360 metadataMap[
"season"] = QString::number(
m_season);
361 metadataMap[
"episode"] = QString::number(
m_episode);
362 metadataMap[
"chanid"] = QString::number(
m_chanId);
378 metadataMap[
"popularity"] = QString::number(
m_popularity);
379 metadataMap[
"budget"] = QString::number(
m_budget);
380 metadataMap[
"revenue"] = QString::number(
m_revenue);
381 metadataMap[
"album"] =
m_album;
382 metadataMap[
"tracknum"] = QString::number(
m_trackNum);
384 metadataMap[
"year"] = QString::number(
m_year);
390 metadataMap[
"runtime"] = QCoreApplication::translate(
"(Common)",
396 metadataMap[
"runtimesecs"] = QCoreApplication::translate(
"(Common)",
403 metadataMap[
"imdb"] =
m_imdb;
404 metadataMap[
"studios"] =
m_studios.join(
", ");
414 auto runtime = duration_cast<std::chrono::minutes>(runtimesecs);
417 QVariant::fromValue(pginfo),
kLookupData,
false,
false,
false,
false,
false,
441 QDomDocument doc(
"MythMetadataXML");
443 QDomElement root = doc.createElement(
"metadata");
444 doc.appendChild(root);
446 for (
const auto & item : qAsConst(list))
454 QDomDocument doc(
"MythMetadataXML");
456 QDomElement root = doc.createElement(
"metadata");
457 doc.appendChild(root);
466 QDomDocument doc(
"MythMetadataXML");
480 QDomElement placetoadd,
481 QDomDocument docroot)
486 QDomElement item = docroot.createElement(
"item");
487 placetoadd.appendChild(item);
488 QString RFC822(
"ddd, d MMMM yyyy hh:mm:ss");
493 QDomElement language = docroot.createElement(
"language");
494 item.appendChild(language);
495 language.appendChild(docroot.createTextNode(lookup->
GetLanguage()));
500 QDomElement title = docroot.createElement(
"title");
501 item.appendChild(title);
502 title.appendChild(docroot.createTextNode(lookup->
GetTitle()));
507 QDomElement subtitle = docroot.createElement(
"subtitle");
508 item.appendChild(subtitle);
509 subtitle.appendChild(docroot.createTextNode(lookup->
GetSubtitle()));
514 QDomElement network = docroot.createElement(
"network");
515 item.appendChild(network);
516 network.appendChild(docroot.createTextNode(lookup->
GetNetwork()));
521 QDomElement status = docroot.createElement(
"status");
522 item.appendChild(status);
523 status.appendChild(docroot.createTextNode(lookup->
GetStatus()));
528 QDomElement season = docroot.createElement(
"season");
529 item.appendChild(season);
530 season.appendChild(docroot.createTextNode(
533 QDomElement episode = docroot.createElement(
"episode");
534 item.appendChild(episode);
535 episode.appendChild(docroot.createTextNode(
541 QDomElement tagline = docroot.createElement(
"tagline");
542 item.appendChild(tagline);
543 tagline.appendChild(docroot.createTextNode(lookup->
GetTagline()));
548 QDomElement desc = docroot.createElement(
"description");
549 item.appendChild(desc);
550 desc.appendChild(docroot.createTextNode(lookup->
GetDescription()));
555 QDomElement albumname = docroot.createElement(
"albumname");
556 item.appendChild(albumname);
557 albumname.appendChild(docroot.createTextNode(lookup->
GetAlbumTitle()));
562 QDomElement inetref = docroot.createElement(
"inetref");
563 item.appendChild(inetref);
564 inetref.appendChild(docroot.createTextNode(lookup->
GetInetref()));
569 QDomElement collectionref = docroot.createElement(
"collectionref");
570 item.appendChild(collectionref);
571 collectionref.appendChild(docroot.createTextNode(lookup->
GetCollectionref()));
576 QDomElement tmsref = docroot.createElement(
"tmsref");
577 item.appendChild(tmsref);
578 tmsref.appendChild(docroot.createTextNode(lookup->
GetTMSref()));
581 if (!lookup->
GetIMDB().isEmpty())
583 QDomElement imdb = docroot.createElement(
"imdb");
584 item.appendChild(imdb);
585 imdb.appendChild(docroot.createTextNode(lookup->
GetIMDB()));
590 QDomElement homepage = docroot.createElement(
"homepage");
591 item.appendChild(homepage);
592 homepage.appendChild(docroot.createTextNode(lookup->
GetHomepage()));
597 QDomElement trailer = docroot.createElement(
"trailer");
598 item.appendChild(trailer);
599 trailer.appendChild(docroot.createTextNode(lookup->
GetTrailerURL()));
604 QDomElement chanid = docroot.createElement(
"chanid");
605 item.appendChild(chanid);
606 chanid.appendChild(docroot.createTextNode(
612 QDomElement channum = docroot.createElement(
"channum");
613 item.appendChild(channum);
614 channum.appendChild(docroot.createTextNode(lookup->
GetChanNum()));
619 QDomElement callsign = docroot.createElement(
"chansign");
620 item.appendChild(callsign);
621 callsign.appendChild(docroot.createTextNode(lookup->
GetChanSign()));
626 QDomElement channame = docroot.createElement(
"channame");
627 item.appendChild(channame);
628 channame.appendChild(docroot.createTextNode(lookup->
GetChanName()));
633 QDomElement filters = docroot.createElement(
"filters");
634 item.appendChild(filters);
635 filters.appendChild(docroot.createTextNode(
641 QDomElement recgroup = docroot.createElement(
"recgroup");
642 item.appendChild(recgroup);
643 recgroup.appendChild(docroot.createTextNode(lookup->
GetRecGroup()));
648 QDomElement playgroup = docroot.createElement(
"playgroup");
649 item.appendChild(playgroup);
650 playgroup.appendChild(docroot.createTextNode(lookup->
GetPlayGroup()));
655 QDomElement seriesid = docroot.createElement(
"seriesid");
656 item.appendChild(seriesid);
657 seriesid.appendChild(docroot.createTextNode(lookup->
GetSeriesId()));
662 QDomElement programid = docroot.createElement(
"programid");
663 item.appendChild(programid);
664 programid.appendChild(docroot.createTextNode(lookup->
GetProgramId()));
669 QDomElement sgroup = docroot.createElement(
"storagegroup");
670 item.appendChild(sgroup);
676 QDomElement startts = docroot.createElement(
"startts");
677 item.appendChild(startts);
678 startts.appendChild(docroot.createTextNode(
684 QDomElement endts = docroot.createElement(
"endts");
685 item.appendChild(endts);
686 endts.appendChild(docroot.createTextNode(
687 lookup->
GetEndTS().toString(RFC822)));
692 QDomElement recstartts = docroot.createElement(
"recstartts");
693 item.appendChild(recstartts);
694 recstartts.appendChild(docroot.createTextNode(
700 QDomElement recendts = docroot.createElement(
"recendts");
701 item.appendChild(recendts);
702 recendts.appendChild(docroot.createTextNode(
708 QDomElement progflags = docroot.createElement(
"programflags");
709 item.appendChild(progflags);
710 progflags.appendChild(docroot.createTextNode(
716 QDomElement audioprops = docroot.createElement(
"audioproperties");
717 item.appendChild(audioprops);
718 audioprops.appendChild(docroot.createTextNode(
724 QDomElement videoprops = docroot.createElement(
"videoproperties");
725 item.appendChild(videoprops);
726 videoprops.appendChild(docroot.createTextNode(
732 QDomElement subprops = docroot.createElement(
"subtitletype");
733 item.appendChild(subprops);
734 subprops.appendChild(docroot.createTextNode(
740 QDomElement releasedate = docroot.createElement(
"releasedate");
741 item.appendChild(releasedate);
742 releasedate.appendChild(docroot.createTextNode(
748 QDomElement lastupdated = docroot.createElement(
"lastupdated");
749 item.appendChild(lastupdated);
750 lastupdated.appendChild(docroot.createTextNode(
756 QDomElement userrating = docroot.createElement(
"userrating");
757 item.appendChild(userrating);
758 userrating.appendChild(docroot.createTextNode(QString::number(
764 QDomElement ratingcount = docroot.createElement(
"ratingcount");
765 item.appendChild(ratingcount);
766 ratingcount.appendChild(docroot.createTextNode(QString::number(
772 QDomElement tracknum = docroot.createElement(
"tracknum");
773 item.appendChild(tracknum);
774 tracknum.appendChild(docroot.createTextNode(QString::number(
780 QDomElement popularity = docroot.createElement(
"popularity");
781 item.appendChild(popularity);
782 popularity.appendChild(docroot.createTextNode(QString::number(
788 QDomElement budget = docroot.createElement(
"budget");
789 item.appendChild(budget);
790 budget.appendChild(docroot.createTextNode(QString::number(
796 QDomElement revenue = docroot.createElement(
"revenue");
797 item.appendChild(revenue);
798 revenue.appendChild(docroot.createTextNode(QString::number(
805 QDomElement runtime = docroot.createElement(
"runtime");
806 item.appendChild(runtime);
807 runtime.appendChild(docroot.createTextNode(QString::number(
814 QDomElement runtimesecs = docroot.createElement(
"runtimesecs");
815 item.appendChild(runtimesecs);
816 runtimesecs.appendChild(docroot.createTextNode(QString::number(
831 QDomElement placetoadd,
832 QDomDocument docroot)
835 QDomElement certifications = docroot.createElement(
"certifications");
836 placetoadd.appendChild(certifications);
838 QDomElement cert = docroot.createElement(
"certification");
839 certifications.appendChild(cert);
841 cert.setAttribute(
"name", certstr);
845 QDomElement placetoadd,
846 QDomDocument docroot)
849 QDomElement categories = docroot.createElement(
"categories");
850 placetoadd.appendChild(categories);
852 for (
const auto & str : qAsConst(cats))
854 QDomElement
cat = docroot.createElement(
"category");
855 categories.appendChild(
cat);
856 cat.setAttribute(
"type",
"genre");
857 cat.setAttribute(
"name", str);
862 QDomElement placetoadd,
863 QDomDocument docroot)
866 QDomElement studios = docroot.createElement(
"studios");
867 placetoadd.appendChild(studios);
869 for (
const auto & str : qAsConst(studs))
871 QDomElement stud = docroot.createElement(
"studio");
872 studios.appendChild(stud);
873 stud.setAttribute(
"name", str);
878 QDomElement placetoadd,
879 QDomDocument docroot)
882 QDomElement countries = docroot.createElement(
"countries");
883 placetoadd.appendChild(countries);
885 for (
const auto & str : qAsConst(counts))
887 QDomElement count = docroot.createElement(
"country");
888 countries.appendChild(count);
889 count.setAttribute(
"name", str);
903 uint programflags = 0;
904 uint audioproperties = 0;
905 uint videoproperties = 0;
906 uint subtitletype = 0;
911 uint ratingcount = 0;
918 QString certification;
922 QString chanplaybackfilters;
927 QString storagegroup;
931 QString collectionref;
937 QStringList categories;
938 QStringList countries;
940 float userrating = 0;
941 float popularity = 0;
943 QDateTime lastupdated;
946 QDateTime recstartts;
952 language = item.firstChildElement(
"language").text();
960 inetref = item.firstChildElement(
"inetref").text();
961 collectionref = item.firstChildElement(
"collectionref").text();
962 tmsref = item.firstChildElement(
"tmsref").text();
963 imdb = item.firstChildElement(
"imdb").text();
964 homepage = item.firstChildElement(
"homepage").text();
965 trailerURL = item.firstChildElement(
"trailer").text();
968 chanid = item.firstChildElement(
"chanid").text().toUInt();
969 channum = item.firstChildElement(
"channum").text();
970 chansign = item.firstChildElement(
"chansign").text();
971 channame = item.firstChildElement(
"channame").text();
972 chanplaybackfilters = item.firstChildElement(
"chanplaybackfilters").text();
973 recgroup = item.firstChildElement(
"recgroup").text();
974 playgroup = item.firstChildElement(
"playgroup").text();
975 seriesid = item.firstChildElement(
"seriesid").text();
976 programid = item.firstChildElement(
"programid").text();
977 storagegroup = item.firstChildElement(
"storagegroup").text();
979 firstChildElement(
"startts").text());
981 firstChildElement(
"endts").text());
983 firstChildElement(
"recstartts").text());
985 firstChildElement(
"recendts").text());
986 programflags = item.firstChildElement(
"programflags").text().toUInt();
987 audioproperties = item.firstChildElement(
"audioproperties").text().toUInt();
988 videoproperties = item.firstChildElement(
"videoproperties").text().toUInt();
989 subtitletype = item.firstChildElement(
"subtitletype").text().toUInt();
991 QString tmpDate = item.firstChildElement(
"releasedate").text();
992 if (!tmpDate.isEmpty())
995 firstChildElement(
"lastupdated").text());
997 userrating = item.firstChildElement(
"userrating").text().toFloat();
998 ratingcount = item.firstChildElement(
"ratingcount").text().toUInt();
999 tracknum = item.firstChildElement(
"tracknum").text().toUInt();
1000 popularity = item.firstChildElement(
"popularity").text().toFloat();
1001 budget = item.firstChildElement(
"budget").text().toUInt();
1002 revenue = item.firstChildElement(
"revenue").text().toUInt();
1003 year = item.firstChildElement(
"year").text().toUInt();
1004 if (!year && !releasedate.isNull())
1005 year = releasedate.toString(
"yyyy").toUInt();
1006 auto runtime = std::chrono::minutes(item.firstChildElement(
"runtime").text().toUInt());
1007 auto runtimesecs = std::chrono::seconds(item.firstChildElement(
"runtimesecs").text().toUInt());
1009 QDomElement systems = item.firstChildElement(
"systems");
1010 if (!systems.isNull())
1012 QDomElement firstSystem = systems.firstChildElement(
"system");
1013 if (!firstSystem.isNull())
1014 system = firstSystem.text();
1019 QDomElement certifications = item.firstChildElement(
"certifications");
1020 QVector< QPair<QString,QString> > ratinglist;
1021 if (!certifications.isNull())
1023 QDomElement cert = certifications.firstChildElement(
"certification");
1026 while (!cert.isNull())
1028 if (cert.hasAttribute(
"locale") && cert.hasAttribute(
"name"))
1030 QPair<QString,QString> newcert(cert.attribute(
"locale"),
1031 cert.attribute(
"name"));
1032 ratinglist.append(newcert);
1034 cert = cert.nextSiblingElement(
"certification");
1039 if (!ratinglist.isEmpty())
1040 certification = ratinglist.takeFirst().second;
1043 QDomElement categoriesxml = item.firstChildElement(
"categories");
1044 if (!categoriesxml.isNull())
1046 QDomElement
cat = categoriesxml.firstChildElement(
"category");
1049 while (!
cat.isNull())
1051 if (
cat.hasAttribute(
"name"))
1052 categories.append(
cat.attribute(
"name"));
1053 cat =
cat.nextSiblingElement(
"category");
1059 QDomElement countriesxml = item.firstChildElement(
"countries");
1060 if (!countriesxml.isNull())
1062 QDomElement cntry = countriesxml.firstChildElement(
"country");
1063 if (!cntry.isNull())
1065 while (!cntry.isNull())
1067 if (cntry.hasAttribute(
"name"))
1068 countries.append(cntry.attribute(
"name"));
1069 cntry = cntry.nextSiblingElement(
"country");
1075 QDomElement studiosxml = item.firstChildElement(
"studios");
1076 if (!studiosxml.isNull())
1078 QDomElement studio = studiosxml.firstChildElement(
"studio");
1079 if (!studio.isNull())
1081 while (!studio.isNull())
1083 if (studio.hasAttribute(
"name"))
1084 studios.append(studio.attribute(
"name"));
1085 studio = studio.nextSiblingElement(
"studio");
1091 QDomElement peoplexml = item.firstChildElement(
"people");
1092 if (!peoplexml.isNull())
1098 QDomElement artworkxml = item.firstChildElement(
"images");
1099 if (!artworkxml.isNull())
1118 season = item.firstChildElement(
"dvdseason").text().toUInt();
1122 episode = item.firstChildElement(
"dvdepisode").text().toUInt();
1128 season = item.firstChildElement(
"season").text().toUInt();
1132 episode = item.firstChildElement(
"episode").text().toUInt();
1134 LOG(VB_GENERAL, LOG_INFO, QString(
"Result Found, Season %1 Episode %2")
1135 .arg(season).arg(episode));
1141 lookup->
GetFilename(), title, network, status, categories, userrating,
1142 ratingcount, language, subtitle, tagline, description, season,
1143 episode, chanid, channum, chansign, channame,
1144 chanplaybackfilters, recgroup, playgroup, seriesid, programid,
1145 storagegroup, startts, endts, recstartts, recendts, programflags,
1146 audioproperties, videoproperties, subtitletype, certification,
1147 countries, popularity, budget, revenue, album, tracknum, system, year,
1148 releasedate, lastupdated, runtime, runtimesecs, inetref, collectionref,
1149 tmsref, imdb, people, studios, homepage, trailerURL, artwork,
DownloadMap());
1164 QString description;
1167 QString certification;
1168 float userrating = 0;
1170 QStringList categories;
1175 if (item.tagName() ==
"movie")
1177 else if (item.tagName() ==
"episodedetails")
1179 userrating = item.firstChildElement(
"rating").text().toFloat();
1180 year = item.firstChildElement(
"year").text().toUInt();
1181 season = item.firstChildElement(
"season").text().toUInt();
1182 episode = item.firstChildElement(
"episode").text().toUInt();
1185 inetref = item.firstChildElement(
"id").text();
1186 trailer = item.firstChildElement(
"trailer").text();
1187 certification = item.firstChildElement(
"mpaa").text();
1188 categories.append(item.firstChildElement(
"genre").text());
1190 QString tmpDate = item.firstChildElement(
"releasedate").text();
1191 if (!tmpDate.isEmpty())
1196 static const QRegularExpression kAlphaRE {
"[A-Za-z]" };
1198 std::chrono::minutes(item.firstChildElement(
"runtime").text()
1200 .trimmed().toUInt());
1202 QDomElement actor = item.firstChildElement(
"actor");
1203 if (!actor.isNull())
1205 while (!actor.isNull())
1208 info.
name = actor.firstChildElement(
"name").text();
1209 info.
role = actor.firstChildElement(
"role").text();
1210 info.
thumbnail = actor.firstChildElement(
"thumb").text();
1212 actor = actor.nextSiblingElement(
"actor");
1216 QString director = item.firstChildElement(
"director").text();
1217 if (!director.isEmpty())
1220 info.
name = director;
1230 userrating, subtitle, tagline, description, season, episode,
1231 certification, year, releasedate, runtime, runtime,
1232 inetref, people, trailer, artwork,
DownloadMap());
1239 QDomElement person = people.firstChildElement(
"person");
1240 if (!person.isNull())
1242 while (!person.isNull())
1244 if (person.hasAttribute(
"job"))
1246 QString jobstring = person.attribute(
"job");
1248 if (jobstring.toLower() ==
"actor")
1250 else if (jobstring.toLower() ==
"author")
1252 else if (jobstring.toLower() ==
"producer")
1254 else if (jobstring.toLower() ==
"executive producer")
1256 else if (jobstring.toLower() ==
"director")
1258 else if (jobstring.toLower() ==
"cinematographer")
1260 else if (jobstring.toLower() ==
"composer")
1262 else if (jobstring.toLower() ==
"editor")
1264 else if (jobstring.toLower() ==
"casting")
1266 else if (jobstring.toLower() ==
"artist")
1268 else if (jobstring.toLower() ==
"album artist")
1270 else if (jobstring.toLower() ==
"guest star")
1276 if (person.hasAttribute(
"name"))
1277 info.
name = person.attribute(
"name");
1278 if (person.hasAttribute(
"character"))
1279 info.
role = person.attribute(
"character");
1280 if (person.hasAttribute(
"thumb"))
1281 info.
thumbnail = person.attribute(
"thumb");
1282 if (person.hasAttribute(
"url"))
1283 info.
url = person.attribute(
"url");
1285 ret.insert(
type,info);
1287 person = person.nextSiblingElement(
"person");
1297 QDomElement image = artwork.firstChildElement(
"image");
1298 if (!image.isNull())
1300 while (!image.isNull())
1302 if (image.hasAttribute(
"type"))
1304 QString typestring = image.attribute(
"type");
1306 if (typestring.toLower() ==
"coverart")
1308 else if (typestring.toLower() ==
"fanart")
1310 else if (typestring.toLower() ==
"banner")
1312 else if (typestring.toLower() ==
"screenshot")
1314 else if (typestring.toLower() ==
"poster")
1316 else if (typestring.toLower() ==
"back cover")
1318 else if (typestring.toLower() ==
"inside cover")
1320 else if (typestring.toLower() ==
"cd image")
1326 if (image.hasAttribute(
"thumb"))
1327 info.
thumbnail = image.attribute(
"thumb");
1328 if (image.hasAttribute(
"url"))
1329 info.
url = image.attribute(
"url");
1330 if (image.hasAttribute(
"width"))
1331 info.
width = image.attribute(
"width").toUInt();
1334 if (image.hasAttribute(
"height"))
1335 info.
height = image.attribute(
"height").toUInt();
1339 ret.insert(
type,info);
1341 image = image.nextSiblingElement(
"image");
1350 #define D( i, j ) d[(i) * n + (j)]
1351 size_t m = s.length() + 1;
1352 size_t n =
t.length() + 1;
1353 int *
d =
new int[m * n];
1355 for (
size_t i = 0; i < m; i++ )
1357 for (
size_t j = 0; j < n; j++ )
1359 for (
size_t i = 1; i < m; i++ )
1361 for (
size_t j = 1; j < n; j++ )
1364 #
if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1365 s[
static_cast<int>(i) - 1] ==
t[
static_cast<int>(j) - 1]
1367 s[i - 1] ==
t[j - 1]
1370 D( i, j ) =
D( i - 1, j - 1 );
1373 int x =
D( i - 1, j );
1374 int y =
D( i - 1, j - 1 );
1375 int z =
D( i, j - 1 );
1376 D( i, j ) = 1 + std::min({x, y, z});
1380 int result =
D( m - 1, n - 1 );
1386 QString
nearestName(
const QString& actual,
const QStringList& candidates)
1388 int deltaBest = 10000;
1393 QStringList::ConstIterator i = candidates.begin();
1394 while ( i != candidates.end() )
1396 QString candidate = *i;
1397 int delta =
editDistance( actual.toLower(), candidate.toLower() );
1398 if ( delta < deltaBest )
1404 else if ( delta == deltaBest )
1411 if ( numBest == 1 && deltaBest <= tolerance &&
1412 actual.length() + best.length() >= 5 )
1419 QMap<QString, int> TimezoneOffsets;
1424 QString time =
t.simplified();
1425 short int hoursShift = 0;
1426 short int minutesShift = 0;
1428 QStringList
tmp = time.split(
' ');
1431 static const QRegularExpression kNonDigitRE {
"\\D" };
1432 if (
tmp.at(0).contains(kNonDigitRE))
1434 if (
tmp.size() != 5)
1436 QString ltimezone =
tmp.takeAt(
tmp.size() -1);
1437 if (ltimezone.size() == 5)
1440 int tz = ltimezone.toInt(&ok);
1443 hoursShift = tz / 100;
1444 minutesShift = tz % 100;
1448 hoursShift = TimezoneOffsets.value(ltimezone, 0);
1450 if (
tmp.at(0).size() == 1)
1451 tmp[0].prepend(
"0");
1452 tmp [1].truncate(3);
1454 time =
tmp.join(
" ");
1457 if (
tmp.at(2).size() == 4)
1458 result = QLocale::c().toDateTime(time,
"dd MMM yyyy hh:mm:ss");
1460 result = QLocale::c().toDateTime(time,
"dd MMM yy hh:mm:ss");
1461 if (result.isNull() || !result.isValid())
1463 result = result.addSecs(hoursShift * 3600 * (-1) + minutesShift *60 * (-1));
1464 result.setTimeSpec(Qt::UTC);