9 #include <QApplication>
37 (QEvent::Type) QEvent::registerEventType();
49 (QEvent::Type) QEvent::registerEventType();
61 (QEvent::Type) QEvent::registerEventType();
70 (QEvent::Type) QEvent::registerEventType();
112 bool getimages,
bool allowgeneric)
122 lookup->SetData(QVariant::fromValue(recrule));
123 lookup->SetAutomatic(automatic);
124 lookup->SetHandleImages(getimages);
125 lookup->SetAllowGeneric(allowgeneric);
127 lookup->SetTitle(recrule->
m_title);
130 lookup->SetSeason(recrule->
m_season);
140 bool getimages,
bool allowgeneric)
150 lookup->SetData(QVariant::fromValue(pginfo));
151 lookup->SetAutomatic(automatic);
152 lookup->SetHandleImages(getimages);
153 lookup->SetAllowGeneric(allowgeneric);
155 lookup->SetTitle(pginfo->
GetTitle());
168 bool getimages,
bool allowgeneric)
178 lookup->SetData(QVariant::fromValue(metadata));
179 lookup->SetAutomatic(automatic);
180 lookup->SetHandleImages(getimages);
181 lookup->SetAllowGeneric(allowgeneric);
182 lookup->SetHost(metadata->
GetHost());
183 lookup->SetTitle(metadata->
GetTitle());
185 lookup->SetSeason(metadata->
GetSeason());
209 const QString& subtitle,
210 const QString& inetref,
213 const QString& grabber,
220 lookup->SetAutomatic(
false);
221 lookup->SetHandleImages(
false);
222 lookup->SetAllowGeneric(allowgeneric);
223 lookup->SetTitle(title);
224 lookup->SetSubtitle(subtitle);
225 lookup->SetSeason(season);
226 lookup->SetEpisode(episode);
227 lookup->SetInetref(inetref);
228 if (grabber.toLower() ==
"movie")
230 else if (grabber.toLower() ==
"tv" ||
231 grabber.toLower() ==
"television")
254 QCoreApplication::processEvents();
276 LOG(VB_GENERAL, LOG_WARNING,
"Could not retrieve list of "
277 "available backends.");
302 QCoreApplication::postEvent(parent(),
316 if (!coverartlist.empty())
319 info.
url = coverartlist.takeFirst().url;
324 if (!fanartlist.empty())
329 if (season > 0 && season <= fanartlist.count())
331 info.
url = fanartlist.takeAt(index).url;
336 if (!bannerlist.empty())
339 info.
url = bannerlist.takeFirst().url;
346 if (!screenshotlist.empty())
349 info.
url = screenshotlist.takeFirst().url;
362 QCoreApplication::postEvent(parent(),
373 QCoreApplication::postEvent(parent(),
383 QCoreApplication::postEvent(parent(),
400 if (metadata->GetTagline().isEmpty())
403 metadata->SetYear(lookup->
GetYear());
404 if (metadata->GetReleaseDate() == QDate())
407 metadata->GetDirector().isEmpty())
410 if (director.count() > 0)
411 metadata->SetDirector(director.takeFirst().name);
413 if (metadata->GetStudio().isEmpty())
416 if (studios.count() > 0)
417 metadata->SetStudio(studios.takeFirst());
420 metadata->GetPlot().isEmpty())
422 if (metadata->GetUserRating() == 0)
426 if (metadata->GetLength() == 0min)
428 if (metadata->GetSeason() == 0)
429 metadata->SetSeason(lookup->
GetSeason());
430 if (metadata->GetEpisode() == 0)
432 if (metadata->GetHomepage().isEmpty())
443 for (
const auto& actor : qAsConst(gueststars))
444 actors.append(actor);
449 for (
const auto& actor : qAsConst(actors))
450 cl.append(actor.name);
452 for (
const auto& name : qAsConst(cl))
454 QString cn = name.trimmed();
457 cast.emplace_back(-1, cn);
461 metadata->SetCast(cast);
467 for (
const auto& str : qAsConst(genres))
469 QString genre_name = str.trimmed();
470 if (!genre_name.isEmpty())
472 video_genres.emplace_back(-1, genre_name);
476 metadata->SetGenres(video_genres);
482 for (
const auto& str : qAsConst(countries))
484 QString country_name = str.trimmed();
485 if (!country_name.isEmpty())
487 video_countries.emplace_back(-1, country_name);
491 metadata->SetCountries(video_countries);
496 if (!coverurl.path().isEmpty())
497 metadata->SetCoverFile(coverurl.path().remove(0,1));
500 if (!fanarturl.path().isEmpty())
501 metadata->SetFanart(fanarturl.path().remove(0,1));
504 if (!bannerurl.path().isEmpty())
505 metadata->SetBanner(bannerurl.path().remove(0,1));
508 if (!sshoturl.path().isEmpty())
509 metadata->SetScreenshot(sshoturl.path().remove(0,1));
511 metadata->SetProcessed(
true);
512 metadata->UpdateDatabase();
516 QCoreApplication::postEvent(parent(),
537 else if (lul.count() == 1)
593 QCoreApplication::postEvent(parent(),
603 QList<int> moves = vsc->m_moved;
604 QList<int> deletions = vsc->m_deleted;
608 LOG(VB_GENERAL, LOG_INFO,
609 QString(
"Video Scan Complete: a(%1) m(%2) d(%3)")
610 .arg(additions.count()).arg(moves.count())
611 .arg(deletions.count()));
615 QCoreApplication::postEvent(parent(),
622 LOG(VB_GENERAL, LOG_INFO,
623 QString(
"Video Scan Complete: a(%1) m(%2) d(%3)")
624 .arg(additions.count()).arg(moves.count())
625 .arg(deletions.count()));
631 for (
int id : qAsConst(additions))
636 Lookup(metadata,
true,
true);
680 int ruleepisode = rule->m_episode;
690 else if (ruleepisode == 0 && pginfo->
GetEpisode() == 0 &&
693 else if (ruleepisode > 0 && pginfo->
GetSubtitle().isEmpty())
754 if (inetref.isEmpty() || inetref ==
"00000000" ||