MythTV  master
videometadata.cpp
Go to the documentation of this file.
1 #include <cmath> // for isnan()
2 
3 #include <QDir>
4 #include <QFile>
5 #include <QFileInfo>
6 #include <QRegularExpression>
7 
8 #include "mythcorecontext.h"
9 #include "mythmiscutil.h"
10 #include "mythcontext.h"
11 #include "mythdb.h"
12 #include "storagegroup.h"
13 #include "remotefile.h"
14 #include "remoteutil.h"
15 #include "mythdate.h"
16 #include "mythlogging.h"
17 #include "globals.h"
18 #include "dbaccess.h"
20 #include "videoutils.h"
21 #include "programinfo.h" // for format_season_and_episode
22 #include "mythsorthelper.h"
23 
24 #if QT_VERSION < QT_VERSION_CHECK(5,15,2)
25 #define capturedView capturedRef
26 #endif
27 
29 {
30  public:
34 
35  public:
36  VideoMetadataImp(QString filename, QString sortFilename,
37  QString hash, QString trailer,
38  QString coverfile, QString screenshot, QString banner,
39  QString fanart, const QString &title, QString sortTitle,
40  const QString &subtitle, QString sortSubtitle,
41  QString tagline, int year, const QDate releasedate,
42  QString inetref, int collectionref, QString homepage,
43  QString director, QString studio,
44  QString plot, float userrating,
45  QString rating, int length, int playcount,
46  int season, int episode, const QDate insertdate,
47  int id, ParentalLevel::Level showlevel, int categoryID,
48  int childID, bool browse, bool watched,
49  QString playcommand, QString category,
50  genre_list genres,
51  country_list countries,
52  cast_list cast,
53  QString host = "",
54  bool processed = false,
55  VideoContentType contenttype = kContentUnknown) :
56  m_title(title), m_sortTitle(std::move(sortTitle)), m_subtitle(subtitle),
57  m_sortSubtitle(std::move(sortSubtitle)), m_tagline(std::move(tagline)),
58  m_inetref(std::move(inetref)), m_collectionref(collectionref),
59  m_homepage(std::move(homepage)), m_director(std::move(director)),
60  m_studio(std::move(studio)), m_plot(std::move(plot)),
61  m_rating(std::move(rating)), m_playcommand(std::move(playcommand)),
62  m_category(std::move(category)), m_genres(std::move(genres)),
63  m_countries(std::move(countries)), m_cast(std::move(cast)),
64  m_filename(std::move(filename)), m_sortFilename(std::move(sortFilename)),
65  m_hash(std::move(hash)), m_trailer(std::move(trailer)),
66  m_coverfile(std::move(coverfile)), m_screenshot(std::move(screenshot)),
67  m_banner(std::move(banner)), m_fanart(std::move(fanart)),
68  m_host(std::move(host)), m_categoryID(categoryID), m_childID(childID),
69  m_year(year), m_releasedate(releasedate), m_length(length), m_playcount(playcount),
70  m_season(season), m_episode(episode), m_insertdate(insertdate), m_showlevel(showlevel),
71  m_browse(browse), m_watched(watched), m_id(id),
72  m_userrating(userrating), m_processed(processed),
73  m_contenttype(contenttype)
74  {
75  // Try to glean data if none provided.
76  if (title.isEmpty() and subtitle.isEmpty()
77  and season == 0 and episode == 0)
78  {
83  }
84 
86 
88  }
89 
90  explicit VideoMetadataImp(MSqlQuery &query)
91  {
92  fromDBRow(query);
94  }
95 
97  {
98  *this = other;
99  }
100 
102  {
103  if (this != &rhs)
104  {
105  m_title = rhs.m_title;
106  m_sortTitle = rhs.m_sortTitle;
107  m_subtitle = rhs.m_subtitle;
109  m_tagline = rhs.m_tagline;
110  m_inetref = rhs.m_inetref;
112  m_homepage = rhs.m_homepage;
113  m_director = rhs.m_director;
114  m_studio = rhs.m_studio;
115  m_plot = rhs.m_plot;
116  m_rating = rhs.m_rating;
118  m_category = rhs.m_category;
119  m_genres = rhs.m_genres;
120  m_countries = rhs.m_countries;
121  m_cast = rhs.m_cast;
122  m_filename = rhs.m_filename;
124  m_hash = rhs.m_hash;
125  m_trailer = rhs.m_trailer;
126  m_coverfile = rhs.m_coverfile;
128  m_banner = rhs.m_banner;
129  m_fanart = rhs.m_fanart;
130 
132  m_childID = rhs.m_childID;
133  m_year = rhs.m_year;
135  m_length = rhs.m_length;
136  m_playcount = rhs.m_playcount;
137  m_season = rhs.m_season;
138  m_episode = rhs.m_episode;
140  m_showlevel = rhs.m_showlevel;
141  m_browse = rhs.m_browse;
142  m_watched = rhs.m_watched;
143  m_id = rhs.m_id;
145  m_host = rhs.m_host;
146  m_processed = rhs.m_processed;
148 
149  // No DB vars
150  m_prefix = rhs.m_prefix;
151 
153  }
154 
155  return *this;
156  }
157 
158  void ensureSortFields(void)
159  {
160  std::shared_ptr<MythSortHelper>sh = getMythSortHelper();
161  if (m_sortTitle.isEmpty() and not m_title.isEmpty())
162  m_sortTitle = sh->doTitle(m_title);
163  if (m_sortSubtitle.isEmpty() and not m_subtitle.isEmpty())
164  m_sortSubtitle = sh->doTitle(m_subtitle);
165  if (m_sortFilename.isEmpty() and not m_filename.isEmpty())
166  m_sortFilename = sh->doPathname(m_filename);
167  }
168 
169  public:
170  const QString &GetPrefix() const { return m_prefix; }
171  void SetPrefix(const QString &prefix) { m_prefix = prefix; }
172 
173  const QString &getTitle() const { return m_title; }
174  const QString &getSortTitle() const { return m_sortTitle; }
175  void SetTitle(const QString& title, const QString& sortTitle = "")
176  {
177  m_title = title;
178  m_sortTitle = sortTitle;
180  }
181 
182  const QString &getSubtitle() const { return m_subtitle; }
183  const QString &getSortSubtitle() const { return m_sortSubtitle; }
184  void SetSubtitle(const QString &subtitle, const QString &sortSubtitle = "") {
185  m_subtitle = subtitle;
186  m_sortSubtitle = sortSubtitle;
188  }
189 
190  const QString &GetTagline() const { return m_tagline; }
191  void SetTagline(const QString &tagline) { m_tagline = tagline; }
192 
193  const QString &GetInetRef() const { return m_inetref; }
194  void SetInetRef(const QString &inetRef) { m_inetref = inetRef; }
195 
196  int GetCollectionRef() const { return m_collectionref; }
197  void SetCollectionRef(int collectionref) { m_collectionref = collectionref; }
198 
199  const QString &GetHomepage() const { return m_homepage; }
200  void SetHomepage(const QString &homepage) { m_homepage = homepage; }
201 
202  const QString &getDirector() const { return m_director; }
203  void SetDirector(const QString &director) { m_director = director; }
204 
205  const QString &getStudio() const { return m_studio; }
206  void SetStudio(const QString &studio) { m_studio = studio; }
207 
208  const QString &getPlot() const { return m_plot; }
209  void SetPlot(const QString &plot) { m_plot = plot; }
210 
211  const QString &GetRating() const { return m_rating; }
212  void SetRating(const QString &rating) { m_rating = rating; }
213 
214  const QString &getPlayCommand() const { return m_playcommand; }
215  void SetPlayCommand(const QString &playCommand)
216  {
217  m_playcommand = playCommand;
218  }
219 
220  const QString &GetCategory() const { return m_category; }
221 // void SetCategory(const QString &category) { m_category = category; }
222 
223  const genre_list &getGenres() const { return m_genres; }
224  void SetGenres(const genre_list &genres) { m_genres = genres; }
225 
226  const country_list &GetCountries() const { return m_countries; }
227  void SetCountries(const country_list &countries)
228  {
229  m_countries = countries;
230  }
231 
232  const cast_list &GetCast() const { return m_cast; }
233  void SetCast(const cast_list &cast) { m_cast = cast; }
234 
235  const QString &GetHost() const { return m_host; }
236  void SetHost(const QString &host) { m_host = host; }
237 
238  const QString &getFilename() const { return m_filename; }
239  const QString &getSortFilename() const { return m_sortFilename; }
240  void SetFilename(const QString &filename, const QString &sortFilename = "")
241  {
243  m_sortFilename = sortFilename;
245  }
246 
247  bool sortBefore(const VideoMetadataImp *rhs) const;
248 
249  const QString &GetHash() const { return m_hash; }
250  void SetHash(const QString &hash) { m_hash = hash; }
251 
252  const QString &GetTrailer() const { return m_trailer; }
253  void SetTrailer(const QString &trailer) { m_trailer = trailer; }
254 
255  const QString &GetCoverFile() const { return m_coverfile; }
256  void SetCoverFile(const QString &coverFile) { m_coverfile = coverFile; }
257 
258  const QString &GetScreenshot() const { return m_screenshot; }
259  void SetScreenshot(const QString &screenshot) { m_screenshot = screenshot; }
260 
261  const QString &GetBanner() const { return m_banner; }
262  void SetBanner(const QString &banner) { m_banner = banner; }
263 
264  const QString &GetFanart() const { return m_fanart; }
265  void SetFanart(const QString &fanart) { m_fanart = fanart; }
266 
267  int GetCategoryID() const
268  {
269  return m_categoryID;
270  }
271  void SetCategoryID(int id);
272 
273  int GetChildID() const { return m_childID; }
274  void SetChildID(int childID) { m_childID = childID; }
275 
276  int getYear() const { return m_year; }
277  void SetYear(int year) { m_year = year; }
278 
279  QDate getReleaseDate() const { return m_releasedate; }
280  void SetReleaseDate(QDate releasedate) { m_releasedate = releasedate; }
281 
282  std::chrono::minutes GetLength() const { return m_length; }
283  void SetLength(std::chrono::minutes length) { m_length = length; }
284 
285  unsigned int GetPlayCount() const { return m_playcount; }
286  void SetPlayCount(int playcount) { m_playcount = playcount; }
287 
288  int GetSeason() const { return m_season; }
289  void SetSeason(int season) { m_season = season; }
290 
291  int GetEpisode() const { return m_episode; }
292  void SetEpisode(int episode) { m_episode = episode; }
293 
294  QDate GetInsertdate() const { return m_insertdate;}
295  void SetInsertdate(QDate date) { m_insertdate = date;}
296 
299  {
300  m_showlevel = ParentalLevel(showLevel).GetLevel();
301  }
302 
303  bool GetBrowse() const { return m_browse; }
304  void SetBrowse(bool browse) { m_browse = browse; }
305 
306  bool GetWatched() const { return m_watched; }
307  void SetWatched(bool watched) { m_watched = watched; }
308 
309  unsigned int GetID() const { return m_id; }
310  void SetID(int id) { m_id = id; }
311 
312  float GetUserRating() const { return m_userrating; }
313  void SetUserRating(float userRating) { m_userrating = userRating; }
314 
315  bool GetProcessed() const { return m_processed; }
316  void SetProcessed(bool processed) { m_processed = processed; }
317 
319  void SetContentType(VideoContentType contenttype) { m_contenttype = contenttype; }
320 
322 
323  void SaveToDatabase();
324  void UpdateDatabase();
325  bool DeleteFromDatabase();
326 
327  bool DeleteFile();
328 
329  void Reset();
330 
331  bool IsHostSet() const;
332 
333  void GetImageMap(InfoMap &imageMap) const;
334 
335  private:
336  void fillCountries();
337  void updateCountries();
338  void fillGenres();
339  void fillCast();
340  void updateGenres();
341  void updateCast();
342  bool removeDir(const QString &dirName);
343  void fromDBRow(MSqlQuery &query);
344  void saveToDatabase();
345 
346  private:
347  QString m_title;
348  QString m_sortTitle;
349  QString m_subtitle;
350  QString m_sortSubtitle;
351  QString m_tagline;
352  QString m_inetref;
354  QString m_homepage;
355  QString m_director;
356  QString m_studio;
357  QString m_plot;
358  QString m_rating;
359  QString m_playcommand;
360  QString m_category;
364  QString m_filename;
365  QString m_sortFilename;
366  QString m_hash;
367  QString m_trailer;
368  QString m_coverfile;
369  QString m_screenshot;
370  QString m_banner;
371  QString m_fanart;
372  QString m_host;
373 
374  int m_categoryID {0};
375  int m_childID {-1};
378  std::chrono::minutes m_length {0min};
379  int m_playcount {0};
380  int m_season {0};
381  int m_episode {0};
384  bool m_browse {true};
385  bool m_watched {false};
386  unsigned int m_id {0}; // videometadata.intid
387  float m_userrating {0.0};
388  bool m_processed {false};
390 
391  // not in DB
392  QString m_prefix;
393 };
394 
398 
402 {
403  int ret = naturalCompare(m_sortTitle, rhs->m_sortTitle);
404  if (ret != 0)
405  return (ret == -1);
407  if (ret != 0)
408  return (ret == -1);
409  return (m_id < rhs->m_id);
410 }
411 
412 bool VideoMetadataImp::removeDir(const QString &dirName)
413 {
414  QDir d(dirName);
415 
416  d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
417  QFileInfoList contents = d.entryInfoList();
418  if (contents.empty())
419  {
420  return d.rmdir(dirName);
421  }
422 
423  for (const auto& entry : qAsConst(contents))
424  {
425  if (entry.isDir())
426  {
427  QString fileName = entry.fileName();
428  if (!removeDir(fileName))
429  return false;
430  }
431  else
432  {
433  if (!QFile(entry.fileName()).remove())
434  return false;
435  }
436  }
437  return d.rmdir(dirName);
438 }
439 
442 {
443  bool isremoved = false;
444 
445  if (!m_host.isEmpty())
446  {
447  QString url = generate_file_url("Videos", m_host, m_filename);
448  isremoved = RemoteFile::DeleteFile(url);
449  }
450  else
451  {
452  QFileInfo fi(m_filename);
453  if (fi.isDir())
454  {
455  isremoved = removeDir(m_filename);
456  }
457  else
458  {
459  isremoved = QFile::remove(m_filename);
460  }
461  }
462 
463  if (!isremoved)
464  {
465  LOG(VB_GENERAL, LOG_DEBUG, QString("Could not delete file: %1")
466  .arg(m_filename));
467  }
468 
469  return isremoved;
470 }
471 
473 {
474  VideoMetadataImp tmp(m_filename, QString(),
477  VIDEO_FANART_DEFAULT, QString(), QString(), QString(), QString(),
478  QString(), VIDEO_YEAR_DEFAULT,
479  QDate(), VIDEO_INETREF_DEFAULT, -1, QString(), VIDEO_DIRECTOR_DEFAULT,
480  QString(), VIDEO_PLOT_DEFAULT, 0.0,
481  VIDEO_RATING_DEFAULT, 0, 0,
482  0, 0, QDate(), m_id,
483  ParentalLevel::plLowest, 0, -1, true, false, "", "",
485  VideoMetadata::cast_list(), m_host, false);
486  tmp.m_prefix = m_prefix;
487 
488  *this = tmp;
489 }
490 
492 {
493  return !m_host.isEmpty();
494 }
495 
497 {
498  m_genres.clear();
500  VideoGenreMap::entry genres;
501  if (vgm.get(m_id, genres))
502  {
504  for (long value : genres.values)
505  {
506  // Just add empty string for no-name genres
507  QString name;
508  vg.get(value, name);
509  m_genres.push_back(genre_list::value_type(value, name));
510  }
511  }
512 }
513 
515 {
516  m_countries.clear();
518  VideoCountryMap::entry countries;
519  if (vcm.get(m_id, countries))
520  {
522  for (long value : countries.values)
523  {
524  // Just add empty string for no-name countries
525  QString name;
526  vc.get(value, name);
527  m_countries.push_back(country_list::value_type(value, name));
528  }
529  }
530 }
531 
533 {
534  m_cast.clear();
536  VideoCastMap::entry cast;
537  if (vcm.get(m_id, cast))
538  {
540  for (long value : cast.values)
541  {
542  // Just add empty string for no-name cast
543  QString name;
544  vc.get(value, name);
545  m_cast.push_back(cast_list::value_type(value, name));
546  }
547  }
548 }
549 
555 {
556  m_title = query.value(0).toString();
557  m_director = query.value(1).toString();
558  m_studio = query.value(2).toString();
559  m_plot = query.value(3).toString();
560  m_rating = query.value(4).toString();
561  m_year = query.value(5).toInt();
562  m_releasedate = query.value(6).toDate();
563  m_userrating = (float)query.value(7).toDouble();
564  if (std::isnan(m_userrating) || m_userrating < 0)
565  m_userrating = 0.0;
566  if (m_userrating > 10.0F)
567  m_userrating = 10.0F;
568  m_length = std::chrono::minutes(query.value(8).toInt());
569  m_playcount = query.value(9).toInt();
570  m_filename = query.value(10).toString();
571  m_hash = query.value(11).toString();
572  m_showlevel = ParentalLevel(query.value(12).toInt()).GetLevel();
573  m_coverfile = query.value(13).toString();
574  m_inetref = query.value(14).toString();
575  m_collectionref = query.value(15).toUInt();
576  m_homepage = query.value(16).toString();
577  m_childID = query.value(17).toUInt();
578  m_browse = query.value(18).toBool();
579  m_watched = query.value(19).toBool();
580  m_playcommand = query.value(20).toString();
581  m_categoryID = query.value(21).toInt();
582  m_id = query.value(22).toInt();
583  m_trailer = query.value(23).toString();
584  m_screenshot = query.value(24).toString();
585  m_banner = query.value(25).toString();
586  m_fanart = query.value(26).toString();
587  m_subtitle = query.value(27).toString();
588  m_tagline = query.value(28).toString();
589  m_season = query.value(29).toInt();
590  m_episode = query.value(30).toInt();
591  m_host = query.value(31).toString();
592  m_insertdate = query.value(32).toDate();
593  m_processed = query.value(33).toBool();
594 
595  m_contenttype = ContentTypeFromString(query.value(34).toString());
596 
598 
600 
601  // Genres
602  fillGenres();
603 
604  //Countries
605  fillCountries();
606 
607  // Cast
608  fillCast();
609 }
610 
612 {
613  if (m_title.isEmpty())
615  if (m_hash.isEmpty())
617  if (m_subtitle.isEmpty())
619  if (m_director.isEmpty())
621  if (m_plot.isEmpty())
623  if (m_rating.isEmpty())
626 
627  InfoMap metadataMap;
628  GetImageMap(metadataMap);
629  QString coverfile = metadataMap["coverfile"];
630  QString screenshot = metadataMap["screenshotfile"];
631  QString bannerfile = metadataMap["bannerfile"];
632  QString fanartfile = metadataMap["fanartfile"];
633 
634  if (coverfile.isEmpty() || !RemoteFile::Exists(coverfile))
636  if (screenshot.isEmpty() || !RemoteFile::Exists(screenshot))
638  if (bannerfile.isEmpty() || !RemoteFile::Exists(bannerfile))
640  if (fanartfile.isEmpty() || !RemoteFile::Exists(fanartfile))
642  if (m_trailer.isEmpty())
644  if (m_inetref.isEmpty())
646  if (std::isnan(m_userrating))
647  m_userrating = 0.0;
648  if (m_userrating < -10.0F || m_userrating > 10.0F)
649  m_userrating = 0.0;
650  if (m_releasedate.toString().isEmpty())
651  m_releasedate = QDate::fromString("0000-00-00", "YYYY-MM-DD");
653  {
654  if (m_season > 0 || m_episode > 0)
656  else
658  }
659 
660  bool inserting = m_id == 0;
661 
662  MSqlQuery query(MSqlQuery::InitCon());
663 
664  if (inserting)
665  {
666  m_browse = true;
667 
668  m_watched = false;
669 
670  query.prepare("INSERT INTO videometadata (title,subtitle,tagline,director,studio,plot,"
671  "rating,year,userrating,length,season,episode,filename,hash,"
672  "showlevel,coverfile,inetref,homepage,browse,watched,trailer,"
673  "screenshot,banner,fanart,host,processed,contenttype) VALUES (:TITLE, :SUBTITLE, "
674  ":TAGLINE, :DIRECTOR, :STUDIO, :PLOT, :RATING, :YEAR, :USERRATING, "
675  ":LENGTH, :SEASON, :EPISODE, :FILENAME, :HASH, :SHOWLEVEL, "
676  ":COVERFILE, :INETREF, :HOMEPAGE, :BROWSE, :WATCHED, "
677  ":TRAILER, :SCREENSHOT, :BANNER, :FANART, :HOST, :PROCESSED, :CONTENTTYPE)");
678  }
679  else
680  {
681  query.prepare("UPDATE videometadata SET title = :TITLE, subtitle = :SUBTITLE, "
682  "tagline = :TAGLINE, director = :DIRECTOR, studio = :STUDIO, "
683  "plot = :PLOT, rating= :RATING, year = :YEAR, "
684  "releasedate = :RELEASEDATE, userrating = :USERRATING, "
685  "length = :LENGTH, playcount = :PLAYCOUNT, season = :SEASON, "
686  "episode = :EPISODE, filename = :FILENAME, hash = :HASH, trailer = :TRAILER, "
687  "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, "
688  "screenshot = :SCREENSHOT, banner = :BANNER, fanart = :FANART, "
689  "inetref = :INETREF, collectionref = :COLLECTION, homepage = :HOMEPAGE, "
690  "browse = :BROWSE, watched = :WATCHED, host = :HOST, playcommand = :PLAYCOMMAND, "
691  "childid = :CHILDID, category = :CATEGORY, processed = :PROCESSED, "
692  "contenttype = :CONTENTTYPE WHERE intid = :INTID");
693 
694  query.bindValue(":PLAYCOMMAND", m_playcommand);
695  query.bindValue(":CHILDID", m_childID);
696  query.bindValue(":CATEGORY", m_categoryID);
697  query.bindValue(":INTID", m_id);
698  }
699 
700  query.bindValue(":TITLE", m_title.isNull() ? "" : m_title);
701  query.bindValue(":SUBTITLE", m_subtitle.isNull() ? "" : m_subtitle);
702  query.bindValue(":TAGLINE", m_tagline);
703  query.bindValue(":DIRECTOR", m_director.isNull() ? "" : m_director);
704  query.bindValue(":STUDIO", m_studio);
705  query.bindValue(":PLOT", m_plot);
706  query.bindValue(":RATING", m_rating.isNull() ? "" : m_rating);
707  query.bindValue(":YEAR", m_year);
708  query.bindValue(":RELEASEDATE", m_releasedate);
709  query.bindValue(":USERRATING", m_userrating);
710  query.bindValue(":LENGTH", static_cast<qint64>(m_length.count()));
711  query.bindValue(":PLAYCOUNT", m_playcount);
712  query.bindValue(":SEASON", m_season);
713  query.bindValue(":EPISODE", m_episode);
714  query.bindValue(":FILENAME", m_filename);
715  query.bindValue(":HASH", m_hash);
716  query.bindValue(":TRAILER", m_trailer.isNull() ? "" : m_trailer);
717  query.bindValue(":SHOWLEVEL", m_showlevel);
718  query.bindValue(":COVERFILE", m_coverfile.isNull() ? "" : m_coverfile);
719  query.bindValue(":SCREENSHOT", m_screenshot.isNull() ? "" : m_screenshot);
720  query.bindValue(":BANNER", m_banner.isNull() ? "" : m_banner);
721  query.bindValue(":FANART", m_fanart.isNull() ? "" : m_fanart);
722  query.bindValue(":INETREF", m_inetref.isNull() ? "" : m_inetref);
723  query.bindValue(":COLLECTION", m_collectionref);
724  query.bindValue(":HOMEPAGE", m_homepage.isNull() ? "" : m_homepage);
725  query.bindValue(":BROWSE", m_browse);
726  query.bindValue(":WATCHED", m_watched);
727  query.bindValue(":HOST", m_host);
728  query.bindValue(":PROCESSED", m_processed);
729  query.bindValue(":CONTENTTYPE", ContentTypeToString(m_contenttype));
730 
731  if (!query.exec() || !query.isActive())
732  {
733  MythDB::DBError("video metadata update", query);
734  return;
735  }
736 
737  if (inserting)
738  {
739  // Must make sure we have 'id' filled before we call updateGenres or
740  // updateCountries
741 
742  if (!query.exec("SELECT LAST_INSERT_ID()") || !query.next())
743  {
744  MythDB::DBError("metadata id get", query);
745  return;
746  }
747 
748  m_id = query.value(0).toUInt();
749 
750  if (0 == m_id)
751  {
752  LOG(VB_GENERAL, LOG_ERR,
753  QString("%1: The id of the last inserted row to "
754  "videometadata seems to be 0. This is odd.")
755  .arg(__FILE__));
756  return;
757  }
758  }
759 
760  updateGenres();
761  updateCountries();
762  updateCast();
763 }
764 
766 {
767  saveToDatabase();
768 }
769 
771 {
772  saveToDatabase();
773 }
774 
776 {
780 
781  MSqlQuery query(MSqlQuery::InitCon());
782  query.prepare("DELETE FROM videometadata WHERE intid = :ID");
783  query.bindValue(":ID", m_id);
784  if (!query.exec())
785  {
786  MythDB::DBError("delete from videometadata", query);
787  }
788 
789  query.prepare("DELETE FROM filemarkup WHERE filename = :FILENAME");
790  query.bindValue(":FILENAME", m_filename);
791  if (!query.exec())
792  {
793  MythDB::DBError("delete from filemarkup", query);
794  }
795 
796  return true;
797 }
798 
800 {
801  if (id == 0)
802  {
803  m_category = "";
804  m_categoryID = id;
805  }
806  else
807  {
808  if (m_categoryID != id)
809  {
810  QString cat;
812  {
813  m_category = cat;
814  m_categoryID = id;
815  }
816  else
817  {
818  LOG(VB_GENERAL, LOG_ERR, "Unknown category id");
819  }
820  }
821  }
822 }
823 
825 {
827 
828  // ensure that all genres we have are in the DB
829  auto genre = m_genres.begin();
830  while (genre != m_genres.end())
831  {
832  if (!genre->second.trimmed().isEmpty())
833  {
834  genre->first = VideoGenre::getGenre().add(genre->second);
835  VideoGenreMap::getGenreMap().add(m_id, genre->first);
836  ++genre;
837  }
838  else
839  {
840  genre = m_genres.erase(genre);
841  }
842  }
843 }
844 
846 {
847  // remove countries for this video
849 
850  auto country = m_countries.begin();
851  while (country != m_countries.end())
852  {
853  if (!country->second.trimmed().isEmpty())
854  {
855  country->first = VideoCountry::getCountry().add(country->second);
856  VideoCountryMap::getCountryMap().add(m_id, country->first);
857  ++country;
858  }
859  else
860  {
861  country = m_countries.erase(country);
862  }
863  }
864 }
865 
867 {
869 
870  // ensure that all cast we have are in the DB
871  auto cast = m_cast.begin();
872  while (cast != m_cast.end())
873  {
874  if (!cast->second.trimmed().isEmpty())
875  {
876  cast->first = VideoCast::GetCast().add(cast->second);
877  VideoCastMap::getCastMap().add(m_id, cast->first);
878  ++cast;
879  }
880  else
881  {
882  cast = m_cast.erase(cast);
883  }
884  }
885 }
886 
888 {
889  QString coverfile;
890  if (IsHostSet()
891  && !GetCoverFile().startsWith("/")
892  && !GetCoverFile().isEmpty()
894  {
895  coverfile = generate_file_url("Coverart", GetHost(),
896  GetCoverFile());
897  }
898  else
899  {
900  coverfile = GetCoverFile();
901  }
902 
903  imageMap["coverfile"] = coverfile;
904  imageMap["coverart"] = coverfile;
905 
906  QString screenshotfile;
907  if (IsHostSet() && !GetScreenshot().startsWith("/")
908  && !GetScreenshot().isEmpty())
909  {
910  screenshotfile = generate_file_url("Screenshots",
911  GetHost(), GetScreenshot());
912  }
913  else
914  {
915  screenshotfile = GetScreenshot();
916  }
917 
918  imageMap["screenshotfile"] = screenshotfile;
919  imageMap["screenshot"] = screenshotfile;
920 
921  QString bannerfile;
922  if (IsHostSet() && !GetBanner().startsWith("/")
923  && !GetBanner().isEmpty())
924  {
925  bannerfile = generate_file_url("Banners", GetHost(),
926  GetBanner());
927  }
928  else
929  {
930  bannerfile = GetBanner();
931  }
932 
933  imageMap["bannerfile"] = bannerfile;
934  imageMap["banner"] = bannerfile;
935 
936  QString fanartfile;
937  if (IsHostSet() && !GetFanart().startsWith("/")
938  && !GetFanart().isEmpty())
939  {
940  fanartfile = generate_file_url("Fanart", GetHost(),
941  GetFanart());
942  }
943  else
944  {
945  fanartfile = GetFanart();
946  }
947 
948  imageMap["fanartfile"] = fanartfile;
949  imageMap["fanart"] = fanartfile;
950 
951  QString smartimage = coverfile;
952  if (!screenshotfile.isEmpty () && (GetSeason() > 0 || GetEpisode() > 0))
953  smartimage = screenshotfile;
954  imageMap["smartimage"] = smartimage;
955 }
956 
960 namespace
961 {
962  QString eatBraces(const QString &title, const QString &left_brace,
963  const QString &right_brace)
964  {
965  QString ret(title);
966  bool keep_checking = true;
967 
968  while (keep_checking)
969  {
970  int left_position = ret.indexOf(left_brace);
971  int right_position = ret.indexOf(right_brace);
972  if (left_position == -1 || right_position == -1)
973  {
974  //
975  // No matching sets of these braces left.
976  //
977 
978  keep_checking = false;
979  }
980  else
981  {
982  if (left_position < right_position)
983  {
984  //
985  // We have a matching set like: ( foo )
986  //
987 
988  ret = ret.left(left_position) +
989  ret.right(ret.length() - right_position - 1);
990  }
991  else if (left_position > right_position)
992  {
993  //
994  // We have a matching set like: ) foo (
995  //
996 
997  ret = ret.left(right_position) +
998  ret.right(ret.length() - left_position - 1);
999  }
1000  }
1001  }
1002 
1003  return ret;
1004  }
1005 }
1006 
1007 int VideoMetadata::UpdateHashedDBRecord(const QString &hash,
1008  const QString &file_name,
1009  const QString &host)
1010 {
1011  MSqlQuery query(MSqlQuery::InitCon());
1012 
1013  query.prepare("SELECT intid,filename FROM videometadata WHERE "
1014  "hash = :HASH");
1015  query.bindValue(":HASH", hash);
1016 
1017  if (!query.exec() || !query.isActive())
1018  {
1019  MythDB::DBError("Video hashed metadata update", query);
1020  return -1;
1021  }
1022 
1023  if (!query.next())
1024  return -1;
1025 
1026  int intid = query.value(0).toInt();
1027  QString oldfilename = query.value(1).toString();
1028 
1029  query.prepare("UPDATE videometadata SET filename = :FILENAME, "
1030  "host = :HOST WHERE intid = :INTID");
1031  query.bindValue(":FILENAME", file_name);
1032  query.bindValue(":HOST", host);
1033  query.bindValue(":INTID", intid);
1034 
1035  if (!query.exec() || !query.isActive())
1036  {
1037  MythDB::DBError("Video hashed metadata update (videometadata)", query);
1038  return -1;
1039  }
1040 
1041  query.prepare("UPDATE filemarkup SET filename = :FILENAME "
1042  "WHERE filename = :OLDFILENAME");
1043  query.bindValue(":FILENAME", file_name);
1044  query.bindValue(":OLDFILENAME", oldfilename);
1045 
1046  if (!query.exec() || !query.isActive())
1047  {
1048  MythDB::DBError("Video hashed metadata update (filemarkup)", query);
1049  return -1;
1050  }
1051 
1052  return intid;
1053 }
1054 
1055 QString VideoMetadata::VideoFileHash(const QString &file_name,
1056  const QString &host)
1057 {
1058  if (host.isEmpty())
1059  return FileHash(file_name);
1060 
1062  {
1063  StorageGroup sgroup("Videos", host);
1064  QString fullname = sgroup.FindFile(file_name);
1065 
1066  return FileHash(fullname);
1067  }
1068 
1069  QString url = generate_file_url("Videos", host, file_name);
1070 
1071  return RemoteFile::GetFileHash(url);
1072 }
1073 
1074 QString VideoMetadata::FilenameToMeta(const QString &file_name, int position)
1075 {
1076  // position 1 returns title, 2 returns season,
1077  // 3 returns episode, 4 returns subtitle
1078 
1079  QString cleanFilename = file_name.left(file_name.lastIndexOf('.'));
1080  cleanFilename.replace(QRegularExpression("%20"), " ");
1081  cleanFilename.replace(QRegularExpression("_"), " ");
1082  cleanFilename.replace(QRegularExpression("\\."), " ");
1083 
1084  /*: Word(s) which should be recognized as "season" when parsing a video
1085  * file name. To list more than one word, separate them with a '|'.
1086  */
1087  QString season_translation = tr("Season", "Metadata file name parsing");
1088 
1089  /*: Word(s) which should be recognized as "episode" when parsing a video
1090  * file name. To list more than one word, separate them with a '|'.
1091  */
1092  QString episode_translation = tr("Episode", "Metadata file name parsing");
1093 
1094  // Primary Regexp
1095  QString separator = "(?:\\s?(?:-|/)?\\s?)?";
1096  QString regexp = QString(
1097  "^(.*[^s0-9])" // Title
1098  "%1" // optional separator
1099  "(?:s|(?:Season|%2))?" // season marker
1100  "%1" // optional separator
1101  "(\\d{1,4})" // Season
1102  "%1" // optional separator
1103  "(?:[ex/]|Episode|%3)" // episode marker
1104  "%1" // optional separator
1105  "(\\d{1,3})" // Episode
1106  "%1" // optional separator
1107  "(.*)$" // Subtitle
1108  ).arg(separator, season_translation, episode_translation);
1109  static const QRegularExpression filename_parse { regexp,
1110  QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
1111 
1112  // Cleanup Regexp
1113  QString regexp2 = QString("(%1(?:(?:Season|%2)%1\\d*%1)*%1)$")
1114  .arg(separator, season_translation);
1115  static const QRegularExpression title_parse {regexp2,
1116  QRegularExpression::CaseInsensitiveOption|QRegularExpression::UseUnicodePropertiesOption };
1117 
1118  auto match = filename_parse.match(cleanFilename);
1119  if (match.hasMatch())
1120  {
1121  // Return requested value
1122  if (position == 1 && !match.capturedView(1).isEmpty())
1123  {
1124  // Clean up the title
1125  QString title = match.captured(1);
1126  match = title_parse.match(title);
1127  if (match.hasMatch())
1128  title = title.left(match.capturedStart());
1129  title = title.right(title.length() - title.lastIndexOf('/') -1);
1130  return title.trimmed();
1131  }
1132  if (position == 2)
1133  return match.captured(2).trimmed();
1134  if (position == 3)
1135  return match.captured(3).trimmed();
1136  if (position == 4)
1137  return match.captured(4).trimmed();
1138  }
1139  else if (position == 1)
1140  {
1141  QString title = cleanFilename;
1142 
1143  // Clean up the title
1144  title = title.right(title.length() -
1145  title.lastIndexOf('/') -1);
1146 
1147  title = eatBraces(title, "[", "]");
1148  title = eatBraces(title, "(", ")");
1149  title = eatBraces(title, "{", "}");
1150  return title.trimmed();
1151  }
1152  else if (position == 2 || position == 3)
1153  return QString("0");
1154 
1155  return QString();
1156 }
1157 
1158 VideoMetadata::VideoMetadata(const QString &filename, const QString &sortFilename,
1159  const QString &hash, const QString &trailer, const QString &coverfile,
1160  const QString &screenshot, const QString &banner, const QString &fanart,
1161  const QString &title, const QString &sortTitle,
1162  const QString &subtitle, const QString &sortSubtitle, const QString &tagline,
1163  int year, const QDate releasedate, const QString &inetref, int collectionref,
1164  const QString &homepage, const QString &director, const QString &studio,
1165  const QString &plot, float userrating, const QString &rating,
1166  int length, int playcount, int season, int episode, const QDate insertdate,
1167  int id, ParentalLevel::Level showlevel, int categoryID,
1168  int childID, bool browse, bool watched,
1169  const QString &playcommand, const QString &category,
1170  const genre_list &genres,
1171  const country_list &countries,
1172  const cast_list &cast,
1173  const QString &host, bool processed,
1174  VideoContentType contenttype)
1175 {
1176  m_imp = new VideoMetadataImp(filename, sortFilename, hash, trailer, coverfile,
1177  screenshot, banner, fanart, title, sortTitle, subtitle,
1178  sortSubtitle, tagline, year, releasedate, inetref,
1179  collectionref, homepage, director, studio, plot, userrating, rating,
1180  length, playcount, season, episode, insertdate, id, showlevel, categoryID,
1181  childID, browse, watched, playcommand, category, genres, countries,
1182  cast, host, processed, contenttype);
1183 }
1184 
1186 {
1187  delete m_imp;
1188 }
1189 
1191 {
1192  m_imp = new VideoMetadataImp(query);
1193 }
1194 
1195 VideoMetadata::VideoMetadata(const VideoMetadata &rhs) : m_imp(nullptr)
1196 {
1197  *this = rhs;
1198 }
1199 
1201 {
1202  if (this != &rhs)
1203  {
1204  m_imp = new VideoMetadataImp(*(rhs.m_imp));
1205  }
1206 
1207  return *this;
1208 }
1209 
1210 void VideoMetadata::toMap(InfoMap &metadataMap)
1211 {
1212  GetImageMap(metadataMap);
1213 
1214  metadataMap["filename"] = GetFilename();
1215  metadataMap["sortfilename"] = GetSortFilename();
1216  metadataMap["title"] = GetTitle();
1217  metadataMap["sorttitle"] = GetSortTitle();
1218  metadataMap["subtitle"] = GetSubtitle();
1219  metadataMap["sortsubtitle"] = GetSortSubtitle();
1220  metadataMap["tagline"] = GetTagline();
1221  metadataMap["director"] = GetDirector();
1222  metadataMap["studio"] = GetStudio();
1223  metadataMap["description0"] = metadataMap["description"] = GetPlot();
1224  metadataMap["genres"] = GetDisplayGenres(*this);
1225  metadataMap["countries"] = GetDisplayCountries(*this);
1226  metadataMap["cast"] = GetDisplayCast(*this).join(", ");
1227  metadataMap["rating"] = GetDisplayRating(GetRating());
1228  metadataMap["length"] = GetDisplayLength(GetLength());
1229  metadataMap["playcount"] = QString::number(GetPlayCount());
1230  metadataMap["year"] = GetDisplayYear(GetYear());
1231 
1232  metadataMap["releasedate"] = MythDate::toString(
1234 
1235  metadataMap["userrating"] = GetDisplayUserRating(GetUserRating());
1236 
1237  if (GetSeason() > 0 || GetEpisode() > 0)
1238  {
1239  metadataMap["season"] = format_season_and_episode(GetSeason(), 1);
1240  metadataMap["episode"] = format_season_and_episode(GetEpisode(), 1);
1241  metadataMap["s##e##"] = metadataMap["s00e00"] = QString("s%1e%2")
1244  metadataMap["##x##"] = metadataMap["00x00"] = QString("%1x%2")
1247  }
1248  else
1249  {
1250  metadataMap["s##e##"] = metadataMap["##x##"] = QString();
1251  metadataMap["s00e00"] = metadataMap["00x00"] = QString();
1252  metadataMap["season"] = metadataMap["episode"] = QString();
1253  }
1254 
1255  GetStateMap(metadataMap);
1256 
1257  metadataMap["insertdate"] = MythDate::toString(
1259  metadataMap["inetref"] = GetInetRef();
1260  metadataMap["homepage"] = GetHomepage();
1261  metadataMap["child_id"] = QString::number(GetChildID());
1262  metadataMap["browseable"] = GetDisplayBrowse(GetBrowse());
1263  metadataMap["watched"] = GetDisplayWatched(GetWatched());
1264  metadataMap["processed"] = GetDisplayProcessed(GetProcessed());
1265  metadataMap["category"] = GetCategory();
1266 }
1267 
1268 
1270 {
1271  stateMap["trailerstate"] = TrailerToState(GetTrailer());
1272  stateMap["userratingstate"] =
1273  QString::number((int)(GetUserRating()));
1274  stateMap["watchedstate"] = WatchedToState(GetWatched());
1275  stateMap["videolevel"] = ParentalLevelToState(GetShowLevel());
1276 }
1277 
1279 {
1280  m_imp->GetImageMap(imageMap);
1281 }
1282 
1283 void ClearMap(InfoMap &metadataMap)
1284 {
1285  metadataMap["coverfile"] = "";
1286  metadataMap["screenshotfile"] = "";
1287  metadataMap["bannerfile"] = "";
1288  metadataMap["fanartfile"] = "";
1289  metadataMap["filename"] = "";
1290  metadataMap["sortfilename"] = "";
1291  metadataMap["title"] = "";
1292  metadataMap["sorttitle"] = "";
1293  metadataMap["subtitle"] = "";
1294  metadataMap["sortsubtitle"] = "";
1295  metadataMap["tagline"] = "";
1296  metadataMap["director"] = "";
1297  metadataMap["studio"] = "";
1298  metadataMap["description"] = "";
1299  metadataMap["description0"] = "";
1300  metadataMap["genres"] = "";
1301  metadataMap["countries"] = "";
1302  metadataMap["cast"] = "";
1303  metadataMap["rating"] = "";
1304  metadataMap["length"] = "";
1305  metadataMap["playcount"] = "";
1306  metadataMap["year"] = "";
1307  metadataMap["releasedate"] = "";
1308  metadataMap["userrating"] = "";
1309  metadataMap["season"] = "";
1310  metadataMap["episode"] = "";
1311  metadataMap["s##e##"] = "";
1312  metadataMap["##x##"] = "";
1313  metadataMap["trailerstate"] = "";
1314  metadataMap["userratingstate"] = "";
1315  metadataMap["watchedstate"] = "";
1316  metadataMap["videolevel"] = "";
1317  metadataMap["insertdate"] = "";
1318  metadataMap["inetref"] = "";
1319  metadataMap["homepage"] = "";
1320  metadataMap["child_id"] = "";
1321  metadataMap["browseable"] = "";
1322  metadataMap["watched"] = "";
1323  metadataMap["category"] = "";
1324  metadataMap["processed"] = "";
1325 }
1326 
1327 const QString &VideoMetadata::GetPrefix() const
1328 {
1329  return m_imp->GetPrefix();
1330 }
1331 
1332 void VideoMetadata::SetPrefix(const QString &prefix)
1333 {
1335 }
1336 
1337 const QString &VideoMetadata::GetTitle() const
1338 {
1339  return m_imp->getTitle();
1340 }
1341 
1342 const QString &VideoMetadata::GetSortTitle() const
1343 {
1344  return m_imp->getSortTitle();
1345 }
1346 
1347 void VideoMetadata::SetTitle(const QString &title, const QString &sortTitle)
1348 {
1349  m_imp->SetTitle(title, sortTitle);
1350 }
1351 
1352 const QString &VideoMetadata::GetSubtitle() const
1353 {
1354  return m_imp->getSubtitle();
1355 }
1356 
1357 const QString &VideoMetadata::GetSortSubtitle() const
1358 {
1359  return m_imp->getSortSubtitle();
1360 }
1361 
1362 void VideoMetadata::SetSubtitle(const QString &subtitle, const QString &sortSubtitle)
1363 {
1364  m_imp->SetSubtitle(subtitle, sortSubtitle);
1365 }
1366 
1367 const QString &VideoMetadata::GetTagline() const
1368 {
1369  return m_imp->GetTagline();
1370 }
1371 
1372 void VideoMetadata::SetTagline(const QString &tagline)
1373 {
1374  m_imp->SetTagline(tagline);
1375 }
1376 
1378 {
1379  return m_imp->getYear();
1380 }
1381 
1383 {
1384  m_imp->SetYear(year);
1385 }
1386 
1388 {
1389  return m_imp->getReleaseDate();
1390 }
1391 
1392 void VideoMetadata::SetReleaseDate(QDate releasedate)
1393 {
1394  m_imp->SetReleaseDate(releasedate);
1395 }
1396 
1397 const QString &VideoMetadata::GetInetRef() const
1398 {
1399  return m_imp->GetInetRef();
1400 }
1401 
1402 void VideoMetadata::SetInetRef(const QString &inetRef)
1403 {
1404  m_imp->SetInetRef(inetRef);
1405 }
1406 
1408 {
1409  return m_imp->GetCollectionRef();
1410 }
1411 
1412 void VideoMetadata::SetCollectionRef(int collectionref)
1413 {
1414  m_imp->SetCollectionRef(collectionref);
1415 }
1416 
1417 const QString &VideoMetadata::GetHomepage() const
1418 {
1419  return m_imp->GetHomepage();
1420 }
1421 
1422 void VideoMetadata::SetHomepage(const QString &homepage)
1423 {
1424  m_imp->SetHomepage(homepage);
1425 }
1426 
1427 const QString &VideoMetadata::GetDirector() const
1428 {
1429  return m_imp->getDirector();
1430 }
1431 
1432 void VideoMetadata::SetDirector(const QString &director)
1433 {
1434  m_imp->SetDirector(director);
1435 }
1436 
1437 const QString &VideoMetadata::GetStudio() const
1438 {
1439  return m_imp->getStudio();
1440 }
1441 
1442 void VideoMetadata::SetStudio(const QString &studio)
1443 {
1444  m_imp->SetStudio(studio);
1445 }
1446 
1447 const QString &VideoMetadata::GetPlot() const
1448 {
1449  return m_imp->getPlot();
1450 }
1451 
1452 void VideoMetadata::SetPlot(const QString &plot)
1453 {
1454  m_imp->SetPlot(plot);
1455 }
1456 
1458 {
1459  return m_imp->GetUserRating();
1460 }
1461 
1462 void VideoMetadata::SetUserRating(float userRating)
1463 {
1464  m_imp->SetUserRating(userRating);
1465 }
1466 
1467 const QString &VideoMetadata::GetRating() const
1468 {
1469  return m_imp->GetRating();
1470 }
1471 
1472 void VideoMetadata::SetRating(const QString &rating)
1473 {
1475 }
1476 
1477 std::chrono::minutes VideoMetadata::GetLength() const
1478 {
1479  return m_imp->GetLength();
1480 }
1481 
1482 void VideoMetadata::SetLength(std::chrono::minutes length)
1483 {
1484  m_imp->SetLength(length);
1485 }
1486 
1487 unsigned int VideoMetadata::GetPlayCount() const
1488 {
1489  return m_imp->GetPlayCount();
1490 }
1491 
1493 {
1494  m_imp->SetPlayCount(count);
1495 }
1496 
1498 {
1499  return m_imp->GetSeason();
1500 }
1501 
1503 {
1504  m_imp->SetSeason(season);
1505 }
1506 
1508 {
1509  return m_imp->GetEpisode();
1510 }
1511 
1512 void VideoMetadata::SetEpisode(int episode)
1513 {
1514  m_imp->SetEpisode(episode);
1515 }
1516 
1518 {
1519  return m_imp->GetInsertdate();
1520 }
1521 
1523 {
1524  m_imp->SetInsertdate(date);
1525 }
1526 
1527 unsigned int VideoMetadata::GetID() const
1528 {
1529  return m_imp->GetID();
1530 }
1531 
1533 {
1534  m_imp->SetID(id);
1535 }
1536 
1538 {
1539  return m_imp->GetChildID();
1540 }
1541 
1542 void VideoMetadata::SetChildID(int childID)
1543 {
1544  m_imp->SetChildID(childID);
1545 }
1546 
1548 {
1549  return m_imp->GetBrowse();
1550 }
1551 
1552 void VideoMetadata::SetBrowse(bool browse)
1553 {
1554  m_imp->SetBrowse(browse);
1555 }
1556 
1558 {
1559  return m_imp->GetWatched();
1560 }
1561 
1562 void VideoMetadata::SetWatched(bool watched)
1563 {
1564  m_imp->SetWatched(watched);
1565 }
1566 
1568 {
1569  return m_imp->GetProcessed();
1570 }
1571 
1572 void VideoMetadata::SetProcessed(bool processed)
1573 {
1574  m_imp->SetProcessed(processed);
1575 }
1576 
1578 {
1579  return m_imp->GetContentType();
1580 }
1581 
1583 {
1584  m_imp->SetContentType(contenttype);
1585 }
1586 
1587 const QString &VideoMetadata::GetPlayCommand() const
1588 {
1589  return m_imp->getPlayCommand();
1590 }
1591 
1592 void VideoMetadata::SetPlayCommand(const QString &playCommand)
1593 {
1594  m_imp->SetPlayCommand(playCommand);
1595 }
1596 
1598 {
1599  return m_imp->GetShowLevel();
1600 }
1601 
1603 {
1604  m_imp->SetShowLevel(showLevel);
1605 }
1606 
1607 const QString &VideoMetadata::GetFilename() const
1608 {
1609  return m_imp->getFilename();
1610 }
1611 
1612 const QString &VideoMetadata::GetSortFilename() const
1613 {
1614  return m_imp->getSortFilename();
1615 }
1616 
1617 const QString &VideoMetadata::GetHash() const
1618 {
1619  return m_imp->GetHash();
1620 }
1621 
1622 void VideoMetadata::SetHash(const QString &hash)
1623 {
1624  m_imp->SetHash(hash);
1625 }
1626 
1627 const QString &VideoMetadata::GetHost() const
1628 {
1629  return m_imp->GetHost();
1630 }
1631 
1632 void VideoMetadata::SetHost(const QString &host)
1633 {
1634  m_imp->SetHost(host);
1635 }
1636 
1637 void VideoMetadata::SetFilename(const QString &filename, const QString &sortFilename)
1638 {
1639  m_imp->SetFilename(filename, sortFilename);
1640 }
1641 
1642 const QString &VideoMetadata::GetTrailer() const
1643 {
1644  return m_imp->GetTrailer();
1645 }
1646 
1647 void VideoMetadata::SetTrailer(const QString &trailer)
1648 {
1649  m_imp->SetTrailer(trailer);
1650 }
1651 
1652 const QString &VideoMetadata::GetCoverFile() const
1653 {
1654  return m_imp->GetCoverFile();
1655 }
1656 
1657 void VideoMetadata::SetCoverFile(const QString &coverFile)
1658 {
1659  m_imp->SetCoverFile(coverFile);
1660 }
1661 
1662 const QString &VideoMetadata::GetScreenshot() const
1663 {
1664  return m_imp->GetScreenshot();
1665 }
1666 
1667 void VideoMetadata::SetScreenshot(const QString &screenshot)
1668 {
1669  m_imp->SetScreenshot(screenshot);
1670 }
1671 
1672 const QString &VideoMetadata::GetBanner() const
1673 {
1674  return m_imp->GetBanner();
1675 }
1676 
1677 void VideoMetadata::SetBanner(const QString &banner)
1678 {
1679  m_imp->SetBanner(banner);
1680 }
1681 
1682 const QString &VideoMetadata::GetFanart() const
1683 {
1684  return m_imp->GetFanart();
1685 }
1686 
1687 void VideoMetadata::SetFanart(const QString &fanart)
1688 {
1689  m_imp->SetFanart(fanart);
1690 }
1691 
1692 const QString &VideoMetadata::GetCategory() const
1693 {
1694  return m_imp->GetCategory();
1695 }
1696 
1697 //void VideoMetadata::SetCategory(const QString &category)
1698 //{
1699 // m_imp->SetCategory(category);
1700 //}
1701 
1703 {
1704  return m_imp->getGenres();
1705 }
1706 
1708 {
1709  m_imp->SetGenres(genres);
1710 }
1711 
1713 {
1714  return m_imp->GetCast();
1715 }
1716 
1718 {
1719  m_imp->SetCast(cast);
1720 }
1721 
1723 {
1724  return m_imp->GetCountries();
1725 }
1726 
1728 {
1729  m_imp->SetCountries(countries);
1730 }
1731 
1733 {
1734  return m_imp->GetCategoryID();
1735 }
1736 
1738 {
1739  m_imp->SetCategoryID(id);
1740 }
1741 
1743 {
1744  m_imp->SaveToDatabase();
1745 }
1746 
1748 {
1749  m_imp->UpdateDatabase();
1750 }
1751 
1753 {
1754  return m_imp->DeleteFromDatabase();
1755 }
1756 
1757 #if 0
1758 bool VideoMetadata::fillDataFromID(const VideoMetadataListManager &cache)
1759 {
1760  if (m_imp->getID() == 0)
1761  return false;
1762 
1764  if (mp.get())
1765  {
1766  *this = *mp;
1767  return true;
1768  }
1769 
1770  return false;
1771 }
1772 #endif
1773 
1775 {
1776  if (m_imp->getFilename().isEmpty())
1777  return false;
1778 
1780  cache.byFilename(m_imp->getFilename());
1781  if (mp)
1782  {
1783  *this = *mp;
1784  return true;
1785  }
1786 
1787  return false;
1788 }
1789 
1791 {
1792  return m_imp->DeleteFile();
1793 }
1794 
1796 {
1797  m_imp->Reset();
1798 }
1799 
1801 {
1802  return m_imp->IsHostSet();
1803 }
1804 
1806 {
1807  return m_imp->sortBefore(rhs.m_imp);
1808 }
1809 
1810 bool operator==(const VideoMetadata& a, const VideoMetadata& b)
1811 {
1812  return a.GetFilename() == b.GetFilename();
1813 }
1814 
1815 bool operator!=(const VideoMetadata& a, const VideoMetadata& b)
1816 {
1817  return a.GetFilename() != b.GetFilename();
1818 }
VideoMetadataImp::GetFanart
const QString & GetFanart() const
Definition: videometadata.cpp:264
VideoMetadata::toMap
void toMap(InfoMap &metadataMap)
Definition: videometadata.cpp:1210
VideoMetadataImp::fillGenres
void fillGenres()
Definition: videometadata.cpp:496
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:212
VideoMetadataImp::SetEpisode
void SetEpisode(int episode)
Definition: videometadata.cpp:292
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:802
VideoMetadataImp::getStudio
const QString & getStudio() const
Definition: videometadata.cpp:205
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:124
VideoMetadataImp::m_inetref
QString m_inetref
Definition: videometadata.cpp:352
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
VideoMetadata::SetID
void SetID(int id)
Definition: videometadata.cpp:1532
VideoMetadata::SetTrailer
void SetTrailer(const QString &trailer)
Definition: videometadata.cpp:1647
VideoMetadataImp::m_processed
bool m_processed
Definition: videometadata.cpp:388
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:80
VideoMetadata::SetPlot
void SetPlot(const QString &plot)
Definition: videometadata.cpp:1452
VideoMetadata::SetCollectionRef
void SetCollectionRef(int collectionref)
Definition: videometadata.cpp:1412
VideoMetadata::FilenameToMeta
static QString FilenameToMeta(const QString &file_name, int position)
Definition: videometadata.cpp:1074
WatchedToState
QString WatchedToState(bool watched)
Definition: videoutils.cpp:276
VideoMetadataImp::getTitle
const QString & getTitle() const
Definition: videometadata.cpp:173
VideoMetadataImp::removeDir
bool removeDir(const QString &dirName)
Definition: videometadata.cpp:412
VideoMetadataImp::getFilename
const QString & getFilename() const
Definition: videometadata.cpp:238
VideoMetadataImp::SetScreenshot
void SetScreenshot(const QString &screenshot)
Definition: videometadata.cpp:259
VideoMetadataImp::m_homepage
QString m_homepage
Definition: videometadata.cpp:354
VideoMetadataImp::m_browse
bool m_browse
Definition: videometadata.cpp:384
VideoMetadata::GetReleaseDate
QDate GetReleaseDate() const
Definition: videometadata.cpp:1387
VideoMetadata::GetShowLevel
ParentalLevel::Level GetShowLevel() const
Definition: videometadata.cpp:1597
VideoMetadata::SetHomepage
void SetHomepage(const QString &homepage)
Definition: videometadata.cpp:1422
getMythSortHelper
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
Definition: mythsorthelper.cpp:133
SingleValue::add
int add(const QString &name)
Definition: dbaccess.cpp:214
VideoMetadata::SetFanart
void SetFanart(const QString &fanart)
Definition: videometadata.cpp:1687
ParentalLevel::plLowest
@ plLowest
Definition: parentalcontrols.h:12
VideoMetadataImp::GetTagline
const QString & GetTagline() const
Definition: videometadata.cpp:190
mythdb.h
VideoMetadata::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:1627
VideoMetadataImp::getSortFilename
const QString & getSortFilename() const
Definition: videometadata.cpp:239
VideoMetadataImp::SetCast
void SetCast(const cast_list &cast)
Definition: videometadata.cpp:233
VideoCountry
Definition: dbaccess.h:76
VideoMetadataListManager
Definition: videometadatalistmanager.h:10
VideoMetadataImp::SaveToDatabase
void SaveToDatabase()
Definition: videometadata.cpp:765
VideoMetadataImp::GetSeason
int GetSeason() const
Definition: videometadata.cpp:288
VideoMetadataImp::GetHomepage
const QString & GetHomepage() const
Definition: videometadata.cpp:199
VideoMetadataImp::SetCoverFile
void SetCoverFile(const QString &coverFile)
Definition: videometadata.cpp:256
RemoteFile::Exists
static bool Exists(const QString &url, struct stat *fileinfo)
Definition: remotefile.cpp:461
simple_ref_ptr
Definition: quicksp.h:24
VideoMetadataImp::SetFilename
void SetFilename(const QString &filename, const QString &sortFilename="")
Definition: videometadata.cpp:240
VideoMetadataImp::SetChildID
void SetChildID(int childID)
Definition: videometadata.cpp:274
VideoMetadataImp::m_tagline
QString m_tagline
Definition: videometadata.cpp:351
VideoCast
Definition: dbaccess.h:116
VideoMetadataImp::m_categoryID
int m_categoryID
Definition: videometadata.cpp:374
VideoMetadataImp::DeleteFile
bool DeleteFile()
Deletes the file associated with a metadata entry.
Definition: videometadata.cpp:441
StorageGroup::FindFile
QString FindFile(const QString &filename)
Definition: storagegroup.cpp:602
VideoMetadataImp::SetGenres
void SetGenres(const genre_list &genres)
Definition: videometadata.cpp:224
VideoMetadata::GetInsertdate
QDate GetInsertdate() const
Definition: videometadata.cpp:1517
VideoMetadata::GetChildID
int GetChildID() const
Definition: videometadata.cpp:1537
hardwareprofile.devicelist.cat
def cat(file_name)
Definition: devicelist.py:95
VideoMetadataImp::m_collectionref
int m_collectionref
Definition: videometadata.cpp:353
VideoMetadataImp::SetProcessed
void SetProcessed(bool processed)
Definition: videometadata.cpp:316
VideoMetadataImp::GetScreenshot
const QString & GetScreenshot() const
Definition: videometadata.cpp:258
format_season_and_episode
MPUBLIC QString format_season_and_episode(int seasEp, int digits)
Definition: programinfo.cpp:6202
VideoMetadata::SetFilename
void SetFilename(const QString &filename, const QString &sortFilename="")
Definition: videometadata.cpp:1637
VideoMetadata::GetFanart
const QString & GetFanart() const
Definition: videometadata.cpp:1682
VideoMetadataImp::SetHost
void SetHost(const QString &host)
Definition: videometadata.cpp:236
VideoMetadata::SetEpisode
void SetEpisode(int episode)
Definition: videometadata.cpp:1512
VideoMetadataImp::SetPlayCommand
void SetPlayCommand(const QString &playCommand)
Definition: videometadata.cpp:215
VideoMetadata::SetBanner
void SetBanner(const QString &banner)
Definition: videometadata.cpp:1677
VideoMetadataImp::UpdateDatabase
void UpdateDatabase()
Definition: videometadata.cpp:770
VideoMetadataImp::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:235
VideoMetadata::SetUserRating
void SetUserRating(float userRating)
Definition: videometadata.cpp:1462
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:201
GetDisplayLength
QString GetDisplayLength(std::chrono::minutes length)
Definition: videoutils.cpp:159
VideoMetadataImp::m_childID
int m_childID
Definition: videometadata.cpp:375
GetDisplayProcessed
QString GetDisplayProcessed(bool processed)
Definition: videoutils.cpp:191
VideoMetadata::country_list
std::vector< country_entry > country_list
Definition: videometadata.h:33
ContentTypeFromString
VideoContentType ContentTypeFromString(const QString &type)
Definition: videoutils.cpp:286
VideoMetadataImp::SetFanart
void SetFanart(const QString &fanart)
Definition: videometadata.cpp:265
VideoMetadataImp::GetLength
std::chrono::minutes GetLength() const
Definition: videometadata.cpp:282
VideoMetadataImp::sortBefore
bool sortBefore(const VideoMetadataImp *rhs) const
Returns true if the object should appear before the argument.
Definition: videometadata.cpp:401
MSqlQuery::exec
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
Definition: mythdbcon.cpp:603
VideoMetadataListManager::byFilename
VideoMetadataPtr byFilename(const QString &file_name) const
Definition: videometadatalistmanager.cpp:171
VideoMetadataImp::SetYear
void SetYear(int year)
Definition: videometadata.cpp:277
VideoMetadata::GetPlayCommand
const QString & GetPlayCommand() const
Definition: videometadata.cpp:1587
ContentTypeToString
QString ContentTypeToString(VideoContentType type)
Definition: videoutils.cpp:304
VideoMetadataImp::cast_list
VideoMetadata::cast_list cast_list
Definition: videometadata.cpp:33
VideoMetadataImp::SetWatched
void SetWatched(bool watched)
Definition: videometadata.cpp:307
VideoMetadata::GetHomepage
const QString & GetHomepage() const
Definition: videometadata.cpp:1417
VideoMetadata::GetSeason
int GetSeason() const
Definition: videometadata.cpp:1497
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
VideoMetadata::genre_list
std::vector< genre_entry > genre_list
Definition: videometadata.h:32
VideoMetadata::SetPlayCount
void SetPlayCount(int count)
Definition: videometadata.cpp:1492
mythsorthelper.h
VideoMetadataImp::m_countries
country_list m_countries
Definition: videometadata.cpp:362
VideoMetadataImp::SetTagline
void SetTagline(const QString &tagline)
Definition: videometadata.cpp:191
VideoMetadata::SetInetRef
void SetInetRef(const QString &inetRef)
Definition: videometadata.cpp:1402
VideoMetadata::SetShowLevel
void SetShowLevel(ParentalLevel::Level showLevel)
Definition: videometadata.cpp:1602
VideoMetadataImp::m_genres
genre_list m_genres
Definition: videometadata.cpp:361
VideoMetadataImp::m_category
QString m_category
Definition: videometadata.cpp:360
VideoMetadataImp::ensureSortFields
void ensureSortFields(void)
Definition: videometadata.cpp:158
VideoMetadata::GetCategoryID
int GetCategoryID() const
Definition: videometadata.cpp:1732
VideoMetadataImp::updateGenres
void updateGenres()
Definition: videometadata.cpp:824
VideoMetadata::GetScreenshot
const QString & GetScreenshot() const
Definition: videometadata.cpp:1662
VideoMetadataImp::SetBanner
void SetBanner(const QString &banner)
Definition: videometadata.cpp:262
VideoMetadata::SetCast
void SetCast(const cast_list &cast)
Definition: videometadata.cpp:1717
remoteutil.h
VideoMetadata::GetDirector
const QString & GetDirector() const
Definition: videometadata.cpp:1427
VideoMetadataImp::SetHash
void SetHash(const QString &hash)
Definition: videometadata.cpp:250
VideoMetadataImp::m_coverfile
QString m_coverfile
Definition: videometadata.cpp:368
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
VideoMetadata::GetPlot
const QString & GetPlot() const
Definition: videometadata.cpp:1447
VideoMetadataImp::m_rating
QString m_rating
Definition: videometadata.cpp:358
VideoMetadata::GetSubtitle
const QString & GetSubtitle() const
Definition: videometadata.cpp:1352
operator==
bool operator==(const VideoMetadata &a, const VideoMetadata &b)
Definition: videometadata.cpp:1810
VideoMetadataImp::GetCast
const cast_list & GetCast() const
Definition: videometadata.cpp:232
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
VideoMetadataImp::m_director
QString m_director
Definition: videometadata.cpp:355
dbaccess.h
VideoMetadataImp::SetDirector
void SetDirector(const QString &director)
Definition: videometadata.cpp:203
VideoMetadataImp::GetID
unsigned int GetID() const
Definition: videometadata.cpp:309
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
VideoMetadataImp::m_sortFilename
QString m_sortFilename
Definition: videometadata.cpp:365
VideoMetadataImp::SetRating
void SetRating(const QString &rating)
Definition: videometadata.cpp:212
VideoMetadataImp::SetContentType
void SetContentType(VideoContentType contenttype)
Definition: videometadata.cpp:319
VideoMetadata::SetInsertdate
void SetInsertdate(QDate date)
Definition: videometadata.cpp:1522
VideoMetadataImp::getDirector
const QString & getDirector() const
Definition: videometadata.cpp:202
VideoGenreMap::getGenreMap
static VideoGenreMap & getGenreMap()
Definition: dbaccess.cpp:543
VideoMetadataImp::GetEpisode
int GetEpisode() const
Definition: videometadata.cpp:291
MythCoreContext::IsMasterBackend
bool IsMasterBackend(void)
is this the actual MBE process
Definition: mythcorecontext.cpp:719
VideoMetadataImp::VideoMetadataImp
VideoMetadataImp(MSqlQuery &query)
Definition: videometadata.cpp:90
mythdate.h
VideoMetadata::GetFilename
const QString & GetFilename() const
Definition: videometadata.cpp:1607
VideoMetadata::GetInetRef
const QString & GetInetRef() const
Definition: videometadata.cpp:1397
VideoMetadataImp::SetReleaseDate
void SetReleaseDate(QDate releasedate)
Definition: videometadata.cpp:280
GetDisplayRating
QString GetDisplayRating(const QString &rating)
Definition: videoutils.cpp:214
VideoMetadata::GetCountries
const country_list & GetCountries() const
Definition: videometadata.cpp:1722
programinfo.h
VideoMetadataImp::m_hash
QString m_hash
Definition: videometadata.cpp:366
VideoGenre::getGenre
static VideoGenre & getGenre()
Definition: dbaccess.cpp:515
mythlogging.h
VideoMetadataImp::GetBanner
const QString & GetBanner() const
Definition: videometadata.cpp:261
VideoMetadataImp::m_season
int m_season
Definition: videometadata.cpp:380
VideoMetadata::GetCategory
const QString & GetCategory() const
Definition: videometadata.cpp:1692
VideoMetadataImp::m_title
QString m_title
Definition: videometadata.cpp:347
ParentalLevel::plNone
@ plNone
Definition: parentalcontrols.h:12
VideoMetadata::GetProcessed
bool GetProcessed() const
Definition: videometadata.cpp:1567
GetDisplayUserRating
QString GetDisplayUserRating(float userrating)
Definition: videoutils.cpp:154
MultiValue::add
int add(int id, int value)
Definition: dbaccess.cpp:445
remotefile.h
VideoMetadataImp::m_fanart
QString m_fanart
Definition: videometadata.cpp:371
VideoMetadataImp::genre_list
VideoMetadata::genre_list genre_list
Definition: videometadata.cpp:31
VideoMetadata::SetLength
void SetLength(std::chrono::minutes length)
Definition: videometadata.cpp:1482
ParentalLevel::Level
Level
Definition: parentalcontrols.h:12
VideoMetadataImp::m_releasedate
QDate m_releasedate
Definition: videometadata.cpp:377
VideoMetadataImp::SetID
void SetID(int id)
Definition: videometadata.cpp:310
VideoMetadata::GetContentType
VideoContentType GetContentType() const
Definition: videometadata.cpp:1577
globals.h
VideoMetadataImp::fillCountries
void fillCountries()
Definition: videometadata.cpp:514
VideoMetadataImp::getPlot
const QString & getPlot() const
Definition: videometadata.cpp:208
VideoMetadataImp::m_length
std::chrono::minutes m_length
Definition: videometadata.cpp:378
MSqlQuery::InitCon
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
Definition: mythdbcon.cpp:535
VideoMetadataImp::GetBrowse
bool GetBrowse() const
Definition: videometadata.cpp:303
VideoMetadata::UpdateHashedDBRecord
static int UpdateHashedDBRecord(const QString &hash, const QString &file_name, const QString &host)
Definition: videometadata.cpp:1007
GetDisplayCountries
QString GetDisplayCountries(const VideoMetadata &item)
Definition: videoutils.cpp:228
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:200
VideoMetadataImp::SetCategoryID
void SetCategoryID(int id)
Definition: videometadata.cpp:799
VideoMetadata::SaveToDatabase
void SaveToDatabase()
Definition: videometadata.cpp:1742
VideoMetadataImp::getSortSubtitle
const QString & getSortSubtitle() const
Definition: videometadata.cpp:183
VideoMetadataImp::DeleteFromDatabase
bool DeleteFromDatabase()
Definition: videometadata.cpp:775
VideoMetadataImp::m_playcount
int m_playcount
Definition: videometadata.cpp:379
VideoMetadataImp::m_screenshot
QString m_screenshot
Definition: videometadata.cpp:369
hardwareprofile.scan.rating
def rating(profile, smoonURL, gate)
Definition: scan.py:39
VideoMetadataImp::SetBrowse
void SetBrowse(bool browse)
Definition: videometadata.cpp:304
VideoMetadata::GetCollectionRef
int GetCollectionRef() const
Definition: videometadata.cpp:1407
VideoMetadataImp::fromDBRow
void fromDBRow(MSqlQuery &query)
Sets metadata from a DB row.
Definition: videometadata.cpp:554
VIDEO_COVERFILE_DEFAULT
const QString VIDEO_COVERFILE_DEFAULT
Definition: globals.cpp:25
VideoMetadataImp::getGenres
const genre_list & getGenres() const
Definition: videometadata.cpp:223
VideoMetadataImp::SetCollectionRef
void SetCollectionRef(int collectionref)
Definition: videometadata.cpp:197
VideoMetadata::SetProcessed
void SetProcessed(bool processed)
Definition: videometadata.cpp:1572
operator!=
bool operator!=(const VideoMetadata &a, const VideoMetadata &b)
Definition: videometadata.cpp:1815
VideoMetadataImp::m_watched
bool m_watched
Definition: videometadata.cpp:385
VideoMetadata::DeleteFromDatabase
bool DeleteFromDatabase()
Definition: videometadata.cpp:1752
VideoMetadataImp::m_sortSubtitle
QString m_sortSubtitle
Definition: videometadata.cpp:350
VIDEO_PLOT_DEFAULT
const QString VIDEO_PLOT_DEFAULT
Definition: globals.cpp:32
RemoteFile::GetFileHash
static QString GetFileHash(const QString &url)
Definition: remotefile.cpp:553
VideoCastMap
Definition: dbaccess.h:126
GetDisplayBrowse
QString GetDisplayBrowse(bool browse)
Definition: videoutils.cpp:167
VideoMetadataImp::m_cast
cast_list m_cast
Definition: videometadata.cpp:363
VideoMetadata::GetYear
int GetYear() const
Definition: videometadata.cpp:1377
kContentTelevision
@ kContentTelevision
Definition: metadatacommon.h:62
VideoMetadataImp::GetContentType
VideoContentType GetContentType() const
Definition: videometadata.cpp:318
VideoMetadata::GetImageMap
void GetImageMap(InfoMap &imageMap)
Definition: videometadata.cpp:1278
VideoCountry::getCountry
static VideoCountry & getCountry()
Definition: dbaccess.cpp:501
VideoMetadataImp::SetTitle
void SetTitle(const QString &title, const QString &sortTitle="")
Definition: videometadata.cpp:175
VideoMetadata::GetSortFilename
const QString & GetSortFilename() const
Definition: videometadata.cpp:1612
VideoMetadataImp::GetInetRef
const QString & GetInetRef() const
Definition: videometadata.cpp:193
VideoMetadataImp::m_filename
QString m_filename
Definition: videometadata.cpp:364
VideoMetadataImp::GetCountries
const country_list & GetCountries() const
Definition: videometadata.cpp:226
VideoMetadata::SetPrefix
void SetPrefix(const QString &prefix)
Definition: videometadata.cpp:1332
storagegroup.h
VideoMetadata::GetGenres
const genre_list & GetGenres() const
Definition: videometadata.cpp:1702
VideoMetadataImp::m_trailer
QString m_trailer
Definition: videometadata.cpp:367
RemoteFile::DeleteFile
static bool DeleteFile(const QString &url)
Definition: remotefile.cpp:418
VideoCategory::GetCategory
static VideoCategory & GetCategory()
Definition: dbaccess.cpp:487
VideoMetadata::SetSubtitle
void SetSubtitle(const QString &subtitle, const QString &sortSubtitle="")
Definition: videometadata.cpp:1362
naturalCompare
int naturalCompare(const QString &_a, const QString &_b, Qt::CaseSensitivity caseSensitivity)
Definition: mythmiscutil.cpp:1035
VIDEO_TRAILER_DEFAULT
const QString VIDEO_TRAILER_DEFAULT
Definition: globals.cpp:26
VideoMetadata::operator=
VideoMetadata & operator=(const VideoMetadata &rhs)
Definition: videometadata.cpp:1200
VideoGenre
Definition: dbaccess.h:86
VideoMetadataImp::m_banner
QString m_banner
Definition: videometadata.cpp:370
VideoMetadata::GetEpisode
int GetEpisode() const
Definition: videometadata.cpp:1507
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:60
VideoMetadataImp::GetPlayCount
unsigned int GetPlayCount() const
Definition: videometadata.cpp:285
VideoMetadata::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:1327
VideoMetadataImp::m_year
int m_year
Definition: videometadata.cpp:376
VideoMetadataImp::m_contenttype
VideoContentType m_contenttype
Definition: videometadata.cpp:389
VideoMetadataImp::GetChildID
int GetChildID() const
Definition: videometadata.cpp:273
VideoMetadata::FillDataFromFilename
bool FillDataFromFilename(const VideoMetadataListManager &cache)
Definition: videometadata.cpp:1774
VideoMetadataImp::SetInsertdate
void SetInsertdate(QDate date)
Definition: videometadata.cpp:295
VideoMetadataImp::SetPlot
void SetPlot(const QString &plot)
Definition: videometadata.cpp:209
VIDEO_INETREF_DEFAULT
const QString VIDEO_INETREF_DEFAULT
Definition: globals.cpp:24
VideoMetadata::sortBefore
bool sortBefore(const VideoMetadata &rhs) const
Definition: videometadata.cpp:1805
VIDEO_FANART_DEFAULT
const QString VIDEO_FANART_DEFAULT
Definition: globals.cpp:29
videometadatalistmanager.h
VideoMetadataImp::updateCountries
void updateCountries()
Definition: videometadata.cpp:845
VideoMetadataImp::SetUserRating
void SetUserRating(float userRating)
Definition: videometadata.cpp:313
VideoMetadataImp::m_insertdate
QDate m_insertdate
Definition: videometadata.cpp:382
VideoMetadata::SetGenres
void SetGenres(const genre_list &genres)
Definition: videometadata.cpp:1707
VideoMetadata::GetHash
const QString & GetHash() const
Definition: videometadata.cpp:1617
VideoMetadata::SetPlayCommand
void SetPlayCommand(const QString &playCommand)
Definition: videometadata.cpp:1592
VideoMetadata::SetTagline
void SetTagline(const QString &tagline)
Definition: videometadata.cpp:1372
ParentalLevelToState
QString ParentalLevelToState(const ParentalLevel &level)
Definition: videoutils.cpp:242
IsDefaultCoverFile
bool IsDefaultCoverFile(const QString &coverfile)
Definition: videoutils.cpp:130
VideoMetadataImp::m_showlevel
ParentalLevel::Level m_showlevel
Definition: videometadata.cpp:383
MythDate::fromString
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:30
VideoMetadataImp::GetCoverFile
const QString & GetCoverFile() const
Definition: videometadata.cpp:255
VideoMetadataImp::operator=
VideoMetadataImp & operator=(const VideoMetadataImp &rhs)
Definition: videometadata.cpp:101
VideoCountryMap::getCountryMap
static VideoCountryMap & getCountryMap()
Definition: dbaccess.cpp:558
VideoMetadata::SetCategoryID
void SetCategoryID(int id)
Definition: videometadata.cpp:1737
VideoMetadataImp::m_subtitle
QString m_subtitle
Definition: videometadata.cpp:349
VideoMetadataImp::GetCategory
const QString & GetCategory() const
Definition: videometadata.cpp:220
VideoMetadataImp::SetPlayCount
void SetPlayCount(int playcount)
Definition: videometadata.cpp:286
VideoMetadataImp::GetHash
const QString & GetHash() const
Definition: videometadata.cpp:249
VideoMetadataImp::saveToDatabase
void saveToDatabase()
Definition: videometadata.cpp:611
VideoMetadata::SetSeason
void SetSeason(int season)
Definition: videometadata.cpp:1502
VideoMetadata::SetRating
void SetRating(const QString &rating)
Definition: videometadata.cpp:1472
VideoMetadataImp::GetUserRating
float GetUserRating() const
Definition: videometadata.cpp:312
VideoContentType
VideoContentType
Definition: metadatacommon.h:60
mythmiscutil.h
VideoMetadata::SetCoverFile
void SetCoverFile(const QString &coverFile)
Definition: videometadata.cpp:1657
VideoMetadataImp::SetTrailer
void SetTrailer(const QString &trailer)
Definition: videometadata.cpp:253
VideoMetadataImp::SetHomepage
void SetHomepage(const QString &homepage)
Definition: videometadata.cpp:200
MythDate::kAddYear
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:25
VideoMetadataImp::SetLength
void SetLength(std::chrono::minutes length)
Definition: videometadata.cpp:283
VideoMetadataImp::getSortTitle
const QString & getSortTitle() const
Definition: videometadata.cpp:174
mythcorecontext.h
VideoMetadataImp::getPlayCommand
const QString & getPlayCommand() const
Definition: videometadata.cpp:214
VideoMetadata::cast_list
std::vector< cast_entry > cast_list
Definition: videometadata.h:34
VideoMetadata::SetHost
void SetHost(const QString &host)
Definition: videometadata.cpp:1632
VideoMetadata::SetDirector
void SetDirector(const QString &director)
Definition: videometadata.cpp:1432
VideoCast::GetCast
static VideoCast & GetCast()
Definition: dbaccess.cpp:529
VideoMetadata::GetUserRating
float GetUserRating() const
Definition: videometadata.cpp:1457
VideoMetadata::IsHostSet
bool IsHostSet() const
Definition: videometadata.cpp:1800
ParentalLevel
Definition: parentalcontrols.h:9
VideoMetadata::UpdateDatabase
void UpdateDatabase()
Definition: videometadata.cpp:1747
MSqlQuery::bindValue
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
Definition: mythdbcon.cpp:878
VIDEO_RATING_DEFAULT
const QString VIDEO_RATING_DEFAULT
Definition: globals.cpp:30
VideoMetadataImp::Reset
void Reset()
Definition: videometadata.cpp:472
std
Definition: mythchrono.h:23
VideoMetadata::GetWatched
bool GetWatched() const
Definition: videometadata.cpp:1557
MultiValue::get
bool get(int id, entry &values)
Definition: dbaccess.cpp:450
VideoMetadataImp::m_episode
int m_episode
Definition: videometadata.cpp:381
VideoMetadataImp::GetTrailer
const QString & GetTrailer() const
Definition: videometadata.cpp:252
VideoMetadata::SetContentType
void SetContentType(VideoContentType contenttype)
Definition: videometadata.cpp:1582
VideoMetadata::GetCoverFile
const QString & GetCoverFile() const
Definition: videometadata.cpp:1652
VideoMetadata::SetTitle
void SetTitle(const QString &title, const QString &sortTitle="")
Definition: videometadata.cpp:1347
hardwareprofile.distros.all.get
def get()
Definition: all.py:22
VideoMetadataImp::SetCountries
void SetCountries(const country_list &countries)
Definition: videometadata.cpp:227
VideoMetadata::SetStudio
void SetStudio(const QString &studio)
Definition: videometadata.cpp:1442
VideoMetadataImp::IsHostSet
bool IsHostSet() const
Definition: videometadata.cpp:491
mythcontext.h
VideoMetadataImp::m_studio
QString m_studio
Definition: videometadata.cpp:356
VideoMetadataImp::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:170
VideoMetadataImp::SetSubtitle
void SetSubtitle(const QString &subtitle, const QString &sortSubtitle="")
Definition: videometadata.cpp:184
MultiValue::remove
void remove(int id, int value)
Definition: dbaccess.cpp:455
VideoMetadataImp
Definition: videometadata.cpp:28
VideoMetadata::GetLength
std::chrono::minutes GetLength() const
Definition: videometadata.cpp:1477
StorageGroup
Definition: storagegroup.h:11
VideoMetadataImp::m_prefix
QString m_prefix
Definition: videometadata.cpp:392
VideoMetadata::SetBrowse
void SetBrowse(bool browse)
Definition: videometadata.cpp:1552
VideoMetadataImp::VideoMetadataImp
VideoMetadataImp(const VideoMetadataImp &other)
Definition: videometadata.cpp:96
VideoMetadataImp::m_userrating
float m_userrating
Definition: videometadata.cpp:387
VideoMetadataImp::getReleaseDate
QDate getReleaseDate() const
Definition: videometadata.cpp:279
VideoMetadataImp::getYear
int getYear() const
Definition: videometadata.cpp:276
VideoMetadata::GetID
unsigned int GetID() const
Definition: videometadata.cpp:1527
VideoMetadata::SetYear
void SetYear(int year)
Definition: videometadata.cpp:1382
VIDEO_YEAR_DEFAULT
@ VIDEO_YEAR_DEFAULT
Definition: videometadata.h:18
VideoMetadata::GetSortTitle
const QString & GetSortTitle() const
Definition: videometadata.cpp:1342
VideoMetadataImp::GetShowLevel
ParentalLevel::Level GetShowLevel() const
Definition: videometadata.cpp:297
VideoMetadata::VideoMetadata
VideoMetadata(const QString &filename=QString(), const QString &sortFilename=QString(), const QString &hash=QString(), const QString &trailer=QString(), const QString &coverfile=QString(), const QString &screenshot=QString(), const QString &banner=QString(), const QString &fanart=QString(), const QString &title=QString(), const QString &sortTitle=QString(), const QString &subtitle=QString(), const QString &sortSubtitle=QString(), const QString &tagline=QString(), int year=VIDEO_YEAR_DEFAULT, QDate releasedate=QDate(), const QString &inetref=QString(), int collectionref=0, const QString &homepage=QString(), const QString &director=QString(), const QString &studio=QString(), const QString &plot=QString(), float userrating=0.0, const QString &rating=QString(), int length=0, int playcount=0, int season=0, int episode=0, QDate insertdate=QDate(), int id=0, ParentalLevel::Level showlevel=ParentalLevel::plLowest, int categoryID=0, int childID=-1, bool browse=true, bool watched=false, const QString &playcommand=QString(), const QString &category=QString(), const genre_list &genres=genre_list(), const country_list &countries=country_list(), const cast_list &cast=cast_list(), const QString &host="", bool processed=false, VideoContentType contenttype=kContentUnknown)
Definition: videometadata.cpp:1158
VideoMetadata::GetTitle
const QString & GetTitle() const
Definition: videometadata.cpp:1337
kContentMovie
@ kContentMovie
Definition: metadatacommon.h:61
VideoMetadata::SetScreenshot
void SetScreenshot(const QString &screenshot)
Definition: videometadata.cpp:1667
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
GetDisplayGenres
QString GetDisplayGenres(const VideoMetadata &item)
Definition: videoutils.cpp:221
VideoMetadata::SetWatched
void SetWatched(bool watched)
Definition: videometadata.cpp:1562
VideoMetadata::SetHash
void SetHash(const QString &hash)
Definition: videometadata.cpp:1622
VideoMetadata::GetSortSubtitle
const QString & GetSortSubtitle() const
Definition: videometadata.cpp:1357
VideoMetadata::m_imp
class VideoMetadataImp * m_imp
Definition: videometadata.h:235
VideoMetadataImp::m_id
unsigned int m_id
Definition: videometadata.cpp:386
VideoMetadata::GetTrailer
const QString & GetTrailer() const
Definition: videometadata.cpp:1642
VideoMetadataImp::country_list
VideoMetadata::country_list country_list
Definition: videometadata.cpp:32
VideoMetadataImp::SetShowLevel
void SetShowLevel(ParentalLevel::Level showLevel)
Definition: videometadata.cpp:298
MultiValue::entry::values
values_type values
Definition: dbaccess.h:44
kContentUnknown
@ kContentUnknown
Definition: metadatacommon.h:66
MythCoreContext::IsThisHost
bool IsThisHost(const QString &addr)
is this address mapped to this host
Definition: mythcorecontext.cpp:745
VideoCastMap::getCastMap
static VideoCastMap & getCastMap()
Definition: dbaccess.cpp:573
TrailerToState
QString TrailerToState(const QString &trailerFile)
Definition: videoutils.cpp:266
VideoMetadataImp::updateCast
void updateCast()
Definition: videometadata.cpp:866
VIDEO_BANNER_DEFAULT
const QString VIDEO_BANNER_DEFAULT
Definition: globals.cpp:28
d
static const iso6937table * d
Definition: iso6937tables.cpp:1025
VideoMetadata::GetRating
const QString & GetRating() const
Definition: videometadata.cpp:1467
VideoMetadataImp::GetProcessed
bool GetProcessed() const
Definition: videometadata.cpp:315
VideoMetadataImp::GetInsertdate
QDate GetInsertdate() const
Definition: videometadata.cpp:294
VideoCountryMap
Definition: dbaccess.h:106
VideoMetadata::DeleteFile
bool DeleteFile()
Definition: videometadata.cpp:1790
VideoMetadata::~VideoMetadata
~VideoMetadata()
Definition: videometadata.cpp:1185
VideoMetadataImp::GetRating
const QString & GetRating() const
Definition: videometadata.cpp:211
VideoMetadata::Reset
void Reset()
Resets to default metadata.
Definition: videometadata.cpp:1795
VideoMetadataImp::GetCollectionRef
int GetCollectionRef() const
Definition: videometadata.cpp:196
VideoMetadataImp::SetInetRef
void SetInetRef(const QString &inetRef)
Definition: videometadata.cpp:194
VideoMetadata::GetTagline
const QString & GetTagline() const
Definition: videometadata.cpp:1367
VideoMetadataImp::GetWatched
bool GetWatched() const
Definition: videometadata.cpp:306
VideoMetadataImp::SetStudio
void SetStudio(const QString &studio)
Definition: videometadata.cpp:206
VideoMetadata::GetBrowse
bool GetBrowse() const
Definition: videometadata.cpp:1547
VideoMetadataImp::SetSeason
void SetSeason(int season)
Definition: videometadata.cpp:289
build_compdb.filename
filename
Definition: build_compdb.py:21
VideoMetadata::GetBanner
const QString & GetBanner() const
Definition: videometadata.cpp:1672
VideoMetadata::VideoFileHash
static QString VideoFileHash(const QString &file_name, const QString &host)
Definition: videometadata.cpp:1055
VideoMetadataImp::getSubtitle
const QString & getSubtitle() const
Definition: videometadata.cpp:182
FileHash
QString FileHash(const QString &filename)
Definition: mythmiscutil.cpp:596
GetDisplayWatched
QString GetDisplayWatched(bool watched)
Definition: videoutils.cpp:179
VideoMetadataImp::m_plot
QString m_plot
Definition: videometadata.cpp:357
VideoMetadataImp::VideoMetadataImp
VideoMetadataImp(QString filename, QString sortFilename, QString hash, QString trailer, QString coverfile, QString screenshot, QString banner, QString fanart, const QString &title, QString sortTitle, const QString &subtitle, QString sortSubtitle, QString tagline, int year, const QDate releasedate, QString inetref, int collectionref, QString homepage, QString director, QString studio, QString plot, float userrating, QString rating, int length, int playcount, int season, int episode, const QDate insertdate, int id, ParentalLevel::Level showlevel, int categoryID, int childID, bool browse, bool watched, QString playcommand, QString category, genre_list genres, country_list countries, cast_list cast, QString host="", bool processed=false, VideoContentType contenttype=kContentUnknown)
Definition: videometadata.cpp:36
ParentalLevel::GetLevel
Level GetLevel() const
Definition: parentalcontrols.cpp:128
VideoMetadata::GetPlayCount
unsigned int GetPlayCount() const
Definition: videometadata.cpp:1487
GetDisplayCast
QStringList GetDisplayCast(const VideoMetadata &item)
Definition: videoutils.cpp:235
VideoMetadata::SetReleaseDate
void SetReleaseDate(QDate releasedate)
Definition: videometadata.cpp:1392
VideoMetadata::SetChildID
void SetChildID(int childID)
Definition: videometadata.cpp:1542
VideoMetadata::GetCast
const cast_list & GetCast() const
Definition: videometadata.cpp:1712
SingleValue::get
bool get(int id, QString &category)
Definition: dbaccess.cpp:219
VideoMetadata::GetStudio
const QString & GetStudio() const
Definition: videometadata.cpp:1437
VideoMetadataImp::GetImageMap
void GetImageMap(InfoMap &imageMap) const
Definition: videometadata.cpp:887
videoutils.h
VideoMetadata::SetCountries
void SetCountries(const country_list &countries)
Definition: videometadata.cpp:1727
VIDEO_DIRECTOR_DEFAULT
const QString VIDEO_DIRECTOR_DEFAULT
Definition: globals.cpp:23
VideoMetadataImp::m_playcommand
QString m_playcommand
Definition: videometadata.cpp:359
VideoMetadataImp::m_sortTitle
QString m_sortTitle
Definition: videometadata.cpp:348
VideoMetadataImp::m_host
QString m_host
Definition: videometadata.cpp:372
VideoMetadataImp::SetPrefix
void SetPrefix(const QString &prefix)
Definition: videometadata.cpp:171
simple_ref_ptr::get
T * get() const
Definition: quicksp.h:73
VideoMetadataImp::fillCast
void fillCast()
Definition: videometadata.cpp:532
VideoMetadata::GetStateMap
void GetStateMap(InfoMap &stateMap) const
Definition: videometadata.cpp:1269
VideoGenreMap
Definition: dbaccess.h:96
VIDEO_SCREENSHOT_DEFAULT
const QString VIDEO_SCREENSHOT_DEFAULT
Definition: globals.cpp:27
GetDisplayYear
QString GetDisplayYear(int year)
Definition: videoutils.cpp:209
VideoMetadataImp::GetCategoryID
int GetCategoryID() const
Definition: videometadata.cpp:267
MultiValue::entry
Definition: dbaccess.h:40
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:827
ClearMap
void ClearMap(InfoMap &metadataMap)
Definition: videometadata.cpp:1283
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