7#include <QCoreApplication>
10#include <QRegularExpression>
21static int x0 = qRegisterMetaType< RefCountHandler<MetadataLookup> >();
39 QStringList categories,
40 const float userrating,
52 QString chanplaybackfilters,
66 QString certification,
67 QStringList countries,
68 const float popularity,
75 const QDate releasedate,
76 QDateTime lastupdated,
77 std::chrono::minutes runtime,
78 std::chrono::seconds runtimesecs,
80 QString collectionref,
93 m_data(std::move(data)),
95 m_automatic(automatic),
96 m_handleImages(handleimages),
97 m_allowOverwrites(allowoverwrites),
98 m_allowGeneric(allowgeneric),
99 m_dvdOrder(preferdvdorder),
100 m_host(std::move(host)),
104 m_network(std::move(network)),
105 m_status(std::move(status)),
106 m_categories(std::move(categories)),
107 m_userRating(userrating),
108 m_ratingCount(ratingcount),
109 m_language(std::move(language)),
110 m_subtitle(std::move(subtitle)),
111 m_tagline(std::move(tagline)),
112 m_description(std::move(description)),
116 m_chanNum(std::move(channum)),
117 m_chanSign(std::move(chansign)),
118 m_chanName(std::move(channame)),
119 m_chanPlaybackFilters(std::move(chanplaybackfilters)),
120 m_recGroup(std::move(recgroup)),
121 m_playGroup(std::move(playgroup)),
122 m_seriesId(std::move(seriesid)),
123 m_programid(std::move(programid)),
124 m_storageGroup(std::move(storagegroup)),
125 m_startTs(std::move(startts)),
126 m_endTs(std::move(endts)),
127 m_recStartTs(std::move(recstartts)),
128 m_recEndTs(std::move(recendts)),
129 m_programFlags(programflags),
130 m_audioProperties(audioproperties),
131 m_videoProperties(videoproperties),
132 m_subtitleType(subtitletype),
133 m_certification(std::move(certification)),
134 m_countries(std::move(countries)),
135 m_popularity(popularity),
138 m_album(std::move(album)),
139 m_trackNum(tracknum),
140 m_system(std::move(system)),
142 m_releaseDate(releasedate),
143 m_lastUpdated(std::move(lastupdated)),
145 m_runtimeSecs(runtimesecs),
146 m_inetRef(std::move(inetref)),
147 m_collectionRef(std::move(collectionref)),
148 m_tmsRef(std::move(tmsref)),
149 m_imdb(std::move(imdb)),
150 m_people(std::move(people)),
151 m_studios(std::move(studios)),
152 m_homepage(std::move(homepage)),
153 m_trailerURL(std::move(trailerURL)),
154 m_artwork(std::move(artwork)),
155 m_downloads(std::move(downloads))
157 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
169 bool allowoverwrites,
174 const QString &title,
175 QStringList categories,
176 const float userrating,
183 QString chanplaybackfilters,
188 QString storagegroup,
191 QDateTime recstartts,
194 uint audioproperties,
195 uint videoproperties,
198 const QDate releasedate,
199 QDateTime lastupdated,
200 std::chrono::minutes runtime,
201 std::chrono::seconds runtimesecs) :
206 m_data(std::move(data)),
208 m_automatic(automatic),
209 m_handleImages(handleimages),
210 m_allowOverwrites(allowoverwrites),
211 m_allowGeneric(allowgeneric),
212 m_dvdOrder(preferdvdorder),
213 m_host(std::move(host)),
217 m_categories(std::move(categories)),
218 m_userRating(userrating),
219 m_subtitle(std::move(subtitle)),
220 m_description(std::move(description)),
222 m_chanNum(std::move(channum)),
223 m_chanSign(std::move(chansign)),
224 m_chanName(std::move(channame)),
225 m_chanPlaybackFilters(std::move(chanplaybackfilters)),
226 m_recGroup(std::move(recgroup)),
227 m_playGroup(std::move(playgroup)),
228 m_seriesId(std::move(seriesid)),
229 m_programid(std::move(programid)),
230 m_storageGroup(std::move(storagegroup)),
231 m_startTs(std::move(startts)),
232 m_endTs(std::move(endts)),
233 m_recStartTs(std::move(recstartts)),
234 m_recEndTs(std::move(recendts)),
235 m_programFlags(programflags),
236 m_audioProperties(audioproperties),
237 m_videoProperties(videoproperties),
238 m_subtitleType(subtitletype),
240 m_releaseDate(releasedate),
241 m_lastUpdated(std::move(lastupdated)),
243 m_runtimeSecs(runtimesecs)
245 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
257 bool allowoverwrites,
262 const QString &title,
263 QStringList categories,
264 const float userrating,
270 QString certification,
272 const QDate releasedate,
273 std::chrono::minutes runtime,
274 std::chrono::seconds runtimesecs,
284 m_data(std::move(data)),
286 m_automatic(automatic),
287 m_handleImages(handleimages),
288 m_allowOverwrites(allowoverwrites),
289 m_allowGeneric(allowgeneric),
290 m_dvdOrder(preferdvdorder),
291 m_host(std::move(host)),
295 m_categories(std::move(categories)),
296 m_userRating(userrating),
297 m_subtitle(std::move(subtitle)),
298 m_tagline(std::move(tagline)),
299 m_description(std::move(description)),
302 m_certification(std::move(certification)),
304 m_releaseDate(releasedate),
306 m_runtimeSecs(runtimesecs),
307 m_inetRef(std::move(inetref)),
308 m_people(std::move(people)),
309 m_trailerURL(std::move(trailerURL)),
310 m_artwork(std::move(artwork)),
311 m_downloads(std::move(downloads))
313 QString manRecSuffix = QString(
" (%1)").arg(QObject::tr(
"Manual Record"));
322 QList<PersonInfo> ret;
323 ret.reserve(orig.size());
334 ret.reserve(orig.size());
342 metadataMap[
"title"] =
m_title;
346 metadataMap[
"userrating"] = QString::number(
m_userRating);
351 metadataMap[
"description0"] = metadataMap[
"description"] =
m_description;
352 metadataMap[
"season"] = QString::number(
m_season);
353 metadataMap[
"episode"] = QString::number(
m_episode);
354 metadataMap[
"chanid"] = QString::number(
m_chanId);
370 metadataMap[
"popularity"] = QString::number(
m_popularity);
371 metadataMap[
"budget"] = QString::number(
m_budget);
372 metadataMap[
"revenue"] = QString::number(
m_revenue);
373 metadataMap[
"album"] =
m_album;
374 metadataMap[
"tracknum"] = QString::number(
m_trackNum);
376 metadataMap[
"year"] = QString::number(
m_year);
382 metadataMap[
"runtime"] = QCoreApplication::translate(
"(Common)",
388 metadataMap[
"runtimesecs"] = QCoreApplication::translate(
"(Common)",
395 metadataMap[
"imdb"] =
m_imdb;
396 metadataMap[
"studios"] =
m_studios.join(
", ");
406 auto runtime = duration_cast<std::chrono::minutes>(runtimesecs);
409 QVariant::fromValue(pginfo),
kLookupData,
false,
false,
false,
false,
false,
433 QDomDocument doc(
"MythMetadataXML");
435 QDomElement root = doc.createElement(
"metadata");
436 doc.appendChild(root);
438 for (
const auto & item : std::as_const(list))
446 QDomDocument doc(
"MythMetadataXML");
448 QDomElement root = doc.createElement(
"metadata");
449 doc.appendChild(root);
458 QDomDocument doc(
"MythMetadataXML");
472 QDomElement placetoadd,
473 QDomDocument docroot)
478 QDomElement item = docroot.createElement(
"item");
479 placetoadd.appendChild(item);
480 QString RFC822(
"ddd, d MMMM yyyy hh:mm:ss");
485 QDomElement language = docroot.createElement(
"language");
486 item.appendChild(language);
487 language.appendChild(docroot.createTextNode(lookup->
GetLanguage()));
492 QDomElement title = docroot.createElement(
"title");
493 item.appendChild(title);
494 title.appendChild(docroot.createTextNode(lookup->
GetTitle()));
499 QDomElement subtitle = docroot.createElement(
"subtitle");
500 item.appendChild(subtitle);
501 subtitle.appendChild(docroot.createTextNode(lookup->
GetSubtitle()));
506 QDomElement network = docroot.createElement(
"network");
507 item.appendChild(network);
508 network.appendChild(docroot.createTextNode(lookup->
GetNetwork()));
513 QDomElement status = docroot.createElement(
"status");
514 item.appendChild(status);
515 status.appendChild(docroot.createTextNode(lookup->
GetStatus()));
520 QDomElement season = docroot.createElement(
"season");
521 item.appendChild(season);
522 season.appendChild(docroot.createTextNode(
525 QDomElement episode = docroot.createElement(
"episode");
526 item.appendChild(episode);
527 episode.appendChild(docroot.createTextNode(
533 QDomElement tagline = docroot.createElement(
"tagline");
534 item.appendChild(tagline);
535 tagline.appendChild(docroot.createTextNode(lookup->
GetTagline()));
540 QDomElement desc = docroot.createElement(
"description");
541 item.appendChild(desc);
542 desc.appendChild(docroot.createTextNode(lookup->
GetDescription()));
547 QDomElement albumname = docroot.createElement(
"albumname");
548 item.appendChild(albumname);
549 albumname.appendChild(docroot.createTextNode(lookup->
GetAlbumTitle()));
554 QDomElement inetref = docroot.createElement(
"inetref");
555 item.appendChild(inetref);
556 inetref.appendChild(docroot.createTextNode(lookup->
GetInetref()));
561 QDomElement collectionref = docroot.createElement(
"collectionref");
562 item.appendChild(collectionref);
563 collectionref.appendChild(docroot.createTextNode(lookup->
GetCollectionref()));
568 QDomElement tmsref = docroot.createElement(
"tmsref");
569 item.appendChild(tmsref);
570 tmsref.appendChild(docroot.createTextNode(lookup->
GetTMSref()));
573 if (!lookup->
GetIMDB().isEmpty())
575 QDomElement imdb = docroot.createElement(
"imdb");
576 item.appendChild(imdb);
577 imdb.appendChild(docroot.createTextNode(lookup->
GetIMDB()));
582 QDomElement homepage = docroot.createElement(
"homepage");
583 item.appendChild(homepage);
584 homepage.appendChild(docroot.createTextNode(lookup->
GetHomepage()));
589 QDomElement trailer = docroot.createElement(
"trailer");
590 item.appendChild(trailer);
591 trailer.appendChild(docroot.createTextNode(lookup->
GetTrailerURL()));
596 QDomElement chanid = docroot.createElement(
"chanid");
597 item.appendChild(chanid);
598 chanid.appendChild(docroot.createTextNode(
604 QDomElement channum = docroot.createElement(
"channum");
605 item.appendChild(channum);
606 channum.appendChild(docroot.createTextNode(lookup->
GetChanNum()));
611 QDomElement callsign = docroot.createElement(
"chansign");
612 item.appendChild(callsign);
613 callsign.appendChild(docroot.createTextNode(lookup->
GetChanSign()));
618 QDomElement channame = docroot.createElement(
"channame");
619 item.appendChild(channame);
620 channame.appendChild(docroot.createTextNode(lookup->
GetChanName()));
625 QDomElement filters = docroot.createElement(
"filters");
626 item.appendChild(filters);
627 filters.appendChild(docroot.createTextNode(
633 QDomElement recgroup = docroot.createElement(
"recgroup");
634 item.appendChild(recgroup);
635 recgroup.appendChild(docroot.createTextNode(lookup->
GetRecGroup()));
640 QDomElement playgroup = docroot.createElement(
"playgroup");
641 item.appendChild(playgroup);
642 playgroup.appendChild(docroot.createTextNode(lookup->
GetPlayGroup()));
647 QDomElement seriesid = docroot.createElement(
"seriesid");
648 item.appendChild(seriesid);
649 seriesid.appendChild(docroot.createTextNode(lookup->
GetSeriesId()));
654 QDomElement programid = docroot.createElement(
"programid");
655 item.appendChild(programid);
656 programid.appendChild(docroot.createTextNode(lookup->
GetProgramId()));
661 QDomElement sgroup = docroot.createElement(
"storagegroup");
662 item.appendChild(sgroup);
668 QDomElement startts = docroot.createElement(
"startts");
669 item.appendChild(startts);
670 startts.appendChild(docroot.createTextNode(
676 QDomElement endts = docroot.createElement(
"endts");
677 item.appendChild(endts);
678 endts.appendChild(docroot.createTextNode(
679 lookup->
GetEndTS().toString(RFC822)));
684 QDomElement recstartts = docroot.createElement(
"recstartts");
685 item.appendChild(recstartts);
686 recstartts.appendChild(docroot.createTextNode(
692 QDomElement recendts = docroot.createElement(
"recendts");
693 item.appendChild(recendts);
694 recendts.appendChild(docroot.createTextNode(
700 QDomElement progflags = docroot.createElement(
"programflags");
701 item.appendChild(progflags);
702 progflags.appendChild(docroot.createTextNode(
708 QDomElement audioprops = docroot.createElement(
"audioproperties");
709 item.appendChild(audioprops);
710 audioprops.appendChild(docroot.createTextNode(
716 QDomElement videoprops = docroot.createElement(
"videoproperties");
717 item.appendChild(videoprops);
718 videoprops.appendChild(docroot.createTextNode(
724 QDomElement subprops = docroot.createElement(
"subtitletype");
725 item.appendChild(subprops);
726 subprops.appendChild(docroot.createTextNode(
732 QDomElement releasedate = docroot.createElement(
"releasedate");
733 item.appendChild(releasedate);
734 releasedate.appendChild(docroot.createTextNode(
740 QDomElement lastupdated = docroot.createElement(
"lastupdated");
741 item.appendChild(lastupdated);
742 lastupdated.appendChild(docroot.createTextNode(
748 QDomElement userrating = docroot.createElement(
"userrating");
749 item.appendChild(userrating);
750 userrating.appendChild(docroot.createTextNode(QString::number(
756 QDomElement ratingcount = docroot.createElement(
"ratingcount");
757 item.appendChild(ratingcount);
758 ratingcount.appendChild(docroot.createTextNode(QString::number(
764 QDomElement tracknum = docroot.createElement(
"tracknum");
765 item.appendChild(tracknum);
766 tracknum.appendChild(docroot.createTextNode(QString::number(
772 QDomElement popularity = docroot.createElement(
"popularity");
773 item.appendChild(popularity);
774 popularity.appendChild(docroot.createTextNode(QString::number(
780 QDomElement budget = docroot.createElement(
"budget");
781 item.appendChild(budget);
782 budget.appendChild(docroot.createTextNode(QString::number(
788 QDomElement revenue = docroot.createElement(
"revenue");
789 item.appendChild(revenue);
790 revenue.appendChild(docroot.createTextNode(QString::number(
797 QDomElement runtime = docroot.createElement(
"runtime");
798 item.appendChild(runtime);
799 runtime.appendChild(docroot.createTextNode(QString::number(
806 QDomElement runtimesecs = docroot.createElement(
"runtimesecs");
807 item.appendChild(runtimesecs);
808 runtimesecs.appendChild(docroot.createTextNode(QString::number(
823 QDomElement placetoadd,
824 QDomDocument docroot)
827 QDomElement certifications = docroot.createElement(
"certifications");
828 placetoadd.appendChild(certifications);
830 QDomElement cert = docroot.createElement(
"certification");
831 certifications.appendChild(cert);
833 cert.setAttribute(
"name", certstr);
837 QDomElement placetoadd,
838 QDomDocument docroot)
841 QDomElement categories = docroot.createElement(
"categories");
842 placetoadd.appendChild(categories);
844 for (
const auto & str : std::as_const(cats))
846 QDomElement
cat = docroot.createElement(
"category");
847 categories.appendChild(
cat);
848 cat.setAttribute(
"type",
"genre");
849 cat.setAttribute(
"name", str);
854 QDomElement placetoadd,
855 QDomDocument docroot)
858 QDomElement studios = docroot.createElement(
"studios");
859 placetoadd.appendChild(studios);
861 for (
const auto & str : std::as_const(studs))
863 QDomElement stud = docroot.createElement(
"studio");
864 studios.appendChild(stud);
865 stud.setAttribute(
"name", str);
870 QDomElement placetoadd,
871 QDomDocument docroot)
874 QDomElement countries = docroot.createElement(
"countries");
875 placetoadd.appendChild(countries);
877 for (
const auto & str : std::as_const(counts))
879 QDomElement count = docroot.createElement(
"country");
880 countries.appendChild(count);
881 count.setAttribute(
"name", str);
895 uint programflags = 0;
896 uint audioproperties = 0;
897 uint videoproperties = 0;
898 uint subtitletype = 0;
903 uint ratingcount = 0;
910 QString certification;
914 QString chanplaybackfilters;
919 QString storagegroup;
923 QString collectionref;
929 QStringList categories;
930 QStringList countries;
932 float userrating = 0;
933 float popularity = 0;
935 QDateTime lastupdated;
938 QDateTime recstartts;
944 language = item.firstChildElement(
"language").text();
952 inetref = item.firstChildElement(
"inetref").text();
953 collectionref = item.firstChildElement(
"collectionref").text();
954 tmsref = item.firstChildElement(
"tmsref").text();
955 imdb = item.firstChildElement(
"imdb").text();
956 homepage = item.firstChildElement(
"homepage").text();
957 trailerURL = item.firstChildElement(
"trailer").text();
960 chanid = item.firstChildElement(
"chanid").text().toUInt();
961 channum = item.firstChildElement(
"channum").text();
962 chansign = item.firstChildElement(
"chansign").text();
963 channame = item.firstChildElement(
"channame").text();
964 chanplaybackfilters = item.firstChildElement(
"chanplaybackfilters").text();
965 recgroup = item.firstChildElement(
"recgroup").text();
966 playgroup = item.firstChildElement(
"playgroup").text();
967 seriesid = item.firstChildElement(
"seriesid").text();
968 programid = item.firstChildElement(
"programid").text();
969 storagegroup = item.firstChildElement(
"storagegroup").text();
971 firstChildElement(
"startts").text());
973 firstChildElement(
"endts").text());
975 firstChildElement(
"recstartts").text());
977 firstChildElement(
"recendts").text());
978 programflags = item.firstChildElement(
"programflags").text().toUInt();
979 audioproperties = item.firstChildElement(
"audioproperties").text().toUInt();
980 videoproperties = item.firstChildElement(
"videoproperties").text().toUInt();
981 subtitletype = item.firstChildElement(
"subtitletype").text().toUInt();
983 QString tmpDate = item.firstChildElement(
"releasedate").text();
984 if (!tmpDate.isEmpty())
987 firstChildElement(
"lastupdated").text());
989 userrating = item.firstChildElement(
"userrating").text().toFloat();
990 ratingcount = item.firstChildElement(
"ratingcount").text().toUInt();
991 tracknum = item.firstChildElement(
"tracknum").text().toUInt();
992 popularity = item.firstChildElement(
"popularity").text().toFloat();
993 budget = item.firstChildElement(
"budget").text().toUInt();
994 revenue = item.firstChildElement(
"revenue").text().toUInt();
995 year = item.firstChildElement(
"year").text().toUInt();
996 if (!year && !releasedate.isNull())
997 year = releasedate.toString(
"yyyy").toUInt();
998 auto runtime = std::chrono::minutes(item.firstChildElement(
"runtime").text().toUInt());
999 auto runtimesecs = std::chrono::seconds(item.firstChildElement(
"runtimesecs").text().toUInt());
1001 QDomElement systems = item.firstChildElement(
"systems");
1002 if (!systems.isNull())
1004 QDomElement firstSystem = systems.firstChildElement(
"system");
1005 if (!firstSystem.isNull())
1006 system = firstSystem.text();
1011 QDomElement certifications = item.firstChildElement(
"certifications");
1012 QVector< QPair<QString,QString> > ratinglist;
1013 if (!certifications.isNull())
1015 QDomElement cert = certifications.firstChildElement(
"certification");
1018 while (!cert.isNull())
1020 if (cert.hasAttribute(
"locale") && cert.hasAttribute(
"name"))
1022 QPair<QString,QString> newcert(cert.attribute(
"locale"),
1023 cert.attribute(
"name"));
1024 ratinglist.append(newcert);
1026 cert = cert.nextSiblingElement(
"certification");
1031 if (!ratinglist.isEmpty())
1032 certification = ratinglist.takeFirst().second;
1035 QDomElement categoriesxml = item.firstChildElement(
"categories");
1036 if (!categoriesxml.isNull())
1038 QDomElement
cat = categoriesxml.firstChildElement(
"category");
1041 while (!
cat.isNull())
1043 if (
cat.hasAttribute(
"name"))
1044 categories.append(
cat.attribute(
"name"));
1045 cat =
cat.nextSiblingElement(
"category");
1051 QDomElement countriesxml = item.firstChildElement(
"countries");
1052 if (!countriesxml.isNull())
1054 QDomElement cntry = countriesxml.firstChildElement(
"country");
1055 if (!cntry.isNull())
1057 while (!cntry.isNull())
1059 if (cntry.hasAttribute(
"name"))
1060 countries.append(cntry.attribute(
"name"));
1061 cntry = cntry.nextSiblingElement(
"country");
1067 QDomElement studiosxml = item.firstChildElement(
"studios");
1068 if (!studiosxml.isNull())
1070 QDomElement studio = studiosxml.firstChildElement(
"studio");
1071 if (!studio.isNull())
1073 while (!studio.isNull())
1075 if (studio.hasAttribute(
"name"))
1076 studios.append(studio.attribute(
"name"));
1077 studio = studio.nextSiblingElement(
"studio");
1083 QDomElement peoplexml = item.firstChildElement(
"people");
1084 if (!peoplexml.isNull())
1090 QDomElement artworkxml = item.firstChildElement(
"images");
1091 if (!artworkxml.isNull())
1110 season = item.firstChildElement(
"dvdseason").text().toUInt();
1114 episode = item.firstChildElement(
"dvdepisode").text().toUInt();
1120 season = item.firstChildElement(
"season").text().toUInt();
1124 episode = item.firstChildElement(
"episode").text().toUInt();
1126 LOG(VB_GENERAL, LOG_INFO, QString(
"Result Found, Season %1 Episode %2")
1127 .arg(season).arg(episode));
1133 lookup->
GetFilename(), title, network, status, categories, userrating,
1134 ratingcount, language, subtitle, tagline, description, season,
1135 episode, chanid, channum, chansign, channame,
1136 chanplaybackfilters, recgroup, playgroup, seriesid, programid,
1137 storagegroup, startts, endts, recstartts, recendts, programflags,
1138 audioproperties, videoproperties, subtitletype, certification,
1139 countries, popularity, budget, revenue, album, tracknum, system, year,
1140 releasedate, lastupdated, runtime, runtimesecs, inetref, collectionref,
1141 tmsref, imdb, people, studios, homepage, trailerURL, artwork,
DownloadMap());
1156 QString description;
1159 QString certification;
1160 float userrating = 0;
1162 QStringList categories;
1167 if (item.tagName() ==
"movie")
1169 else if (item.tagName() ==
"episodedetails")
1171 userrating = item.firstChildElement(
"rating").text().toFloat();
1172 year = item.firstChildElement(
"year").text().toUInt();
1173 season = item.firstChildElement(
"season").text().toUInt();
1174 episode = item.firstChildElement(
"episode").text().toUInt();
1177 inetref = item.firstChildElement(
"id").text();
1178 trailer = item.firstChildElement(
"trailer").text();
1179 certification = item.firstChildElement(
"mpaa").text();
1180 categories.append(item.firstChildElement(
"genre").text());
1182 QString tmpDate = item.firstChildElement(
"releasedate").text();
1183 if (!tmpDate.isEmpty())
1188 static const QRegularExpression kAlphaRE {
"[A-Za-z]" };
1190 std::chrono::minutes(item.firstChildElement(
"runtime").text()
1192 .trimmed().toUInt());
1194 QDomElement actor = item.firstChildElement(
"actor");
1195 if (!actor.isNull())
1197 while (!actor.isNull())
1200 info.name = actor.firstChildElement(
"name").text();
1201 info.role = actor.firstChildElement(
"role").text();
1202 info.thumbnail = actor.firstChildElement(
"thumb").text();
1204 actor = actor.nextSiblingElement(
"actor");
1208 QString director = item.firstChildElement(
"director").text();
1209 if (!director.isEmpty())
1212 info.name = director;
1222 userrating, subtitle, tagline, description, season, episode,
1223 certification, year, releasedate, runtime, runtime,
1224 inetref, people, trailer, artwork,
DownloadMap());
1231 QDomElement person = people.firstChildElement(
"person");
1232 if (!person.isNull())
1234 while (!person.isNull())
1236 if (person.hasAttribute(
"job"))
1238 QString jobstring = person.attribute(
"job");
1240 if (jobstring.toLower() ==
"actor")
1242 else if (jobstring.toLower() ==
"author")
1244 else if (jobstring.toLower() ==
"producer")
1246 else if (jobstring.toLower() ==
"executive producer")
1248 else if (jobstring.toLower() ==
"director")
1250 else if (jobstring.toLower() ==
"cinematographer")
1252 else if (jobstring.toLower() ==
"composer")
1254 else if (jobstring.toLower() ==
"editor")
1256 else if (jobstring.toLower() ==
"casting")
1258 else if (jobstring.toLower() ==
"artist")
1260 else if (jobstring.toLower() ==
"album artist")
1262 else if (jobstring.toLower() ==
"guest star")
1268 if (person.hasAttribute(
"name"))
1269 info.name = person.attribute(
"name");
1270 if (person.hasAttribute(
"character"))
1271 info.role = person.attribute(
"character");
1272 if (person.hasAttribute(
"thumb"))
1273 info.thumbnail = person.attribute(
"thumb");
1274 if (person.hasAttribute(
"url"))
1275 info.url = person.attribute(
"url");
1279 person = person.nextSiblingElement(
"person");
1289 QDomElement image = artwork.firstChildElement(
"image");
1290 if (!image.isNull())
1292 while (!image.isNull())
1294 if (image.hasAttribute(
"type"))
1296 QString typestring = image.attribute(
"type");
1298 if (typestring.toLower() ==
"coverart")
1300 else if (typestring.toLower() ==
"fanart")
1302 else if (typestring.toLower() ==
"banner")
1304 else if (typestring.toLower() ==
"screenshot")
1306 else if (typestring.toLower() ==
"poster")
1308 else if (typestring.toLower() ==
"back cover")
1310 else if (typestring.toLower() ==
"inside cover")
1312 else if (typestring.toLower() ==
"cd image")
1318 if (image.hasAttribute(
"thumb"))
1319 info.thumbnail = image.attribute(
"thumb");
1320 if (image.hasAttribute(
"url"))
1321 info.url = image.attribute(
"url");
1322 if (image.hasAttribute(
"width"))
1323 info.width = image.attribute(
"width").toUInt();
1326 if (image.hasAttribute(
"height"))
1327 info.height = image.attribute(
"height").toUInt();
1333 image = image.nextSiblingElement(
"image");
1342#define D( i, j ) d[((i) * n) + (j)]
1343 size_t m = s.length() + 1;
1344 size_t n =
t.length() + 1;
1345 int *
d =
new int[m * n];
1347 for (
size_t i = 0; i < m; i++ )
1349 for (
size_t j = 0; j < n; j++ )
1351 for (
size_t i = 1; i < m; i++ )
1353 for (
size_t j = 1; j < n; j++ )
1356#
if QT_VERSION < QT_VERSION_CHECK(6,0,0)
1357 s[
static_cast<int>(i) - 1] ==
t[
static_cast<int>(j) - 1]
1359 s[i - 1] ==
t[j - 1]
1363 D( i, j ) =
D( i - 1, j - 1 );
1367 int x =
D( i - 1, j );
1368 int y =
D( i - 1, j - 1 );
1369 int z =
D( i, j - 1 );
1370 D( i, j ) = 1 + std::min({x, y, z});
1374 int result =
D( m - 1, n - 1 );
1380QString
nearestName(
const QString& actual,
const QStringList& candidates)
1382 int deltaBest = 10000;
1387 QStringList::ConstIterator i = candidates.begin();
1388 while ( i != candidates.end() )
1390 QString candidate = *i;
1391 int delta =
editDistance( actual.toLower(), candidate.toLower() );
1392 if ( delta < deltaBest )
1398 else if ( delta == deltaBest )
1405 if ( numBest == 1 && deltaBest <= tolerance &&
1406 actual.length() + best.length() >= 5 )
1413 QMap<QString, int> TimezoneOffsets;
1418 QString time =
t.simplified();
1419 short int hoursShift = 0;
1420 short int minutesShift = 0;
1422 QStringList tmp = time.split(
' ');
1425 static const QRegularExpression kNonDigitRE {
"\\D" };
1426 if (tmp.at(0).contains(kNonDigitRE))
1428 if (tmp.size() != 5)
1430 QString ltimezone = tmp.takeAt(tmp.size() -1);
1431 if (ltimezone.size() == 5)
1434 int tz = ltimezone.toInt(&ok);
1437 hoursShift = tz / 100;
1438 minutesShift = tz % 100;
1443 hoursShift = TimezoneOffsets.value(ltimezone, 0);
1446 if (tmp.at(0).size() == 1)
1447 tmp[0].prepend(
"0");
1448 tmp [1].truncate(3);
1450 time = tmp.join(
" ");
1453 if (tmp.at(2).size() == 4)
1454 result = QLocale::c().toDateTime(time,
"dd MMM yyyy hh:mm:ss");
1456 result = QLocale::c().toDateTime(time,
"dd MMM yy hh:mm:ss");
1457 if (result.isNull() || !result.isValid())
1459 result = result.addSecs((hoursShift * 3600 * (-1)) + (minutesShift *60 * (-1)));
1460#if QT_VERSION < QT_VERSION_CHECK(6,5,0)
1461 result.setTimeSpec(Qt::UTC);
1463 result.setTimeZone(QTimeZone(QTimeZone::UTC));
int GetNumSetting(const QString &key, int defaultval=0)
MythLocale * GetLocale(void) const
QString GetCountryCode() const
static QString UnescapeHTML(const QString &escaped)
Holds information on recordings and videos.
float GetStars(void) const
uint GetChanID(void) const
This is the unique key used in the database to locate tuning information.
QString GetBasename(void) const
QString GetSeriesID(void) const
uint GetVideoProperties(void) const
uint GetEpisode(void) const
uint GetSubtitleType(void) const
QString GetProgramID(void) const
QString GetRecordingGroup(void) const
QDateTime GetScheduledEndTime(void) const
The scheduled end time of the program.
QString GetChannelPlaybackFilters(void) const
QString GetInetRef(void) const
uint GetAudioProperties(void) const
QString GetHostname(void) const
QString GetPlaybackGroup(void) const
QString GetDescription(void) const
QDateTime GetLastModifiedTime(void) const
QString GetStorageGroup(void) const
QString GetChannelName(void) const
This is the channel name in the local market, i.e.
QString GetTitle(void) const
QDateTime GetRecordingStartTime(void) const
Approximate time the recording started.
QDateTime GetScheduledStartTime(void) const
The scheduled start time of program.
QString GetChanNum(void) const
This is the channel "number", in the form 1, 1_2, 1-2, 1#1, etc.
uint GetYearOfInitialRelease(void) const
QDate GetOriginalAirDate(void) const
uint32_t GetProgramFlags(void) const
QDateTime GetRecordingEndTime(void) const
Approximate time the recording should have ended, did end, or is intended to end.
QString GetSubtitle(void) const
QString GetCategory(void) const
uint GetSeason(void) const
QString GetChannelSchedulingID(void) const
This is the unique programming identifier of a channel.
General purpose reference counter.
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
static const iso6937table * d
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
QHash< QString, QString > InfoMap
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
@ kDateFull
Default local time.
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.