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