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 <QRegExp>
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 
25 {
26  public:
30 
31  public:
32  VideoMetadataImp(QString filename, QString sortFilename,
33  QString hash, QString trailer,
34  QString coverfile, QString screenshot, QString banner,
35  QString fanart, const QString &title, QString sortTitle,
36  const QString &subtitle, QString sortSubtitle,
37  QString tagline, int year, const QDate &releasedate,
38  QString inetref, int collectionref, QString homepage,
39  QString director, QString studio,
40  QString plot, float userrating,
41  QString rating, int length, int playcount,
42  int season, int episode, const QDate &insertdate,
43  int id, ParentalLevel::Level showlevel, int categoryID,
44  int childID, bool browse, bool watched,
45  QString playcommand, QString category,
48  cast_list cast,
49  QString host = "",
50  bool processed = false,
51  VideoContentType contenttype = kContentUnknown) :
52  m_title(title), m_sortTitle(std::move(sortTitle)), m_subtitle(subtitle),
53  m_sortSubtitle(std::move(sortSubtitle)), m_tagline(std::move(tagline)),
54  m_inetref(std::move(inetref)), m_collectionref(collectionref),
55  m_homepage(std::move(homepage)), m_director(std::move(director)),
56  m_studio(std::move(studio)), m_plot(std::move(plot)),
57  m_rating(std::move(rating)), m_playcommand(std::move(playcommand)),
58  m_category(std::move(category)), m_genres(std::move(genres)),
59  m_countries(std::move(countries)), m_cast(std::move(cast)),
60  m_filename(std::move(filename)), m_sortFilename(std::move(sortFilename)),
61  m_hash(std::move(hash)), m_trailer(std::move(trailer)),
62  m_coverfile(std::move(coverfile)), m_screenshot(std::move(screenshot)),
63  m_banner(std::move(banner)), m_fanart(std::move(fanart)),
64  m_host(std::move(host)), m_categoryID(categoryID), m_childID(childID),
65  m_year(year), m_releasedate(releasedate), m_length(length), m_playcount(playcount),
66  m_season(season), m_episode(episode), m_insertdate(insertdate), m_showlevel(showlevel),
67  m_browse(browse), m_watched(watched), m_id(id),
68  m_userrating(userrating), m_processed(processed),
69  m_contenttype(contenttype)
70  {
71  // Try to glean data if none provided.
72  if (title.isEmpty() and subtitle.isEmpty()
73  and season == 0 and episode == 0)
74  {
79  }
80 
82 
84  }
85 
87  {
90  }
91 
93  {
94  *this = other;
95  }
96 
98  {
99  if (this != &rhs)
100  {
101  m_title = rhs.m_title;
102  m_sortTitle = rhs.m_sortTitle;
103  m_subtitle = rhs.m_subtitle;
105  m_tagline = rhs.m_tagline;
106  m_inetref = rhs.m_inetref;
108  m_homepage = rhs.m_homepage;
109  m_director = rhs.m_director;
110  m_studio = rhs.m_studio;
111  m_plot = rhs.m_plot;
112  m_rating = rhs.m_rating;
114  m_category = rhs.m_category;
115  m_genres = rhs.m_genres;
116  m_countries = rhs.m_countries;
117  m_cast = rhs.m_cast;
118  m_filename = rhs.m_filename;
120  m_hash = rhs.m_hash;
121  m_trailer = rhs.m_trailer;
122  m_coverfile = rhs.m_coverfile;
124  m_banner = rhs.m_banner;
125  m_fanart = rhs.m_fanart;
126 
128  m_childID = rhs.m_childID;
129  m_year = rhs.m_year;
131  m_length = rhs.m_length;
132  m_playcount = rhs.m_playcount;
133  m_season = rhs.m_season;
134  m_episode = rhs.m_episode;
136  m_showlevel = rhs.m_showlevel;
137  m_browse = rhs.m_browse;
138  m_watched = rhs.m_watched;
139  m_id = rhs.m_id;
141  m_host = rhs.m_host;
142  m_processed = rhs.m_processed;
144 
145  // No DB vars
146  m_prefix = rhs.m_prefix;
147 
149  }
150 
151  return *this;
152  }
153 
154  void ensureSortFields(void)
155  {
156  std::shared_ptr<MythSortHelper>sh = getMythSortHelper();
157  if (m_sortTitle.isEmpty() and not m_title.isEmpty())
158  m_sortTitle = sh->doTitle(m_title);
159  if (m_sortSubtitle.isEmpty() and not m_subtitle.isEmpty())
160  m_sortSubtitle = sh->doTitle(m_subtitle);
161  if (m_sortFilename.isEmpty() and not m_filename.isEmpty())
162  m_sortFilename = sh->doPathname(m_filename);
163  }
164 
165  public:
166  const QString &GetPrefix() const { return m_prefix; }
167  void SetPrefix(const QString &prefix) { m_prefix = prefix; }
168 
169  const QString &getTitle() const { return m_title; }
170  const QString &getSortTitle() const { return m_sortTitle; }
171  void SetTitle(const QString& title, const QString& sortTitle = "")
172  {
173  m_title = title;
174  m_sortTitle = sortTitle;
176  }
177 
178  const QString &getSubtitle() const { return m_subtitle; }
179  const QString &getSortSubtitle() const { return m_sortSubtitle; }
180  void SetSubtitle(const QString &subtitle, const QString &sortSubtitle = "") {
181  m_subtitle = subtitle;
182  m_sortSubtitle = sortSubtitle;
184  }
185 
186  const QString &GetTagline() const { return m_tagline; }
187  void SetTagline(const QString &tagline) { m_tagline = tagline; }
188 
189  const QString &GetInetRef() const { return m_inetref; }
190  void SetInetRef(const QString &inetRef) { m_inetref = inetRef; }
191 
192  int GetCollectionRef() const { return m_collectionref; }
193  void SetCollectionRef(int collectionref) { m_collectionref = collectionref; }
194 
195  const QString &GetHomepage() const { return m_homepage; }
196  void SetHomepage(const QString &homepage) { m_homepage = homepage; }
197 
198  const QString &getDirector() const { return m_director; }
199  void SetDirector(const QString &director) { m_director = director; }
200 
201  const QString &getStudio() const { return m_studio; }
202  void SetStudio(const QString &studio) { m_studio = studio; }
203 
204  const QString &getPlot() const { return m_plot; }
205  void SetPlot(const QString &plot) { m_plot = plot; }
206 
207  const QString &GetRating() const { return m_rating; }
208  void SetRating(const QString &rating) { m_rating = rating; }
209 
210  const QString &getPlayCommand() const { return m_playcommand; }
211  void SetPlayCommand(const QString &playCommand)
212  {
213  m_playcommand = playCommand;
214  }
215 
216  const QString &GetCategory() const { return m_category; }
217 // void SetCategory(const QString &category) { m_category = category; }
218 
219  const genre_list &getGenres() const { return m_genres; }
221 
222  const country_list &GetCountries() const { return m_countries; }
224  {
226  }
227 
228  const cast_list &GetCast() const { return m_cast; }
229  void SetCast(const cast_list &cast) { m_cast = cast; }
230 
231  const QString &GetHost() const { return m_host; }
232  void SetHost(const QString &host) { m_host = host; }
233 
234  const QString &getFilename() const { return m_filename; }
235  const QString &getSortFilename() const { return m_sortFilename; }
236  void SetFilename(const QString &filename, const QString &sortFilename = "")
237  {
239  m_sortFilename = sortFilename;
241  }
242 
243  bool sortBefore(const VideoMetadataImp *rhs) const;
244 
245  const QString &GetHash() const { return m_hash; }
246  void SetHash(const QString &hash) { m_hash = hash; }
247 
248  const QString &GetTrailer() const { return m_trailer; }
249  void SetTrailer(const QString &trailer) { m_trailer = trailer; }
250 
251  const QString &GetCoverFile() const { return m_coverfile; }
252  void SetCoverFile(const QString &coverFile) { m_coverfile = coverFile; }
253 
254  const QString &GetScreenshot() const { return m_screenshot; }
255  void SetScreenshot(const QString &screenshot) { m_screenshot = screenshot; }
256 
257  const QString &GetBanner() const { return m_banner; }
258  void SetBanner(const QString &banner) { m_banner = banner; }
259 
260  const QString &GetFanart() const { return m_fanart; }
261  void SetFanart(const QString &fanart) { m_fanart = fanart; }
262 
263  int GetCategoryID() const
264  {
265  return m_categoryID;
266  }
267  void SetCategoryID(int id);
268 
269  int GetChildID() const { return m_childID; }
270  void SetChildID(int childID) { m_childID = childID; }
271 
272  int getYear() const { return m_year; }
273  void SetYear(int year) { m_year = year; }
274 
275  QDate getReleaseDate() const { return m_releasedate; }
276  void SetReleaseDate(QDate releasedate) { m_releasedate = releasedate; }
277 
278  int GetLength() const { return m_length; }
279  void SetLength(int length) { m_length = length; }
280 
281  unsigned int GetPlayCount() const { return m_playcount; }
282  void SetPlayCount(int playcount) { m_playcount = playcount; }
283 
284  int GetSeason() const { return m_season; }
285  void SetSeason(int season) { m_season = season; }
286 
287  int GetEpisode() const { return m_episode; }
288  void SetEpisode(int episode) { m_episode = episode; }
289 
290  QDate GetInsertdate() const { return m_insertdate;}
291  void SetInsertdate(QDate date) { m_insertdate = date;}
292 
295  {
296  m_showlevel = ParentalLevel(showLevel).GetLevel();
297  }
298 
299  bool GetBrowse() const { return m_browse; }
300  void SetBrowse(bool browse) { m_browse = browse; }
301 
302  bool GetWatched() const { return m_watched; }
303  void SetWatched(bool watched) { m_watched = watched; }
304 
305  unsigned int GetID() const { return m_id; }
306  void SetID(int id) { m_id = id; }
307 
308  float GetUserRating() const { return m_userrating; }
309  void SetUserRating(float userRating) { m_userrating = userRating; }
310 
311  bool GetProcessed() const { return m_processed; }
312  void SetProcessed(bool processed) { m_processed = processed; }
313 
315  void SetContentType(VideoContentType contenttype) { m_contenttype = contenttype; }
316 
318 
319  void SaveToDatabase();
320  void UpdateDatabase();
321  bool DeleteFromDatabase();
322 
323  bool DeleteFile();
324 
325  void Reset();
326 
327  bool IsHostSet() const;
328 
329  void GetImageMap(InfoMap &imageMap) const;
330 
331  private:
332  void fillCountries();
333  void updateCountries();
334  void fillGenres();
335  void fillCast();
336  void updateGenres();
337  void updateCast();
338  bool removeDir(const QString &dirName);
339  void fromDBRow(MSqlQuery &query);
340  void saveToDatabase();
341 
342  private:
343  QString m_title;
344  QString m_sortTitle;
345  QString m_subtitle;
346  QString m_sortSubtitle;
347  QString m_tagline;
348  QString m_inetref;
350  QString m_homepage;
351  QString m_director;
352  QString m_studio;
353  QString m_plot;
354  QString m_rating;
355  QString m_playcommand;
356  QString m_category;
360  QString m_filename;
361  QString m_sortFilename;
362  QString m_hash;
363  QString m_trailer;
364  QString m_coverfile;
365  QString m_screenshot;
366  QString m_banner;
367  QString m_fanart;
368  QString m_host;
369 
370  int m_categoryID {0};
371  int m_childID {-1};
374  int m_length {0};
375  int m_playcount {0};
376  int m_season {0};
377  int m_episode {0};
380  bool m_browse {true};
381  bool m_watched {false};
382  unsigned int m_id {0}; // videometadata.intid
383  float m_userrating {0.0};
384  bool m_processed {false};
386 
387  // not in DB
388  QString m_prefix;
389 };
390 
394 
398 {
399  int ret = naturalCompare(m_sortTitle, rhs->m_sortTitle);
400  if (ret != 0)
401  return (ret == -1);
403  if (ret != 0)
404  return (ret == -1);
405  return (m_id < rhs->m_id);
406 }
407 
408 bool VideoMetadataImp::removeDir(const QString &dirName)
409 {
410  QDir d(dirName);
411 
412  d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
413  QFileInfoList contents = d.entryInfoList();
414  if (contents.empty())
415  {
416  return d.rmdir(dirName);
417  }
418 
419  for (const auto& entry : qAsConst(contents))
420  {
421  if (entry.isDir())
422  {
423  QString fileName = entry.fileName();
424  if (!removeDir(fileName))
425  return false;
426  }
427  else
428  {
429  if (!QFile(entry.fileName()).remove())
430  return false;
431  }
432  }
433  return d.rmdir(dirName);
434 }
435 
438 {
439  bool isremoved = false;
440 
441  if (!m_host.isEmpty())
442  {
443  QString url = generate_file_url("Videos", m_host, m_filename);
444  isremoved = RemoteFile::DeleteFile(url);
445  }
446  else
447  {
448  QFileInfo fi(m_filename);
449  if (fi.isDir())
450  {
451  isremoved = removeDir(m_filename);
452  }
453  else
454  {
455  isremoved = QFile::remove(m_filename);
456  }
457  }
458 
459  if (!isremoved)
460  {
461  LOG(VB_GENERAL, LOG_DEBUG, QString("Could not delete file: %1")
462  .arg(m_filename));
463  }
464 
465  return isremoved;
466 }
467 
469 {
470  VideoMetadataImp tmp(m_filename, QString(),
473  VIDEO_FANART_DEFAULT, QString(), QString(), QString(), QString(),
474  QString(), VIDEO_YEAR_DEFAULT,
475  QDate(), VIDEO_INETREF_DEFAULT, -1, QString(), VIDEO_DIRECTOR_DEFAULT,
476  QString(), VIDEO_PLOT_DEFAULT, 0.0,
477  VIDEO_RATING_DEFAULT, 0, 0,
478  0, 0, QDate(), m_id,
479  ParentalLevel::plLowest, 0, -1, true, false, "", "",
481  VideoMetadata::cast_list(), m_host, false);
482  tmp.m_prefix = m_prefix;
483 
484  *this = tmp;
485 }
486 
488 {
489  return !m_host.isEmpty();
490 }
491 
493 {
494  m_genres.clear();
497  if (vgm.get(m_id, genres))
498  {
500  for (long value : genres.values)
501  {
502  // Just add empty string for no-name genres
503  QString name;
504  vg.get(value, name);
505  m_genres.push_back(genre_list::value_type(value, name));
506  }
507  }
508 }
509 
511 {
512  m_countries.clear();
515  if (vcm.get(m_id, countries))
516  {
518  for (long value : countries.values)
519  {
520  // Just add empty string for no-name countries
521  QString name;
522  vc.get(value, name);
523  m_countries.push_back(country_list::value_type(value, name));
524  }
525  }
526 }
527 
529 {
530  m_cast.clear();
532  VideoCastMap::entry cast;
533  if (vcm.get(m_id, cast))
534  {
536  for (long value : cast.values)
537  {
538  // Just add empty string for no-name cast
539  QString name;
540  vc.get(value, name);
541  m_cast.push_back(cast_list::value_type(value, name));
542  }
543  }
544 }
545 
551 {
552  m_title = query.value(0).toString();
553  m_director = query.value(1).toString();
554  m_studio = query.value(2).toString();
555  m_plot = query.value(3).toString();
556  m_rating = query.value(4).toString();
557  m_year = query.value(5).toInt();
558  m_releasedate = query.value(6).toDate();
559  m_userrating = (float)query.value(7).toDouble();
560  if (std::isnan(m_userrating) || m_userrating < 0)
561  m_userrating = 0.0;
562  if (m_userrating > 10.0F)
563  m_userrating = 10.0F;
564  m_length = query.value(8).toInt();
565  m_playcount = query.value(9).toInt();
566  m_filename = query.value(10).toString();
567  m_hash = query.value(11).toString();
568  m_showlevel = ParentalLevel(query.value(12).toInt()).GetLevel();
569  m_coverfile = query.value(13).toString();
570  m_inetref = query.value(14).toString();
571  m_collectionref = query.value(15).toUInt();
572  m_homepage = query.value(16).toString();
573  m_childID = query.value(17).toUInt();
574  m_browse = query.value(18).toBool();
575  m_watched = query.value(19).toBool();
576  m_playcommand = query.value(20).toString();
577  m_categoryID = query.value(21).toInt();
578  m_id = query.value(22).toInt();
579  m_trailer = query.value(23).toString();
580  m_screenshot = query.value(24).toString();
581  m_banner = query.value(25).toString();
582  m_fanart = query.value(26).toString();
583  m_subtitle = query.value(27).toString();
584  m_tagline = query.value(28).toString();
585  m_season = query.value(29).toInt();
586  m_episode = query.value(30).toInt();
587  m_host = query.value(31).toString();
588  m_insertdate = query.value(32).toDate();
589  m_processed = query.value(33).toBool();
590 
592 
594 
596 
597  // Genres
598  fillGenres();
599 
600  //Countries
601  fillCountries();
602 
603  // Cast
604  fillCast();
605 }
606 
608 {
609  if (m_title.isEmpty())
611  if (m_hash.isEmpty())
613  if (m_subtitle.isEmpty())
615  if (m_director.isEmpty())
617  if (m_plot.isEmpty())
619  if (m_rating.isEmpty())
622 
623  InfoMap metadataMap;
624  GetImageMap(metadataMap);
625  QString coverfile = metadataMap["coverfile"];
626  QString screenshot = metadataMap["screenshotfile"];
627  QString bannerfile = metadataMap["bannerfile"];
628  QString fanartfile = metadataMap["fanartfile"];
629 
630  if (coverfile.isEmpty() || !RemoteFile::Exists(coverfile))
632  if (screenshot.isEmpty() || !RemoteFile::Exists(screenshot))
634  if (bannerfile.isEmpty() || !RemoteFile::Exists(bannerfile))
636  if (fanartfile.isEmpty() || !RemoteFile::Exists(fanartfile))
638  if (m_trailer.isEmpty())
640  if (m_inetref.isEmpty())
642  if (std::isnan(m_userrating))
643  m_userrating = 0.0;
644  if (m_userrating < -10.0F || m_userrating > 10.0F)
645  m_userrating = 0.0;
646  if (m_releasedate.toString().isEmpty())
647  m_releasedate = QDate::fromString("0000-00-00", "YYYY-MM-DD");
649  {
650  if (m_season > 0 || m_episode > 0)
652  else
654  }
655 
656  bool inserting = m_id == 0;
657 
659 
660  if (inserting)
661  {
662  m_browse = true;
663 
664  m_watched = false;
665 
666  query.prepare("INSERT INTO videometadata (title,subtitle,tagline,director,studio,plot,"
667  "rating,year,userrating,length,season,episode,filename,hash,"
668  "showlevel,coverfile,inetref,homepage,browse,watched,trailer,"
669  "screenshot,banner,fanart,host,processed,contenttype) VALUES (:TITLE, :SUBTITLE, "
670  ":TAGLINE, :DIRECTOR, :STUDIO, :PLOT, :RATING, :YEAR, :USERRATING, "
671  ":LENGTH, :SEASON, :EPISODE, :FILENAME, :HASH, :SHOWLEVEL, "
672  ":COVERFILE, :INETREF, :HOMEPAGE, :BROWSE, :WATCHED, "
673  ":TRAILER, :SCREENSHOT, :BANNER, :FANART, :HOST, :PROCESSED, :CONTENTTYPE)");
674  }
675  else
676  {
677  query.prepare("UPDATE videometadata SET title = :TITLE, subtitle = :SUBTITLE, "
678  "tagline = :TAGLINE, director = :DIRECTOR, studio = :STUDIO, "
679  "plot = :PLOT, rating= :RATING, year = :YEAR, "
680  "releasedate = :RELEASEDATE, userrating = :USERRATING, "
681  "length = :LENGTH, playcount = :PLAYCOUNT, season = :SEASON, "
682  "episode = :EPISODE, filename = :FILENAME, hash = :HASH, trailer = :TRAILER, "
683  "showlevel = :SHOWLEVEL, coverfile = :COVERFILE, "
684  "screenshot = :SCREENSHOT, banner = :BANNER, fanart = :FANART, "
685  "inetref = :INETREF, collectionref = :COLLECTION, homepage = :HOMEPAGE, "
686  "browse = :BROWSE, watched = :WATCHED, host = :HOST, playcommand = :PLAYCOMMAND, "
687  "childid = :CHILDID, category = :CATEGORY, processed = :PROCESSED, "
688  "contenttype = :CONTENTTYPE WHERE intid = :INTID");
689 
690  query.bindValue(":PLAYCOMMAND", m_playcommand);
691  query.bindValue(":CHILDID", m_childID);
692  query.bindValue(":CATEGORY", m_categoryID);
693  query.bindValue(":INTID", m_id);
694  }
695 
696  query.bindValue(":TITLE", m_title.isNull() ? "" : m_title);
697  query.bindValue(":SUBTITLE", m_subtitle.isNull() ? "" : m_subtitle);
698  query.bindValue(":TAGLINE", m_tagline);
699  query.bindValue(":DIRECTOR", m_director.isNull() ? "" : m_director);
700  query.bindValue(":STUDIO", m_studio);
701  query.bindValue(":PLOT", m_plot);
702  query.bindValue(":RATING", m_rating.isNull() ? "" : m_rating);
703  query.bindValue(":YEAR", m_year);
704  query.bindValue(":RELEASEDATE", m_releasedate);
705  query.bindValue(":USERRATING", m_userrating);
706  query.bindValue(":LENGTH", m_length);
707  query.bindValue(":PLAYCOUNT", m_playcount);
708  query.bindValue(":SEASON", m_season);
709  query.bindValue(":EPISODE", m_episode);
710  query.bindValue(":FILENAME", m_filename);
711  query.bindValue(":HASH", m_hash);
712  query.bindValue(":TRAILER", m_trailer.isNull() ? "" : m_trailer);
713  query.bindValue(":SHOWLEVEL", m_showlevel);
714  query.bindValue(":COVERFILE", m_coverfile.isNull() ? "" : m_coverfile);
715  query.bindValue(":SCREENSHOT", m_screenshot.isNull() ? "" : m_screenshot);
716  query.bindValue(":BANNER", m_banner.isNull() ? "" : m_banner);
717  query.bindValue(":FANART", m_fanart.isNull() ? "" : m_fanart);
718  query.bindValue(":INETREF", m_inetref.isNull() ? "" : m_inetref);
719  query.bindValue(":COLLECTION", m_collectionref);
720  query.bindValue(":HOMEPAGE", m_homepage.isNull() ? "" : m_homepage);
721  query.bindValue(":BROWSE", m_browse);
722  query.bindValue(":WATCHED", m_watched);
723  query.bindValue(":HOST", m_host);
724  query.bindValue(":PROCESSED", m_processed);
726 
727  if (!query.exec() || !query.isActive())
728  {
729  MythDB::DBError("video metadata update", query);
730  return;
731  }
732 
733  if (inserting)
734  {
735  // Must make sure we have 'id' filled before we call updateGenres or
736  // updateCountries
737 
738  if (!query.exec("SELECT LAST_INSERT_ID()") || !query.next())
739  {
740  MythDB::DBError("metadata id get", query);
741  return;
742  }
743 
744  m_id = query.value(0).toUInt();
745 
746  if (0 == m_id)
747  {
748  LOG(VB_GENERAL, LOG_ERR,
749  QString("%1: The id of the last inserted row to "
750  "videometadata seems to be 0. This is odd.")
751  .arg(__FILE__));
752  return;
753  }
754  }
755 
756  updateGenres();
757  updateCountries();
758  updateCast();
759 }
760 
762 {
763  saveToDatabase();
764 }
765 
767 {
768  saveToDatabase();
769 }
770 
772 {
776 
778  query.prepare("DELETE FROM videometadata WHERE intid = :ID");
779  query.bindValue(":ID", m_id);
780  if (!query.exec())
781  {
782  MythDB::DBError("delete from videometadata", query);
783  }
784 
785  query.prepare("DELETE FROM filemarkup WHERE filename = :FILENAME");
786  query.bindValue(":FILENAME", m_filename);
787  if (!query.exec())
788  {
789  MythDB::DBError("delete from filemarkup", query);
790  }
791 
792  return true;
793 }
794 
796 {
797  if (id == 0)
798  {
799  m_category = "";
800  m_categoryID = id;
801  }
802  else
803  {
804  if (m_categoryID != id)
805  {
806  QString cat;
808  {
809  m_category = cat;
810  m_categoryID = id;
811  }
812  else
813  {
814  LOG(VB_GENERAL, LOG_ERR, "Unknown category id");
815  }
816  }
817  }
818 }
819 
821 {
823 
824  // ensure that all genres we have are in the DB
825  auto genre = m_genres.begin();
826  while (genre != m_genres.end())
827  {
828  if (!genre->second.trimmed().isEmpty())
829  {
830  genre->first = VideoGenre::getGenre().add(genre->second);
831  VideoGenreMap::getGenreMap().add(m_id, genre->first);
832  ++genre;
833  }
834  else
835  {
836  genre = m_genres.erase(genre);
837  }
838  }
839 }
840 
842 {
843  // remove countries for this video
845 
846  auto country = m_countries.begin();
847  while (country != m_countries.end())
848  {
849  if (!country->second.trimmed().isEmpty())
850  {
851  country->first = VideoCountry::getCountry().add(country->second);
852  VideoCountryMap::getCountryMap().add(m_id, country->first);
853  ++country;
854  }
855  else
856  {
857  country = m_countries.erase(country);
858  }
859  }
860 }
861 
863 {
865 
866  // ensure that all cast we have are in the DB
867  auto cast = m_cast.begin();
868  while (cast != m_cast.end())
869  {
870  if (!cast->second.trimmed().isEmpty())
871  {
872  cast->first = VideoCast::GetCast().add(cast->second);
873  VideoCastMap::getCastMap().add(m_id, cast->first);
874  ++cast;
875  }
876  else
877  {
878  cast = m_cast.erase(cast);
879  }
880  }
881 }
882 
884 {
885  QString coverfile;
886  if (IsHostSet()
887  && !GetCoverFile().startsWith("/")
888  && !GetCoverFile().isEmpty()
890  {
891  coverfile = generate_file_url("Coverart", GetHost(),
892  GetCoverFile());
893  }
894  else
895  {
896  coverfile = GetCoverFile();
897  }
898 
899  imageMap["coverfile"] = coverfile;
900  imageMap["coverart"] = coverfile;
901 
902  QString screenshotfile;
903  if (IsHostSet() && !GetScreenshot().startsWith("/")
904  && !GetScreenshot().isEmpty())
905  {
906  screenshotfile = generate_file_url("Screenshots",
907  GetHost(), GetScreenshot());
908  }
909  else
910  {
911  screenshotfile = GetScreenshot();
912  }
913 
914  imageMap["screenshotfile"] = screenshotfile;
915  imageMap["screenshot"] = screenshotfile;
916 
917  QString bannerfile;
918  if (IsHostSet() && !GetBanner().startsWith("/")
919  && !GetBanner().isEmpty())
920  {
921  bannerfile = generate_file_url("Banners", GetHost(),
922  GetBanner());
923  }
924  else
925  {
926  bannerfile = GetBanner();
927  }
928 
929  imageMap["bannerfile"] = bannerfile;
930  imageMap["banner"] = bannerfile;
931 
932  QString fanartfile;
933  if (IsHostSet() && !GetFanart().startsWith("/")
934  && !GetFanart().isEmpty())
935  {
936  fanartfile = generate_file_url("Fanart", GetHost(),
937  GetFanart());
938  }
939  else
940  {
941  fanartfile = GetFanart();
942  }
943 
944  imageMap["fanartfile"] = fanartfile;
945  imageMap["fanart"] = fanartfile;
946 
947  QString smartimage = coverfile;
948  if (!screenshotfile.isEmpty () && (GetSeason() > 0 || GetEpisode() > 0))
949  smartimage = screenshotfile;
950  imageMap["smartimage"] = smartimage;
951 }
952 
956 namespace
957 {
958  QString eatBraces(const QString &title, const QString &left_brace,
959  const QString &right_brace)
960  {
961  QString ret(title);
962  bool keep_checking = true;
963 
964  while (keep_checking)
965  {
966  int left_position = ret.indexOf(left_brace);
967  int right_position = ret.indexOf(right_brace);
968  if (left_position == -1 || right_position == -1)
969  {
970  //
971  // No matching sets of these braces left.
972  //
973 
974  keep_checking = false;
975  }
976  else
977  {
978  if (left_position < right_position)
979  {
980  //
981  // We have a matching set like: ( foo )
982  //
983 
984  ret = ret.left(left_position) +
985  ret.right(ret.length() - right_position - 1);
986  }
987  else if (left_position > right_position)
988  {
989  //
990  // We have a matching set like: ) foo (
991  //
992 
993  ret = ret.left(right_position) +
994  ret.right(ret.length() - left_position - 1);
995  }
996  }
997  }
998 
999  return ret;
1000  }
1001 }
1002 
1003 int VideoMetadata::UpdateHashedDBRecord(const QString &hash,
1004  const QString &file_name,
1005  const QString &host)
1006 {
1008 
1009  query.prepare("SELECT intid,filename FROM videometadata WHERE "
1010  "hash = :HASH");
1011  query.bindValue(":HASH", hash);
1012 
1013  if (!query.exec() || !query.isActive())
1014  {
1015  MythDB::DBError("Video hashed metadata update", query);
1016  return -1;
1017  }
1018 
1019  if (!query.next())
1020  return -1;
1021 
1022  int intid = query.value(0).toInt();
1023  QString oldfilename = query.value(1).toString();
1024 
1025  query.prepare("UPDATE videometadata SET filename = :FILENAME, "
1026  "host = :HOST WHERE intid = :INTID");
1027  query.bindValue(":FILENAME", file_name);
1028  query.bindValue(":HOST", host);
1029  query.bindValue(":INTID", intid);
1030 
1031  if (!query.exec() || !query.isActive())
1032  {
1033  MythDB::DBError("Video hashed metadata update (videometadata)", query);
1034  return -1;
1035  }
1036 
1037  query.prepare("UPDATE filemarkup SET filename = :FILENAME "
1038  "WHERE filename = :OLDFILENAME");
1039  query.bindValue(":FILENAME", file_name);
1040  query.bindValue(":OLDFILENAME", oldfilename);
1041 
1042  if (!query.exec() || !query.isActive())
1043  {
1044  MythDB::DBError("Video hashed metadata update (filemarkup)", query);
1045  return -1;
1046  }
1047 
1048  return intid;
1049 }
1050 
1051 QString VideoMetadata::VideoFileHash(const QString &file_name,
1052  const QString &host)
1053 {
1054  if (host.isEmpty())
1055  return FileHash(file_name);
1056 
1058  {
1059  StorageGroup sgroup("Videos", host);
1060  QString fullname = sgroup.FindFile(file_name);
1061 
1062  return FileHash(fullname);
1063  }
1064 
1065  QString url = generate_file_url("Videos", host, file_name);
1066 
1067  return RemoteFile::GetFileHash(url);
1068 }
1069 
1070 QString VideoMetadata::FilenameToMeta(const QString &file_name, int position)
1071 {
1072  // position 1 returns title, 2 returns season,
1073  // 3 returns episode, 4 returns subtitle
1074 
1075  QString cleanFilename = file_name.left(file_name.lastIndexOf('.'));
1076  cleanFilename.replace(QRegExp("%20"), " ");
1077  cleanFilename.replace(QRegExp("_"), " ");
1078  cleanFilename.replace(QRegExp("\\."), " ");
1079 
1080  /*: Word(s) which should be recognized as "season" when parsing a video
1081  * file name. To list more than one word, separate them with a '|'.
1082  */
1083  QString season_translation = tr("Season", "Metadata file name parsing");
1084 
1085  /*: Word(s) which should be recognized as "episode" when parsing a video
1086  * file name. To list more than one word, separate them with a '|'.
1087  */
1088  QString episode_translation = tr("Episode", "Metadata file name parsing");
1089 
1090  // Primary Regexp
1091  QString separator = "(?:\\s?(?:-|/)?\\s?)?";
1092  QString regexp = QString(
1093  "^(.*[^s0-9])" // Title
1094  "%1" // optional separator
1095  "(?:s|(?:Season|%2))?" // season marker
1096  "%1" // optional separator
1097  "(\\d{1,4})" // Season
1098  "%1" // optional separator
1099  "(?:[ex/]|Episode|%3)" // episode marker
1100  "%1" // optional separator
1101  "(\\d{1,3})" // Episode
1102  "%1" // optional separator
1103  "(.*)$" // Subtitle
1104  ).arg(separator)
1105  .arg(season_translation).arg(episode_translation);
1106  QRegExp filename_parse(regexp,
1107  Qt::CaseInsensitive, QRegExp::RegExp2);
1108 
1109  // Cleanup Regexp
1110  QString regexp2 = QString("(%1(?:(?:Season|%2)%1\\d*%1)*%1)$")
1111  .arg(separator).arg(season_translation);
1112  QRegExp title_parse(regexp2, Qt::CaseInsensitive, QRegExp::RegExp2);
1113 
1114  int pos = filename_parse.indexIn(cleanFilename);
1115  if (pos > -1)
1116  {
1117  QString title = filename_parse.cap(1);
1118  QString season = filename_parse.cap(2);
1119  QString episode = filename_parse.cap(3);
1120  QString subtitle = filename_parse.cap(4);
1121 
1122  // Clean up the title
1123  int pos2 = title_parse.indexIn(title);
1124  if (pos2 > -1)
1125  title = title.left(pos2);
1126  title = title.right(title.length() -
1127  title.lastIndexOf('/') -1);
1128 
1129  // Return requested value
1130  if (position == 1 && !title.isEmpty())
1131  return title.trimmed();
1132  if (position == 2)
1133  return season.trimmed();
1134  if (position == 3)
1135  return episode.trimmed();
1136  if (position == 4)
1137  return subtitle.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 
1478 {
1479  return m_imp->GetLength();
1480 }
1481 
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  return 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 
1658 {
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 {
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 {
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:260
VideoMetadata::toMap
void toMap(InfoMap &metadataMap)
Definition: videometadata.cpp:1210
VideoMetadataImp::fillGenres
void fillGenres()
Definition: videometadata.cpp:492
MSqlQuery::isActive
bool isActive(void) const
Definition: mythdbcon.h:204
VideoMetadataImp::GetLength
int GetLength() const
Definition: videometadata.cpp:278
VideoMetadataImp::SetEpisode
void SetEpisode(int episode)
Definition: videometadata.cpp:288
MSqlQuery::next
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
Definition: mythdbcon.cpp:783
VideoMetadataImp::getStudio
const QString & getStudio() const
Definition: videometadata.cpp:201
MSqlQuery
QSqlQuery wrapper that fetches a DB connection from the connection pool.
Definition: mythdbcon.h:126
VideoMetadataImp::m_inetref
QString m_inetref
Definition: videometadata.cpp:348
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
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:384
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:1070
WatchedToState
QString WatchedToState(bool watched)
Definition: videoutils.cpp:276
VideoMetadataImp::getTitle
const QString & getTitle() const
Definition: videometadata.cpp:169
VideoMetadataImp::removeDir
bool removeDir(const QString &dirName)
Definition: videometadata.cpp:408
VideoMetadataImp::getFilename
const QString & getFilename() const
Definition: videometadata.cpp:234
VideoMetadataImp::SetScreenshot
void SetScreenshot(const QString &screenshot)
Definition: videometadata.cpp:255
VideoMetadataImp::m_homepage
QString m_homepage
Definition: videometadata.cpp:350
VideoMetadataImp::m_browse
bool m_browse
Definition: videometadata.cpp:380
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
VideoMetadataImp::SetLength
void SetLength(int length)
Definition: videometadata.cpp:279
getMythSortHelper
std::shared_ptr< MythSortHelper > getMythSortHelper(void)
Get a pointer to the MythSortHelper singleton.
Definition: mythsorthelper.cpp:132
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:186
mythdb.h
VideoMetadata::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:1627
VideoMetadataImp::getSortFilename
const QString & getSortFilename() const
Definition: videometadata.cpp:235
VideoMetadataImp::SetCast
void SetCast(const cast_list &cast)
Definition: videometadata.cpp:229
VideoCountry
Definition: dbaccess.h:77
VideoMetadataListManager
Definition: videometadatalistmanager.h:11
VideoMetadataImp::SaveToDatabase
void SaveToDatabase()
Definition: videometadata.cpp:761
VideoMetadataImp::GetSeason
int GetSeason() const
Definition: videometadata.cpp:284
intid
int intid
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1254
VideoMetadataImp::GetHomepage
const QString & GetHomepage() const
Definition: videometadata.cpp:195
VideoMetadataImp::SetCoverFile
void SetCoverFile(const QString &coverFile)
Definition: videometadata.cpp:252
RemoteFile::Exists
static bool Exists(const QString &url, struct stat *fileinfo)
Definition: remotefile.cpp:461
title
QString title
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:636
simple_ref_ptr
Definition: quicksp.h:25
VideoMetadataImp::SetFilename
void SetFilename(const QString &filename, const QString &sortFilename="")
Definition: videometadata.cpp:236
VideoMetadataImp::SetChildID
void SetChildID(int childID)
Definition: videometadata.cpp:270
VideoMetadataImp::m_tagline
QString m_tagline
Definition: videometadata.cpp:347
VideoCast
Definition: dbaccess.h:117
VideoMetadataImp::m_categoryID
int m_categoryID
Definition: videometadata.cpp:370
VideoMetadataImp::DeleteFile
bool DeleteFile()
Deletes the file associated with a metadata entry.
Definition: videometadata.cpp:437
StorageGroup::FindFile
QString FindFile(const QString &filename)
Definition: storagegroup.cpp:602
VideoMetadataImp::SetGenres
void SetGenres(const genre_list &genres)
Definition: videometadata.cpp:220
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:349
VideoMetadataImp::SetProcessed
void SetProcessed(bool processed)
Definition: videometadata.cpp:312
VideoMetadataImp::GetScreenshot
const QString & GetScreenshot() const
Definition: videometadata.cpp:254
format_season_and_episode
MPUBLIC QString format_season_and_episode(int seasEp, int digits)
Definition: programinfo.cpp:6094
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:232
VideoMetadata::SetEpisode
void SetEpisode(int episode)
Definition: videometadata.cpp:1512
VideoMetadataImp::SetPlayCommand
void SetPlayCommand(const QString &playCommand)
Definition: videometadata.cpp:211
VideoMetadata::SetBanner
void SetBanner(const QString &banner)
Definition: videometadata.cpp:1677
VideoMetadataImp::UpdateDatabase
void UpdateDatabase()
Definition: videometadata.cpp:766
VideoMetadataImp::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:231
VideoMetadata::SetUserRating
void SetUserRating(float userRating)
Definition: videometadata.cpp:1462
MSqlQuery::value
QVariant value(int i) const
Definition: mythdbcon.h:198
arg
arg(title).arg(filename).arg(doDelete))
VideoMetadataImp::m_childID
int m_childID
Definition: videometadata.cpp:371
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:261
VideoMetadataImp::sortBefore
bool sortBefore(const VideoMetadataImp *rhs) const
Returns true if the object should appear before the argument.
Definition: videometadata.cpp:397
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:273
category
QString category
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1422
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:29
VideoMetadataImp::SetWatched
void SetWatched(bool watched)
Definition: videometadata.cpp:303
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
GetDisplayLength
QString GetDisplayLength(int length)
Definition: videoutils.cpp:159
VideoMetadataImp::m_countries
country_list m_countries
Definition: videometadata.cpp:358
VideoMetadataImp::SetTagline
void SetTagline(const QString &tagline)
Definition: videometadata.cpp:187
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:357
VideoMetadataImp::m_category
QString m_category
Definition: videometadata.cpp:356
VideoMetadataImp::ensureSortFields
void ensureSortFields(void)
Definition: videometadata.cpp:154
VideoMetadata::GetCategoryID
int GetCategoryID() const
Definition: videometadata.cpp:1732
VideoMetadataImp::updateGenres
void updateGenres()
Definition: videometadata.cpp:820
VideoMetadata::GetScreenshot
const QString & GetScreenshot() const
Definition: videometadata.cpp:1662
VideoMetadataImp::SetBanner
void SetBanner(const QString &banner)
Definition: videometadata.cpp:258
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:246
VideoMetadataImp::m_coverfile
QString m_coverfile
Definition: videometadata.cpp:364
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:354
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:228
tmp
static guint32 * tmp
Definition: goom_core.cpp:31
VideoMetadataImp::m_director
QString m_director
Definition: videometadata.cpp:351
dbaccess.h
VideoMetadataImp::SetDirector
void SetDirector(const QString &director)
Definition: videometadata.cpp:199
VideoMetadataImp::GetID
unsigned int GetID() const
Definition: videometadata.cpp:305
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
VideoMetadataImp::m_sortFilename
QString m_sortFilename
Definition: videometadata.cpp:361
VideoMetadataImp::SetRating
void SetRating(const QString &rating)
Definition: videometadata.cpp:208
VideoMetadataImp::SetContentType
void SetContentType(VideoContentType contenttype)
Definition: videometadata.cpp:315
VideoMetadata::SetInsertdate
void SetInsertdate(QDate date)
Definition: videometadata.cpp:1522
VideoMetadataImp::getDirector
const QString & getDirector() const
Definition: videometadata.cpp:198
VideoGenreMap::getGenreMap
static VideoGenreMap & getGenreMap()
Definition: dbaccess.cpp:543
VideoMetadataImp::GetEpisode
int GetEpisode() const
Definition: videometadata.cpp:287
MythCoreContext::IsMasterBackend
bool IsMasterBackend(void)
is this the actual MBE process
Definition: mythcorecontext.cpp:712
VideoMetadataImp::VideoMetadataImp
VideoMetadataImp(MSqlQuery &query)
Definition: videometadata.cpp:86
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:276
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:362
VideoGenre::getGenre
static VideoGenre & getGenre()
Definition: dbaccess.cpp:515
mythlogging.h
VideoMetadataImp::GetBanner
const QString & GetBanner() const
Definition: videometadata.cpp:257
VideoMetadataImp::m_season
int m_season
Definition: videometadata.cpp:376
VideoMetadata::GetCategory
const QString & GetCategory() const
Definition: videometadata.cpp:1692
VideoMetadataImp::m_title
QString m_title
Definition: videometadata.cpp:343
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:367
VideoMetadataImp::genre_list
VideoMetadata::genre_list genre_list
Definition: videometadata.cpp:27
ParentalLevel::Level
Level
Definition: parentalcontrols.h:12
VideoMetadataImp::m_releasedate
QDate m_releasedate
Definition: videometadata.cpp:373
VideoMetadataImp::SetID
void SetID(int id)
Definition: videometadata.cpp:306
VideoMetadata::GetContentType
VideoContentType GetContentType() const
Definition: videometadata.cpp:1577
globals.h
VideoMetadataImp::fillCountries
void fillCountries()
Definition: videometadata.cpp:510
VideoMetadataImp::getPlot
const QString & getPlot() const
Definition: videometadata.cpp:204
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:299
VideoMetadata::UpdateHashedDBRecord
static int UpdateHashedDBRecord(const QString &hash, const QString &file_name, const QString &host)
Definition: videometadata.cpp:1003
GetDisplayCountries
QString GetDisplayCountries(const VideoMetadata &item)
Definition: videoutils.cpp:228
MythDB::DBError
static void DBError(const QString &where, const MSqlQuery &query)
Definition: mythdb.cpp:178
VideoMetadataImp::SetCategoryID
void SetCategoryID(int id)
Definition: videometadata.cpp:795
VideoMetadata::SaveToDatabase
void SaveToDatabase()
Definition: videometadata.cpp:1742
VideoMetadataImp::getSortSubtitle
const QString & getSortSubtitle() const
Definition: videometadata.cpp:179
VideoMetadataImp::DeleteFromDatabase
bool DeleteFromDatabase()
Definition: videometadata.cpp:771
VideoMetadata::SetLength
void SetLength(int length)
Definition: videometadata.cpp:1482
VideoMetadataImp::m_playcount
int m_playcount
Definition: videometadata.cpp:375
VideoMetadataImp::m_screenshot
QString m_screenshot
Definition: videometadata.cpp:365
hardwareprofile.scan.rating
def rating(profile, smoonURL, gate)
Definition: scan.py:39
VideoMetadataImp::SetBrowse
void SetBrowse(bool browse)
Definition: videometadata.cpp:300
VideoMetadata::GetCollectionRef
int GetCollectionRef() const
Definition: videometadata.cpp:1407
VideoMetadataImp::fromDBRow
void fromDBRow(MSqlQuery &query)
Sets metadata from a DB row.
Definition: videometadata.cpp:550
VIDEO_COVERFILE_DEFAULT
const QString VIDEO_COVERFILE_DEFAULT
Definition: globals.cpp:25
VideoMetadataImp::getGenres
const genre_list & getGenres() const
Definition: videometadata.cpp:219
VideoMetadataImp::SetCollectionRef
void SetCollectionRef(int collectionref)
Definition: videometadata.cpp:193
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:381
VideoMetadata::DeleteFromDatabase
bool DeleteFromDatabase()
Definition: videometadata.cpp:1752
VideoMetadataImp::m_sortSubtitle
QString m_sortSubtitle
Definition: videometadata.cpp:346
VIDEO_PLOT_DEFAULT
const QString VIDEO_PLOT_DEFAULT
Definition: globals.cpp:32
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, const 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, const 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
RemoteFile::GetFileHash
static QString GetFileHash(const QString &url)
Definition: remotefile.cpp:553
VideoCastMap
Definition: dbaccess.h:127
GetDisplayBrowse
QString GetDisplayBrowse(bool browse)
Definition: videoutils.cpp:167
VideoMetadataImp::m_cast
cast_list m_cast
Definition: videometadata.cpp:359
VideoMetadata::GetYear
int GetYear() const
Definition: videometadata.cpp:1377
kContentTelevision
@ kContentTelevision
Definition: metadatacommon.h:61
VideoMetadataImp::GetContentType
VideoContentType GetContentType() const
Definition: videometadata.cpp:314
VideoMetadata::GetImageMap
void GetImageMap(InfoMap &imageMap)
Definition: videometadata.cpp:1278
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
VideoCountry::getCountry
static VideoCountry & getCountry()
Definition: dbaccess.cpp:501
VideoMetadataImp::SetTitle
void SetTitle(const QString &title, const QString &sortTitle="")
Definition: videometadata.cpp:171
VideoMetadata::GetSortFilename
const QString & GetSortFilename() const
Definition: videometadata.cpp:1612
VideoMetadataImp::GetInetRef
const QString & GetInetRef() const
Definition: videometadata.cpp:189
VideoMetadataImp::m_filename
QString m_filename
Definition: videometadata.cpp:360
VideoMetadataImp::GetCountries
const country_list & GetCountries() const
Definition: videometadata.cpp:222
VideoMetadata::SetPrefix
void SetPrefix(const QString &prefix)
Definition: videometadata.cpp:1332
storagegroup.h
coverFile
QString coverFile
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:634
VideoMetadata::GetGenres
const genre_list & GetGenres() const
Definition: videometadata.cpp:1702
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:32
VideoMetadataImp::m_trailer
QString m_trailer
Definition: videometadata.cpp:363
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:1029
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:87
VideoMetadataImp::m_banner
QString m_banner
Definition: videometadata.cpp:366
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:56
VideoMetadataImp::GetPlayCount
unsigned int GetPlayCount() const
Definition: videometadata.cpp:281
VideoMetadata::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:1327
VideoMetadataImp::m_year
int m_year
Definition: videometadata.cpp:372
VideoMetadataImp::m_contenttype
VideoContentType m_contenttype
Definition: videometadata.cpp:385
VideoMetadataImp::GetChildID
int GetChildID() const
Definition: videometadata.cpp:269
VideoMetadata::FillDataFromFilename
bool FillDataFromFilename(const VideoMetadataListManager &cache)
Definition: videometadata.cpp:1774
VideoMetadataImp::SetInsertdate
void SetInsertdate(QDate date)
Definition: videometadata.cpp:291
VideoMetadataImp::SetPlot
void SetPlot(const QString &plot)
Definition: videometadata.cpp:205
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:841
VideoMetadataImp::SetUserRating
void SetUserRating(float userRating)
Definition: videometadata.cpp:309
VideoMetadataImp::m_insertdate
QDate m_insertdate
Definition: videometadata.cpp:378
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:379
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:251
VideoMetadataImp::operator=
VideoMetadataImp & operator=(const VideoMetadataImp &rhs)
Definition: videometadata.cpp:97
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:345
VideoMetadataImp::GetCategory
const QString & GetCategory() const
Definition: videometadata.cpp:216
VideoMetadataImp::SetPlayCount
void SetPlayCount(int playcount)
Definition: videometadata.cpp:282
VideoMetadataImp::GetHash
const QString & GetHash() const
Definition: videometadata.cpp:245
VideoMetadataImp::saveToDatabase
void saveToDatabase()
Definition: videometadata.cpp:607
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:308
VideoContentType
VideoContentType
Definition: metadatacommon.h:59
mythmiscutil.h
VideoMetadata::SetCoverFile
void SetCoverFile(const QString &coverFile)
Definition: videometadata.cpp:1657
countries
QDomElement countries
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:785
VideoMetadataImp::SetTrailer
void SetTrailer(const QString &trailer)
Definition: videometadata.cpp:249
VideoMetadataImp::SetHomepage
void SetHomepage(const QString &homepage)
Definition: videometadata.cpp:196
MythDate::kAddYear
@ kAddYear
Add year to string if not included.
Definition: mythdate.h:22
VideoMetadataImp::getSortTitle
const QString & getSortTitle() const
Definition: videometadata.cpp:170
mythcorecontext.h
VideoMetadataImp::getPlayCommand
const QString & getPlayCommand() const
Definition: videometadata.cpp:210
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:10
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:864
VIDEO_RATING_DEFAULT
const QString VIDEO_RATING_DEFAULT
Definition: globals.cpp:30
VideoMetadataImp::Reset
void Reset()
Definition: videometadata.cpp:468
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:377
VideoMetadataImp::GetTrailer
const QString & GetTrailer() const
Definition: videometadata.cpp:248
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:223
VideoMetadata::SetStudio
void SetStudio(const QString &studio)
Definition: videometadata.cpp:1442
VideoMetadataImp::IsHostSet
bool IsHostSet() const
Definition: videometadata.cpp:487
mythcontext.h
VideoMetadataImp::m_studio
QString m_studio
Definition: videometadata.cpp:352
VideoMetadataImp::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:166
VideoMetadataImp::SetSubtitle
void SetSubtitle(const QString &subtitle, const QString &sortSubtitle="")
Definition: videometadata.cpp:180
categoryID
int categoryID
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:633
MultiValue::remove
void remove(int id, int value)
Definition: dbaccess.cpp:455
VideoMetadataImp
Definition: videometadata.cpp:25
StorageGroup
Definition: storagegroup.h:12
VideoMetadataImp::m_prefix
QString m_prefix
Definition: videometadata.cpp:388
VideoMetadata::SetBrowse
void SetBrowse(bool browse)
Definition: videometadata.cpp:1552
VideoMetadataImp::VideoMetadataImp
VideoMetadataImp(const VideoMetadataImp &other)
Definition: videometadata.cpp:92
VideoMetadataImp::m_userrating
float m_userrating
Definition: videometadata.cpp:383
VideoMetadataImp::getReleaseDate
QDate getReleaseDate() const
Definition: videometadata.cpp:275
VideoMetadataImp::getYear
int getYear() const
Definition: videometadata.cpp:272
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:293
VideoMetadata::GetTitle
const QString & GetTitle() const
Definition: videometadata.cpp:1337
kContentMovie
@ kContentMovie
Definition: metadatacommon.h:60
VideoMetadata::SetScreenshot
void SetScreenshot(const QString &screenshot)
Definition: videometadata.cpp:1667
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:16
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:382
VideoMetadata::GetTrailer
const QString & GetTrailer() const
Definition: videometadata.cpp:1642
VideoMetadataImp::country_list
VideoMetadata::country_list country_list
Definition: videometadata.cpp:28
VideoMetadataImp::SetShowLevel
void SetShowLevel(ParentalLevel::Level showLevel)
Definition: videometadata.cpp:294
MultiValue::entry::values
values_type values
Definition: dbaccess.h:44
kContentUnknown
@ kContentUnknown
Definition: metadatacommon.h:65
MythCoreContext::IsThisHost
bool IsThisHost(const QString &addr)
is this address mapped to this host
Definition: mythcorecontext.cpp:738
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:862
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:311
VideoMetadataImp::GetInsertdate
QDate GetInsertdate() const
Definition: videometadata.cpp:290
VideoCountryMap
Definition: dbaccess.h:107
VideoMetadata::DeleteFile
bool DeleteFile()
Definition: videometadata.cpp:1790
VideoMetadata::~VideoMetadata
~VideoMetadata()
Definition: videometadata.cpp:1185
VideoMetadataImp::GetRating
const QString & GetRating() const
Definition: videometadata.cpp:207
VideoMetadata::Reset
void Reset()
Resets to default metadata.
Definition: videometadata.cpp:1795
VideoMetadataImp::GetCollectionRef
int GetCollectionRef() const
Definition: videometadata.cpp:192
VideoMetadataImp::SetInetRef
void SetInetRef(const QString &inetRef)
Definition: videometadata.cpp:190
VideoMetadata::GetTagline
const QString & GetTagline() const
Definition: videometadata.cpp:1367
VideoMetadataImp::GetWatched
bool GetWatched() const
Definition: videometadata.cpp:302
VideoMetadataImp::SetStudio
void SetStudio(const QString &studio)
Definition: videometadata.cpp:202
VideoMetadata::GetBrowse
bool GetBrowse() const
Definition: videometadata.cpp:1547
VideoMetadataImp::SetSeason
void SetSeason(int season)
Definition: videometadata.cpp:285
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:1051
VideoMetadataImp::getSubtitle
const QString & getSubtitle() const
Definition: videometadata.cpp:178
FileHash
QString FileHash(const QString &filename)
Definition: mythmiscutil.cpp:590
GetDisplayWatched
QString GetDisplayWatched(bool watched)
Definition: videoutils.cpp:179
VideoMetadataImp::m_plot
QString m_plot
Definition: videometadata.cpp:353
ParentalLevel::GetLevel
Level GetLevel() const
Definition: parentalcontrols.cpp:128
query
MSqlQuery query(MSqlQuery::InitCon())
VideoMetadata::GetPlayCount
unsigned int GetPlayCount() const
Definition: videometadata.cpp:1487
GetDisplayCast
QStringList GetDisplayCast(const VideoMetadata &item)
Definition: videoutils.cpp:235
VideoMetadataImp::m_length
int m_length
Definition: videometadata.cpp:374
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:883
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:355
VideoMetadataImp::m_sortTitle
QString m_sortTitle
Definition: videometadata.cpp:344
VideoMetadataImp::m_host
QString m_host
Definition: videometadata.cpp:368
VideoMetadataImp::SetPrefix
void SetPrefix(const QString &prefix)
Definition: videometadata.cpp:167
simple_ref_ptr::get
T * get() const
Definition: quicksp.h:73
VideoMetadataImp::fillCast
void fillCast()
Definition: videometadata.cpp:528
VideoMetadata::GetStateMap
void GetStateMap(InfoMap &stateMap) const
Definition: videometadata.cpp:1269
VideoGenreMap
Definition: dbaccess.h:97
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:263
MultiValue::entry
Definition: dbaccess.h:41
MSqlQuery::prepare
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
Definition: mythdbcon.cpp:808
VideoMetadata::GetLength
int GetLength() const
Definition: videometadata.cpp:1477
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
genres
QDomElement genres
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:810