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