MythTV  master
metadatafactory.cpp
Go to the documentation of this file.
1 
2 #include "metadatafactory.h"
3 
4 // C++
5 #include <algorithm>
6 #include <unistd.h> // for sleep()
7 
8 // QT
9 #include <QApplication>
10 #include <QList>
11 #include <QUrl>
12 
13 // mythtv
14 #include "libmyth/mythcontext.h"
15 #include "libmythbase/compat.h"
18 #include "libmythbase/remoteutil.h"
20 
21 // libmythmetadata
22 #include "videoutils.h"
23 
24 // Needed to perform a lookup
25 #include "metadatadownload.h"
26 #include "metadataimagedownload.h"
27 
28 // Needed for video scanning
30 #include "globals.h"
31 
32 // Input for a lookup
33 #include "videometadata.h"
34 
35 
36 const QEvent::Type MetadataFactoryNoResult::kEventType =
37  (QEvent::Type) QEvent::registerEventType();
38 
40 {
41  if (m_result)
42  {
43  m_result->DecrRef();
44  m_result = nullptr;
45  }
46 }
47 
48 const QEvent::Type MetadataFactorySingleResult::kEventType =
49  (QEvent::Type) QEvent::registerEventType();
50 
52 {
53  if (m_result)
54  {
55  m_result->DecrRef();
56  m_result = nullptr;
57  }
58 }
59 
60 const QEvent::Type MetadataFactoryMultiResult::kEventType =
61  (QEvent::Type) QEvent::registerEventType();
62 
63 // Force this class to have a vtable so that dynamic_cast works.
64 // NOLINTNEXTLINE(modernize-use-equals-default)
66 {
67 }
68 
69 const QEvent::Type MetadataFactoryVideoChanges::kEventType =
70  (QEvent::Type) QEvent::registerEventType();
71 
72 // Force this class to have a vtable so that dynamic_cast works.
73 // NOLINTNEXTLINE(modernize-use-equals-default)
75 {
76 }
77 
79  QObject(parent)
80 {
81  m_lookupthread = new MetadataDownload(this);
84 
86 }
87 
89 {
90  if (m_lookupthread)
91  {
93  delete m_lookupthread;
94  m_lookupthread = nullptr;
95  }
96 
97  if (m_imagedownload)
98  {
100  delete m_imagedownload;
101  m_imagedownload = nullptr;
102  }
103 
105  delete m_videoscanner;
106 
107  delete m_mlm;
108  m_mlm = nullptr;
109 }
110 
111 void MetadataFactory::Lookup(RecordingRule *recrule, bool automatic,
112  bool getimages, bool allowgeneric)
113 {
114  if (!recrule)
115  return;
116 
117  auto *lookup = new MetadataLookup();
118 
119  lookup->SetStep(kLookupSearch);
120  lookup->SetType(kMetadataRecording);
121  lookup->SetSubtype(GuessLookupType(recrule));
122  lookup->SetData(QVariant::fromValue(recrule));
123  lookup->SetAutomatic(automatic);
124  lookup->SetHandleImages(getimages);
125  lookup->SetAllowGeneric(allowgeneric);
126  lookup->SetHost(gCoreContext->GetMasterHostName());
127  lookup->SetTitle(recrule->m_title);
128  lookup->SetSubtitle(recrule->m_subtitle);
129  lookup->SetInetref(recrule->m_inetref);
130  lookup->SetSeason(recrule->m_season);
131  lookup->SetEpisode(recrule->m_episode);
132 
133  if (m_lookupthread->isRunning())
134  m_lookupthread->prependLookup(lookup);
135  else
136  m_lookupthread->addLookup(lookup);
137 }
138 
139 void MetadataFactory::Lookup(ProgramInfo *pginfo, bool automatic,
140  bool getimages, bool allowgeneric)
141 {
142  if (!pginfo)
143  return;
144 
145  auto *lookup = new MetadataLookup();
146 
147  lookup->SetStep(kLookupSearch);
148  lookup->SetType(kMetadataRecording);
149  lookup->SetSubtype(GuessLookupType(pginfo));
150  lookup->SetData(QVariant::fromValue(pginfo));
151  lookup->SetAutomatic(automatic);
152  lookup->SetHandleImages(getimages);
153  lookup->SetAllowGeneric(allowgeneric);
154  lookup->SetHost(gCoreContext->GetMasterHostName());
155  lookup->SetTitle(pginfo->GetTitle());
156  lookup->SetSubtitle(pginfo->GetSubtitle());
157  lookup->SetSeason(pginfo->GetSeason());
158  lookup->SetEpisode(pginfo->GetEpisode());
159  lookup->SetInetref(pginfo->GetInetRef());
160 
161  if (m_lookupthread->isRunning())
162  m_lookupthread->prependLookup(lookup);
163  else
164  m_lookupthread->addLookup(lookup);
165 }
166 
167 void MetadataFactory::Lookup(VideoMetadata *metadata, bool automatic,
168  bool getimages, bool allowgeneric)
169 {
170  if (!metadata)
171  return;
172 
173  auto *lookup = new MetadataLookup();
174 
175  lookup->SetStep(kLookupSearch);
176  lookup->SetType(kMetadataVideo);
177  lookup->SetSubtype(GuessLookupType(metadata));
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());
184  lookup->SetSubtitle(metadata->GetSubtitle());
185  lookup->SetSeason(metadata->GetSeason());
186  lookup->SetEpisode(metadata->GetEpisode());
187  lookup->SetInetref(metadata->GetInetRef());
188  lookup->SetFilename(generate_file_url("Videos", metadata->GetHost(),
189  metadata->GetFilename()));
190 
191  if (m_lookupthread->isRunning())
192  m_lookupthread->prependLookup(lookup);
193  else
194  m_lookupthread->addLookup(lookup);
195 }
196 
198 {
199  if (!lookup)
200  return;
201 
202  if (m_lookupthread->isRunning())
203  m_lookupthread->prependLookup(lookup);
204  else
205  m_lookupthread->addLookup(lookup);
206 }
207 
209  const QString& subtitle,
210  const QString& inetref,
211  int season,
212  int episode,
213  const QString& grabber,
214  bool allowgeneric)
215 {
216  auto *lookup = new MetadataLookup();
217 
218  lookup->SetStep(kLookupSearch);
219  lookup->SetType(kMetadataRecording);
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")
229  lookup->SetSubtype(kProbableMovie);
230  else if (grabber.toLower() == "tv" ||
231  grabber.toLower() == "television")
232  lookup->SetSubtype(kProbableTelevision);
233  else
234  lookup->SetSubtype(GuessLookupType(lookup));
235 
236  return SynchronousLookup(lookup);
237 }
238 
240 {
241  if (!lookup)
242  return {};
243 
244  m_sync = true;
245 
246  if (m_lookupthread->isRunning())
247  m_lookupthread->prependLookup(lookup);
248  else
249  m_lookupthread->addLookup(lookup);
250 
251  while (m_returnList.isEmpty() && m_sync)
252  {
253  sleep(1);
254  QCoreApplication::processEvents();
255  }
256 
257  m_sync = false;
258 
259  return m_returnList;
260 }
261 
263 {
266 }
267 
269 {
270  if (IsRunning())
271  return;
272 
273  QStringList hosts;
274  if (!RemoteGetActiveBackends(&hosts))
275  {
276  LOG(VB_GENERAL, LOG_WARNING, "Could not retrieve list of "
277  "available backends.");
278  return;
279  }
280 
281  VideoScan(hosts);
282 }
283 
284 void MetadataFactory::VideoScan(const QStringList& hosts)
285 {
286  if (IsRunning())
287  return;
288 
289  m_scanning = true;
290 
291  m_videoscanner->SetHosts(hosts);
294 }
295 
297 {
298  if (list.isEmpty())
299  return;
300 
301  if (parent())
302  QCoreApplication::postEvent(parent(),
303  new MetadataFactoryMultiResult(list));
304 }
305 
307 {
308  if (!lookup)
309  return;
310 
311  if (lookup->GetHandleImages())
312  {
313  DownloadMap map;
314 
315  ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
316  if (!coverartlist.empty())
317  {
318  ArtworkInfo info;
319  info.url = coverartlist.takeFirst().url;
320  map.insert(kArtworkCoverart, info);
321  }
322 
323  ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
324  if (!fanartlist.empty())
325  {
326  ArtworkInfo info;
327  int index = 0;
328  int season = lookup->GetIsCollection() ? 0 : (int)lookup->GetSeason();
329  if (season > 0 && season <= fanartlist.count())
330  index = season - 1;
331  info.url = fanartlist.takeAt(index).url;
332  map.insert(kArtworkFanart, info);
333  }
334 
335  ArtworkList bannerlist = lookup->GetArtwork(kArtworkBanner);
336  if (!bannerlist.empty())
337  {
338  ArtworkInfo info;
339  info.url = bannerlist.takeFirst().url;
340  map.insert(kArtworkBanner, info);
341  }
342 
343  if (lookup->GetType() != kMetadataRecording)
344  {
345  ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
346  if (!screenshotlist.empty())
347  {
348  ArtworkInfo info;
349  info.url = screenshotlist.takeFirst().url;
350  map.insert(kArtworkScreenshot, info);
351  }
352  }
353  lookup->SetDownloads(map);
354  lookup->IncrRef();
355  m_imagedownload->addDownloads(lookup);
356  }
357  else
358  {
359  if (m_scanning)
360  OnVideoResult(lookup);
361  else if (parent())
362  QCoreApplication::postEvent(parent(),
363  new MetadataFactorySingleResult(lookup));
364  }
365 }
366 
368 {
369  if (!lookup)
370  return;
371 
372  if (parent())
373  QCoreApplication::postEvent(parent(),
374  new MetadataFactoryNoResult(lookup));
375 }
376 
378 {
379  if (!lookup)
380  return;
381 
382  if (parent())
383  QCoreApplication::postEvent(parent(),
384  new MetadataFactorySingleResult(lookup));
385 }
386 
388 {
389  if (!lookup)
390  return;
391 
392  auto *metadata = lookup->GetData().value<VideoMetadata *>();
393 
394  if (!metadata)
395  return;
396 
397  metadata->SetTitle(lookup->GetTitle());
398  metadata->SetSubtitle(lookup->GetSubtitle());
399 
400  if (metadata->GetTagline().isEmpty())
401  metadata->SetTagline(lookup->GetTagline());
402  if (metadata->GetYear() == VIDEO_YEAR_DEFAULT || metadata->GetYear() == 0)
403  metadata->SetYear(lookup->GetYear());
404  if (metadata->GetReleaseDate() == QDate())
405  metadata->SetReleaseDate(lookup->GetReleaseDate());
406  if (metadata->GetDirector() == VIDEO_DIRECTOR_UNKNOWN ||
407  metadata->GetDirector().isEmpty())
408  {
409  QList<PersonInfo> director = lookup->GetPeople(kPersonDirector);
410  if (director.count() > 0)
411  metadata->SetDirector(director.takeFirst().name);
412  }
413  if (metadata->GetStudio().isEmpty())
414  {
415  QStringList studios = lookup->GetStudios();
416  if (studios.count() > 0)
417  metadata->SetStudio(studios.takeFirst());
418  }
419  if (metadata->GetPlot() == VIDEO_PLOT_DEFAULT ||
420  metadata->GetPlot().isEmpty())
421  metadata->SetPlot(lookup->GetDescription());
422  if (metadata->GetUserRating() == 0)
423  metadata->SetUserRating(lookup->GetUserRating());
424  if (metadata->GetRating() == VIDEO_RATING_DEFAULT)
425  metadata->SetRating(lookup->GetCertification());
426  if (metadata->GetLength() == 0min)
427  metadata->SetLength(lookup->GetRuntime());
428  if (metadata->GetSeason() == 0)
429  metadata->SetSeason(lookup->GetSeason());
430  if (metadata->GetEpisode() == 0)
431  metadata->SetEpisode(lookup->GetEpisode());
432  if (metadata->GetHomepage().isEmpty())
433  metadata->SetHomepage(lookup->GetHomepage());
434 
435  metadata->SetInetRef(lookup->GetInetref());
436 
437 // m_d->AutomaticParentalAdjustment(metadata);
438 
439  // Cast
440  QList<PersonInfo> actors = lookup->GetPeople(kPersonActor);
441  QList<PersonInfo> gueststars = lookup->GetPeople(kPersonGuestStar);
442 
443  for (const auto& actor : std::as_const(gueststars))
444  actors.append(actor);
445 
447  QStringList cl;
448 
449  for (const auto& actor : std::as_const(actors))
450  cl.append(actor.name);
451 
452  for (const auto& name : std::as_const(cl))
453  {
454  QString cn = name.trimmed();
455  if (!cn.isEmpty())
456  {
457  cast.emplace_back(-1, cn);
458  }
459  }
460 
461  metadata->SetCast(cast);
462 
463  // Genres
464  VideoMetadata::genre_list video_genres;
465  QStringList genres = lookup->GetCategories();
466 
467  for (const auto& str : std::as_const(genres))
468  {
469  QString genre_name = str.trimmed();
470  if (!genre_name.isEmpty())
471  {
472  video_genres.emplace_back(-1, genre_name);
473  }
474  }
475 
476  metadata->SetGenres(video_genres);
477 
478  // Countries
479  VideoMetadata::country_list video_countries;
480  QStringList countries = lookup->GetCountries();
481 
482  for (const auto& str : std::as_const(countries))
483  {
484  QString country_name = str.trimmed();
485  if (!country_name.isEmpty())
486  {
487  video_countries.emplace_back(-1, country_name);
488  }
489  }
490 
491  metadata->SetCountries(video_countries);
492 
493  DownloadMap map = lookup->GetDownloads();
494 
495  QUrl coverurl(map.value(kArtworkCoverart).url);
496  if (!coverurl.path().isEmpty())
497  metadata->SetCoverFile(coverurl.path().remove(0,1));
498 
499  QUrl fanarturl(map.value(kArtworkFanart).url);
500  if (!fanarturl.path().isEmpty())
501  metadata->SetFanart(fanarturl.path().remove(0,1));
502 
503  QUrl bannerurl(map.value(kArtworkBanner).url);
504  if (!bannerurl.path().isEmpty())
505  metadata->SetBanner(bannerurl.path().remove(0,1));
506 
507  QUrl sshoturl(map.value(kArtworkScreenshot).url);
508  if (!sshoturl.path().isEmpty())
509  metadata->SetScreenshot(sshoturl.path().remove(0,1));
510 
511  metadata->SetProcessed(true);
512  metadata->UpdateDatabase();
513 
514  if (gCoreContext->HasGUI() && parent())
515  {
516  QCoreApplication::postEvent(parent(),
517  new MetadataFactorySingleResult(lookup));
518  }
519 }
520 
521 void MetadataFactory::customEvent(QEvent *levent)
522 {
523  if (levent->type() == MetadataLookupEvent::kEventType)
524  {
525  auto *lue = dynamic_cast<MetadataLookupEvent *>(levent);
526  if (lue == nullptr)
527  return;
528 
529  MetadataLookupList lul = lue->m_lookupList;
530  if (lul.isEmpty())
531  return;
532 
533  if (m_sync)
534  {
535  m_returnList = lul;
536  }
537  else if (lul.count() == 1)
538  {
539  OnSingleResult(lul[0]);
540  }
541  else
542  {
543  OnMultiResult(lul);
544  }
545  }
546  else if (levent->type() == MetadataLookupFailure::kEventType)
547  {
548  auto *luf = dynamic_cast<MetadataLookupFailure *>(levent);
549  if (luf == nullptr)
550  return;
551 
552  MetadataLookupList lul = luf->m_lookupList;
553  if (lul.isEmpty())
554  return;
555 
556  if (m_sync)
557  {
559  m_sync = false;
560  }
561  if (!lul.empty())
562  {
563  OnNoResult(lul[0]);
564  }
565  }
566  else if (levent->type() == ImageDLEvent::kEventType)
567  {
568  auto *ide = dynamic_cast<ImageDLEvent *>(levent);
569  if (ide == nullptr)
570  return;
571 
572  MetadataLookup *lookup = ide->m_item;
573  if (!lookup)
574  return;
575 
576  if (m_scanning)
577  OnVideoResult(lookup);
578  else
579  OnImageResult(lookup);
580  }
581  else if (levent->type() == ImageDLFailureEvent::kEventType)
582  {
583  auto *ide = dynamic_cast<ImageDLFailureEvent *>(levent);
584  if (ide == nullptr)
585  return;
586 
587  MetadataLookup *lookup = ide->m_item;
588  if (!lookup)
589  return;
590 
591  // propagate event on image download failure
592  if (parent())
593  QCoreApplication::postEvent(parent(),
594  new ImageDLFailureEvent(lookup));
595  }
596  else if (levent->type() == VideoScanChanges::kEventType)
597  {
598  auto *vsc = dynamic_cast<VideoScanChanges *>(levent);
599  if (!vsc)
600  return;
601 
602  QList<int> additions = vsc->m_additions;
603  QList<int> moves = vsc->m_moved;
604  QList<int> deletions = vsc->m_deleted;
605 
606  if (!m_scanning)
607  {
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()));
612 
613  if (parent())
614  {
615  QCoreApplication::postEvent(parent(),
616  new MetadataFactoryVideoChanges(additions, moves,
617  deletions));
618  }
619  }
620  else
621  {
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()));
626 
629  m_mlm->setList(ml);
630 
631  for (int id : std::as_const(additions))
632  {
633  VideoMetadata *metadata = m_mlm->byID(id).get();
634 
635  if (metadata)
636  Lookup(metadata, true, true);
637  }
638  }
640  }
641 }
642 
643 // These functions exist to determine if we have enough
644 // information to conclusively call something a Show vs. Movie
645 
647 {
648  LookupType ret = GuessLookupType(pginfo->GetInetRef());
649 
650  if (ret != kUnknownVideo)
651  return ret;
652 
653  ProgramInfo::CategoryType catType = pginfo->GetCategoryType();
654  if (catType == ProgramInfo::kCategoryNone)
655  catType = pginfo->QueryCategoryType();
656 
657  if ((!pginfo->GetSubtitle().isEmpty() || pginfo->GetEpisode() > 0) &&
658  (catType == ProgramInfo::kCategorySeries ||
659  catType == ProgramInfo::kCategoryTVShow))
660  ret = kProbableTelevision; // NOLINT(bugprone-branch-clone)
661  else if (catType == ProgramInfo::kCategoryMovie)
662  ret = kProbableMovie;
663  else if (pginfo->GetSeason() > 0 || pginfo->GetEpisode() > 0 ||
664  !pginfo->GetSubtitle().isEmpty())
665  ret = kProbableTelevision;
666  else
667  {
668  // Before committing to something being a movie, we
669  // want to check its rule. If the rule has a season
670  // or episode number, but the recording doesn't,
671  // and the rec doesn't have a subtitle, this is a
672  // generic recording. If neither the rule nor the
673  // recording have an inetref, season, episode, or
674  // subtitle, it's *probably* a movie. If it's some
675  // weird combination of both, we've got to try everything.
676  auto *rule = new RecordingRule();
677  rule->m_recordID = pginfo->GetRecordingRuleID();
678  // Load rule information from the database
679  rule->Load();
680  int ruleepisode = rule->m_episode;
681  RecordingType rulerectype = rule->m_type;
682  delete rule;
683 
684  // If recording rule is periodic, it's probably a TV show.
685  if ((rulerectype == kDailyRecord) ||
686  (rulerectype == kWeeklyRecord))
687  {
688  ret = kProbableTelevision;
689  }
690  else if (ruleepisode == 0 && pginfo->GetEpisode() == 0 &&
691  pginfo->GetSubtitle().isEmpty())
692  ret = kProbableMovie;
693  else if (ruleepisode > 0 && pginfo->GetSubtitle().isEmpty())
695  else
696  ret = kUnknownVideo;
697  }
698 
699  return ret;
700 }
701 
703 {
704  LookupType ret = GuessLookupType(lookup->GetInetref());
705 
706  if (ret != kUnknownVideo)
707  return ret;
708 
709  if (lookup->GetSeason() > 0 || lookup->GetEpisode() > 0 ||
710  !lookup->GetSubtitle().isEmpty())
711  ret = kProbableTelevision;
712  else
713  ret = kProbableMovie;
714 
715  return ret;
716 }
717 
719 {
720  LookupType ret = GuessLookupType(metadata->GetInetRef());
721 
722  if (ret != kUnknownVideo)
723  return ret;
724 
725  if (metadata->GetSeason() > 0 || metadata->GetEpisode() > 0 ||
726  !metadata->GetSubtitle().isEmpty())
727  ret = kProbableTelevision;
728  else
729  ret = kProbableMovie;
730 
731  return ret;
732 }
733 
735 {
736  LookupType ret = GuessLookupType(recrule->m_inetref);
737 
738  if (ret != kUnknownVideo)
739  return ret;
740 
741  if (recrule->m_season > 0 || recrule->m_episode > 0 ||
742  (recrule->m_type == kDailyRecord) ||
743  (recrule->m_type == kWeeklyRecord) ||
744  !recrule->m_subtitle.isEmpty())
745  ret = kProbableTelevision;
746  else
747  ret = kProbableMovie;
748 
749  return ret;
750 }
751 
752 LookupType GuessLookupType(const QString &inetref)
753 {
754  if (inetref.isEmpty() || inetref == "00000000" ||
755  inetref == MetaGrabberScript::CleanedInetref(inetref))
756  {
757  // can't determine subtype from inetref
758  return kUnknownVideo;
759  }
760 
761  // inetref is defined, see if we have a pre-defined grabber
762  MetaGrabberScript grabber =
764 
765  if (!grabber.IsValid())
766  {
767  return kUnknownVideo;
768  }
769 
770  switch (grabber.GetType())
771  {
772  case kGrabberMovie:
773  return kProbableMovie;
774  case kGrabberTelevision:
775  return kProbableTelevision;
776  default:
777  return kUnknownVideo;
778  }
779 }
MetadataFactory::OnSingleResult
void OnSingleResult(MetadataLookup *lookup)
Definition: metadatafactory.cpp:306
MetadataFactory::Lookup
void Lookup(ProgramInfo *pginfo, bool automatic=true, bool getimages=true, bool allowgeneric=false)
Definition: metadatafactory.cpp:139
MetadataFactoryVideoChanges::~MetadataFactoryVideoChanges
~MetadataFactoryVideoChanges() override
Definition: metadatafactory.cpp:74
MetadataFactory::m_mlm
VideoMetadataListManager * m_mlm
Definition: metadatafactory.h:134
generate_file_url
QString generate_file_url(const QString &storage_group, const QString &host, const QString &path)
Definition: videoutils.h:65
VideoMetadata
Definition: videometadata.h:24
MetadataFactory::OnMultiResult
void OnMultiResult(const MetadataLookupList &list)
Definition: metadatafactory.cpp:296
MetaGrabberScript
Definition: metadatagrabber.h:29
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:283
MythCoreContext::GetMasterHostName
QString GetMasterHostName(void)
Definition: mythcorecontext.cpp:807
kGrabberTelevision
@ kGrabberTelevision
Definition: metadatagrabber.h:23
MetadataFactoryNoResult::m_result
MetadataLookup * m_result
Definition: metadatafactory.h:63
ReferenceCounter::DecrRef
virtual int DecrRef(void)
Decrements reference count and deletes on 0.
Definition: referencecounter.cpp:125
RecordingRule::m_inetref
QString m_inetref
Definition: recordingrule.h:87
MetadataImageDownload
Definition: metadataimagedownload.h:87
kMetadataRecording
@ kMetadataRecording
Definition: metadatacommon.h:44
videometadata.h
VideoMetadata::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:1832
MetadataLookup::GetTitle
QString GetTitle() const
Definition: metadatacommon.h:299
VideoMetadataListManager
Definition: videometadatalistmanager.h:10
kDailyRecord
@ kDailyRecord
Definition: recordingtypes.h:24
kMetadataVideo
@ kMetadataVideo
Definition: metadatacommon.h:43
MThread::wait
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:300
MetadataFactory::customEvent
void customEvent(QEvent *levent) override
Definition: metadatafactory.cpp:521
MetadataFactory::m_sync
bool m_sync
Definition: metadatafactory.h:139
MetadataImageDownload::cancel
void cancel()
Definition: metadataimagedownload.cpp:64
ArtworkList
QList< ArtworkInfo > ArtworkList
Definition: metadataimagehelper.h:30
MetadataFactory::m_scanning
bool m_scanning
Definition: metadatafactory.h:135
MetadataDownload::prependLookup
void prependLookup(MetadataLookup *lookup)
prependLookup: Add lookup to top of the queue MetadataDownload::m_lookupList takes ownership of the g...
Definition: metadatadownload.cpp:54
kProbableTelevision
@ kProbableTelevision
Definition: metadatacommon.h:51
RecordingRule::m_title
QString m_title
Definition: recordingrule.h:77
VideoMetadata::country_list
std::vector< country_entry > country_list
Definition: videometadata.h:33
RecordingRule
Internal representation of a recording rule, mirrors the record table.
Definition: recordingrule.h:28
MetadataFactory::SynchronousLookup
MetadataLookupList SynchronousLookup(const QString &title, const QString &subtitle, const QString &inetref, int season, int episode, const QString &grabber, bool allowgeneric=false)
Definition: metadatafactory.cpp:208
GuessLookupType
LookupType GuessLookupType(ProgramInfo *pginfo)
Definition: metadatafactory.cpp:646
ImageDLEvent
Definition: metadataimagedownload.h:18
MetadataDownload
Definition: metadatadownload.h:35
MetadataLookup::GetArtwork
ArtworkList GetArtwork(VideoArtworkType type) const
Definition: metadatacommon.cpp:331
MetaGrabberScript::IsValid
bool IsValid(void) const
Definition: metadatagrabber.h:55
VideoMetadata::GetSeason
int GetSeason() const
Definition: videometadata.cpp:1702
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
VideoMetadata::genre_list
std::vector< genre_entry > genre_list
Definition: videometadata.h:32
MetadataLookup::GetCertification
QString GetCertification() const
Definition: metadatacommon.h:335
VideoMetadataListManager::setList
void setList(metadata_list &list)
Definition: videometadatalistmanager.cpp:162
MetadataFactorySingleResult::~MetadataFactorySingleResult
~MetadataFactorySingleResult() override
Definition: metadatafactory.cpp:51
MetadataLookup::SetDownloads
void SetDownloads(DownloadMap map)
Definition: metadatacommon.h:253
RecordingRule::m_season
uint m_season
Definition: recordingrule.h:94
remoteutil.h
MetadataFactoryVideoChanges::kEventType
static const Type kEventType
Definition: metadatafactory.h:82
VideoScannerThread::ResetCounts
void ResetCounts()
Definition: videoscan.h:75
kPersonGuestStar
@ kPersonGuestStar
Definition: metadatacommon.h:81
MetadataFactoryNoResult
Definition: metadatafactory.h:50
VideoMetadata::GetSubtitle
const QString & GetSubtitle() const
Definition: videometadata.cpp:1557
kLookupSearch
@ kLookupSearch
Definition: metadatacommon.h:28
kGrabberMovie
@ kGrabberMovie
Definition: metadatagrabber.h:22
MetadataLookup
Definition: metadatacommon.h:87
ProgramInfo::kCategoryMovie
@ kCategoryMovie
Definition: programinfo.h:76
VideoMetadataListManager::loadAllFromDatabase
static void loadAllFromDatabase(metadata_list &items, const QString &sql="", const QString &bindValue="")
Load videometadata database into memory.
Definition: videometadatalistmanager.cpp:128
MetadataFactoryNoResult::~MetadataFactoryNoResult
~MetadataFactoryNoResult() override
Definition: metadatafactory.cpp:39
ProgramInfo::GetInetRef
QString GetInetRef(void) const
Definition: programinfo.h:437
MetadataFactoryNoResult::kEventType
static const Type kEventType
Definition: metadatafactory.h:65
VideoScannerThread
Definition: videoscan.h:60
MetaGrabberScript::CleanedInetref
static QString CleanedInetref(const QString &inetref)
Definition: metadatagrabber.cpp:265
MetadataLookup::GetDownloads
DownloadMap GetDownloads() const
Definition: metadatacommon.h:372
RecordingRule::m_episode
uint m_episode
Definition: recordingrule.h:95
VideoMetadata::GetFilename
const QString & GetFilename() const
Definition: videometadata.cpp:1812
VideoMetadata::GetInetRef
const QString & GetInetRef() const
Definition: videometadata.cpp:1602
programinfo.h
ProgramInfo::kCategoryTVShow
@ kCategoryTVShow
Definition: programinfo.h:77
mythlogging.h
MetadataLookup::GetEpisode
uint GetEpisode() const
Definition: metadatacommon.h:315
MetadataLookup::GetDescription
QString GetDescription() const
Definition: metadatacommon.h:312
kPersonActor
@ kPersonActor
Definition: metadatacommon.h:70
GetVideoDirs
QStringList GetVideoDirs()
Definition: videoutils.cpp:116
MetadataLookupFailure
Definition: metadatadownload.h:23
metadatadownload.h
ArtworkInfo
Definition: metadataimagehelper.h:21
metadataimagedownload.h
ImageDLFailureEvent
Definition: metadataimagedownload.h:44
globals.h
RefCountedList< MetadataLookup >
MetadataLookup::GetData
QVariant GetData() const
Definition: metadatacommon.h:288
ImageDLFailureEvent::kEventType
static const Type kEventType
Definition: metadataimagedownload.h:67
MetaGrabberScript::GetType
static MetaGrabberScript GetType(const QString &type)
Definition: metadatagrabber.cpp:173
ProgramInfo::GetTitle
QString GetTitle(void) const
Definition: programinfo.h:361
compat.h
VideoScannerThread::SetDirs
void SetDirs(QStringList dirs)
Definition: videoscan.cpp:98
MetadataFactoryVideoChanges
Definition: metadatafactory.h:68
kPersonDirector
@ kPersonDirector
Definition: metadatacommon.h:72
MetadataLookup::GetType
MetadataType GetType() const
Definition: metadatacommon.h:286
VIDEO_PLOT_DEFAULT
const QString VIDEO_PLOT_DEFAULT
Definition: globals.cpp:32
kArtworkFanart
@ kArtworkFanart
Definition: metadataimagehelper.h:12
MetadataLookup::GetSubtitle
QString GetSubtitle() const
Definition: metadatacommon.h:310
RecordingRule::m_type
RecordingType m_type
Definition: recordingrule.h:111
ImageDLEvent::kEventType
static const Type kEventType
Definition: metadataimagedownload.h:41
MetadataFactory::IsRunning
bool IsRunning()
Definition: metadatafactory.h:113
RecordingRule::m_subtitle
QString m_subtitle
Definition: recordingrule.h:79
MetadataFactory::VideoScan
void VideoScan()
Definition: metadatafactory.cpp:268
MetadataLookup::GetCountries
QStringList GetCountries() const
Definition: metadatacommon.h:336
VideoScanChanges::kEventType
static const Type kEventType
Definition: videoscan.h:57
MetadataFactoryMultiResult::~MetadataFactoryMultiResult
~MetadataFactoryMultiResult() override
Definition: metadatafactory.cpp:65
MetadataFactoryMultiResult::kEventType
static const Type kEventType
Definition: metadatafactory.h:29
ProgramInfo::QueryCategoryType
CategoryType QueryCategoryType(void) const
Queries recordedprogram to get the category_type of the recording.
Definition: programinfo.cpp:3028
MetadataLookup::GetPeople
QList< PersonInfo > GetPeople(PeopleType type) const
Definition: metadatacommon.cpp:315
MetadataDownload::addLookup
void addLookup(MetadataLookup *lookup)
addLookup: Add lookup to bottom of the queue MetadataDownload::m_lookupList takes ownership of the gi...
Definition: metadatadownload.cpp:39
MetadataLookup::GetYear
uint GetYear() const
Definition: metadatacommon.h:349
MetadataLookup::GetHandleImages
bool GetHandleImages() const
Definition: metadatacommon.h:293
MetadataLookup::GetUserRating
float GetUserRating() const
Definition: metadatacommon.h:302
VideoMetadata::GetEpisode
int GetEpisode() const
Definition: videometadata.cpp:1712
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
kProbableGenericTelevision
@ kProbableGenericTelevision
Definition: metadatacommon.h:52
MetadataFactoryMultiResult
Definition: metadatafactory.h:20
ProgramInfo::CategoryType
CategoryType
Definition: programinfo.h:76
videometadatalistmanager.h
MetadataLookupFailure::kEventType
static const Type kEventType
Definition: metadatadownload.h:32
MetadataLookup::GetSeason
uint GetSeason() const
Definition: metadatacommon.h:314
kUnknownVideo
@ kUnknownVideo
Definition: metadatacommon.h:54
MetadataFactory::VideoGrabbersFunctional
static bool VideoGrabbersFunctional()
Definition: metadatafactory.cpp:262
MetadataFactory::OnVideoResult
void OnVideoResult(MetadataLookup *lookup)
Definition: metadatafactory.cpp:387
MetadataLookup::GetCategories
QStringList GetCategories() const
Definition: metadatacommon.h:301
MetadataFactory::m_imagedownload
MetadataImageDownload * m_imagedownload
Definition: metadatafactory.h:131
kWeeklyRecord
@ kWeeklyRecord
Definition: recordingtypes.h:27
MetadataFactory::m_returnList
MetadataLookupList m_returnList
Definition: metadatafactory.h:138
MetadataLookup::GetRuntime
std::chrono::minutes GetRuntime() const
Definition: metadatacommon.h:352
ProgramInfo::GetEpisode
uint GetEpisode(void) const
Definition: programinfo.h:367
MetadataFactorySingleResult
Definition: metadatafactory.h:32
MetaGrabberScript::FromInetref
static MetaGrabberScript FromInetref(const QString &inetref, bool absolute=false)
Definition: metadatagrabber.cpp:244
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
MetadataFactory::m_videoscanner
VideoScannerThread * m_videoscanner
Definition: metadatafactory.h:133
MetadataFactorySingleResult::kEventType
static const Type kEventType
Definition: metadatafactory.h:47
MetadataDownload::MovieGrabberWorks
static bool MovieGrabberWorks()
Definition: metadatadownload.cpp:436
MetadataFactory::~MetadataFactory
~MetadataFactory() override
Definition: metadatafactory.cpp:88
ProgramInfo::GetSeason
uint GetSeason(void) const
Definition: programinfo.h:366
MetadataLookup::GetTagline
QString GetTagline() const
Definition: metadatacommon.h:311
VideoMetadata::cast_list
std::vector< cast_entry > cast_list
Definition: videometadata.h:34
MetadataLookup::GetInetref
QString GetInetref() const
Definition: metadatacommon.h:356
VIDEO_RATING_DEFAULT
const QString VIDEO_RATING_DEFAULT
Definition: globals.cpp:30
MetadataLookup::GetStudios
QStringList GetStudios() const
Definition: metadatacommon.h:364
MetadataFactory::OnImageResult
void OnImageResult(MetadataLookup *lookup)
Definition: metadatafactory.cpp:377
VideoMetadata::SetTitle
void SetTitle(const QString &title, const QString &sortTitle="")
Definition: videometadata.cpp:1552
LookupType
LookupType
Definition: metadatacommon.h:50
MetadataFactory::m_lookupthread
MetadataDownload * m_lookupthread
Definition: metadatafactory.h:130
mythcontext.h
metadatafactory.h
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:263
kArtworkBanner
@ kArtworkBanner
Definition: metadataimagehelper.h:13
VideoScanChanges
Definition: videoscan.h:44
VideoMetadata::GetTitle
const QString & GetTitle() const
Definition: videometadata.cpp:1542
VideoMetadataListManager::metadata_list
std::list< VideoMetadataPtr > metadata_list
Definition: videometadatalistmanager.h:14
DownloadMap
QMap< VideoArtworkType, ArtworkInfo > DownloadMap
Definition: metadatacommon.h:84
ProgramInfo::kCategoryNone
@ kCategoryNone
Definition: programinfo.h:76
MetadataLookup::GetIsCollection
bool GetIsCollection() const
Definition: metadatacommon.h:360
MetadataLookupEvent::kEventType
static const Type kEventType
Definition: metadatadownload.h:20
MetadataLookup::GetReleaseDate
QDate GetReleaseDate() const
Definition: metadatacommon.h:350
ProgramInfo::kCategorySeries
@ kCategorySeries
Definition: programinfo.h:76
MythCoreContext::HasGUI
bool HasGUI(void) const
Definition: mythcorecontext.cpp:1738
VIDEO_YEAR_DEFAULT
static constexpr uint16_t VIDEO_YEAR_DEFAULT
Definition: videometadata.h:18
VideoScannerThread::SetHosts
void SetHosts(const QStringList &hosts)
Definition: videoscan.cpp:91
kArtworkScreenshot
@ kArtworkScreenshot
Definition: metadataimagehelper.h:14
ProgramInfo::GetRecordingRuleID
uint GetRecordingRuleID(void) const
Definition: programinfo.h:449
MetadataLookup::GetHomepage
QString GetHomepage() const
Definition: metadatacommon.h:367
recordingrule.h
MetadataFactorySingleResult::m_result
MetadataLookup * m_result
Definition: metadatafactory.h:45
ReferenceCounter::IncrRef
virtual int IncrRef(void)
Increments reference count.
Definition: referencecounter.cpp:101
kProbableMovie
@ kProbableMovie
Definition: metadatacommon.h:53
ProgramInfo::GetCategoryType
CategoryType GetCategoryType(void) const
Definition: programinfo.h:438
MetadataLookupEvent
Definition: metadatadownload.h:11
META_PUBLIC
#define META_PUBLIC
Definition: mythmetaexp.h:9
RecordingType
RecordingType
Definition: recordingtypes.h:20
kArtworkCoverart
@ kArtworkCoverart
Definition: metadataimagehelper.h:11
MetadataFactory::MetadataFactory
MetadataFactory(QObject *parent)
Definition: metadatafactory.cpp:78
MetadataDownload::TelevisionGrabberWorks
static bool TelevisionGrabberWorks()
Definition: metadatadownload.cpp:448
videoutils.h
RemoteGetActiveBackends
bool RemoteGetActiveBackends(QStringList *list)
return list of backends currently connected to the master
Definition: remoteutil.cpp:572
MetadataLookupList
RefCountedList< MetadataLookup > MetadataLookupList
Definition: metadatacommon.h:462
VideoScanChanges::m_additions
QList< int > m_additions
Definition: videoscan.h:53
simple_ref_ptr::get
T * get() const
Definition: quicksp.h:73
ArtworkInfo::url
QString url
Definition: metadataimagehelper.h:25
MetadataDownload::cancel
void cancel()
Definition: metadatadownload.cpp:65
MetadataFactory::OnNoResult
void OnNoResult(MetadataLookup *lookup)
Definition: metadatafactory.cpp:367
MetadataImageDownload::addDownloads
void addDownloads(MetadataLookup *lookup)
addLookup: Add lookup to bottom of the queue MetadataDownload::m_downloadList takes ownership of the ...
Definition: metadataimagedownload.cpp:54
ProgramInfo::GetSubtitle
QString GetSubtitle(void) const
Definition: programinfo.h:363
VideoMetadataListManager::byID
VideoMetadataPtr byID(unsigned int db_id) const
Definition: videometadatalistmanager.cpp:180
VIDEO_DIRECTOR_UNKNOWN
const QString VIDEO_DIRECTOR_UNKNOWN
Definition: globals.cpp:9