MythTV  master
video.cpp
Go to the documentation of this file.
1 // Program Name: video.cpp
3 // Created : Apr. 21, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #include <QList>
27 #include <QFile>
28 #include <QMutex>
29 
30 #include <math.h>
31 
32 #include "video.h"
33 
34 #include "videometadata.h"
35 #include "metadatafactory.h"
36 #include "bluraymetadata.h"
37 
38 #include "compat.h"
39 #include "mythversion.h"
40 #include "mythcorecontext.h"
41 #include "storagegroup.h"
42 #include "remotefile.h"
43 #include "globals.h"
44 #include "mythdate.h"
45 #include "serviceUtil.h"
46 #include "mythmiscutil.h"
47 
49 //
51 
53  const QString &Sort,
54  bool bDescending,
55  int nStartIndex,
56  int nCount )
57 {
58  QString fields = "title,director,studio,plot,rating,year,releasedate,"
59  "userrating,length,playcount,filename,hash,showlevel,"
60  "coverfile,inetref,collectionref,homepage,childid,browse,watched,"
61  "playcommand,category,intid,trailer,screenshot,banner,fanart,"
62  "subtitle,tagline,season,episode,host,insertdate,processed,contenttype";
63 
64  QStringList sortFields = fields.split(',');
65 
67 
68  QString sql = "";
69  if (!Folder.isEmpty())
70  sql.append(" WHERE filename LIKE '" + Folder + "%'");
71 
72  sql.append(" ORDER BY ");
73  QString sort = QString(Sort.toLower());
74  if (sort == "added")
75  sql.append("insertdate");
76  else if (sort == "released")
77  sql.append("releasedate");
78  else if (sortFields.contains(sort))
79  sql.append(sort);
80  else
81  sql.append("intid");
82 
83  if (bDescending)
84  sql += " DESC";
86 
87  std::vector<VideoMetadataListManager::VideoMetadataPtr> videos(videolist.begin(), videolist.end());
88 
89  // ----------------------------------------------------------------------
90  // Build Response
91  // ----------------------------------------------------------------------
92 
93  DTC::VideoMetadataInfoList *pVideoMetadataInfos = new DTC::VideoMetadataInfoList();
94 
95  nStartIndex = (nStartIndex > 0) ? min( nStartIndex, (int)videos.size() ) : 0;
96  nCount = (nCount > 0) ? min( nCount, (int)videos.size() ) : videos.size();
97  int nEndIndex = min((nStartIndex + nCount), (int)videos.size() );
98 
99  for( int n = nStartIndex; n < nEndIndex; n++ )
100  {
101  DTC::VideoMetadataInfo *pVideoMetadataInfo = pVideoMetadataInfos->AddNewVideoMetadataInfo();
102 
103  VideoMetadataListManager::VideoMetadataPtr metadata = videos[n];
104 
105  if (metadata)
106  FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true );
107  }
108 
109  int curPage = 0, totalPages = 0;
110  if (nCount == 0)
111  totalPages = 1;
112  else
113  totalPages = (int)ceil((float)videos.size() / nCount);
114 
115  if (totalPages == 1)
116  curPage = 1;
117  else
118  {
119  curPage = (int)ceil((float)nStartIndex / nCount) + 1;
120  }
121 
122  pVideoMetadataInfos->setStartIndex ( nStartIndex );
123  pVideoMetadataInfos->setCount ( nCount );
124  pVideoMetadataInfos->setCurrentPage ( curPage );
125  pVideoMetadataInfos->setTotalPages ( totalPages );
126  pVideoMetadataInfos->setTotalAvailable( videos.size() );
127  pVideoMetadataInfos->setAsOf ( MythDate::current() );
128  pVideoMetadataInfos->setVersion ( MYTH_BINARY_VERSION );
129  pVideoMetadataInfos->setProtoVer ( MYTH_PROTO_VERSION );
130 
131  return pVideoMetadataInfos;
132 }
133 
135 //
137 
139 {
142 
143  if ( !metadata )
144  throw( QString( "No metadata found for selected ID!." ));
145 
146  DTC::VideoMetadataInfo *pVideoMetadataInfo = new DTC::VideoMetadataInfo();
147 
148  FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true );
149 
150  return pVideoMetadataInfo;
151 }
152 
154 //
156 
158 {
161  QScopedPointer<VideoMetadataListManager> mlm(new VideoMetadataListManager());
162  mlm->setList(videolist);
163  VideoMetadataListManager::VideoMetadataPtr metadata = mlm->byFilename(FileName);
164 
165  if ( !metadata )
166  throw( QString( "No metadata found for selected filename!." ));
167 
168  DTC::VideoMetadataInfo *pVideoMetadataInfo = new DTC::VideoMetadataInfo();
169 
170  FillVideoMetadataInfo ( pVideoMetadataInfo, metadata, true );
171 
172  return pVideoMetadataInfo;
173 }
174 
176 //
178 
180  const QString &Subtitle,
181  const QString &Inetref,
182  int Season,
183  int Episode,
184  const QString &GrabberType,
185  bool AllowGeneric )
186 {
187  DTC::VideoLookupList *pVideoLookups = new DTC::VideoLookupList();
188 
189  MetadataLookupList list;
190 
191  MetadataFactory *factory = new MetadataFactory(NULL);
192 
193  if (factory)
194  list = factory->SynchronousLookup(Title, Subtitle,
195  Inetref, Season, Episode,
196  GrabberType, AllowGeneric);
197 
198  if ( !list.size() )
199  return pVideoLookups;
200 
201  //MetadataLookupList is a reference counted list.
202  //it will delete all its content at its end of life
203  for( int n = 0; n < list.size(); n++ )
204  {
205  DTC::VideoLookup *pVideoLookup = pVideoLookups->AddNewVideoLookup();
206 
207  MetadataLookup *lookup = list[n];
208 
209  if (lookup)
210  {
211  pVideoLookup->setTitle(lookup->GetTitle());
212  pVideoLookup->setSubTitle(lookup->GetSubtitle());
213  pVideoLookup->setSeason(lookup->GetSeason());
214  pVideoLookup->setEpisode(lookup->GetEpisode());
215  pVideoLookup->setYear(lookup->GetYear());
216  pVideoLookup->setTagline(lookup->GetTagline());
217  pVideoLookup->setDescription(lookup->GetDescription());
218  pVideoLookup->setCertification(lookup->GetCertification());
219  pVideoLookup->setInetref(lookup->GetInetref());
220  pVideoLookup->setCollectionref(lookup->GetCollectionref());
221  pVideoLookup->setHomePage(lookup->GetHomepage());
222  pVideoLookup->setReleaseDate(
223  QDateTime(lookup->GetReleaseDate(),
224  QTime(0,0),Qt::LocalTime).toUTC());
225  pVideoLookup->setUserRating(lookup->GetUserRating());
226  pVideoLookup->setLength(lookup->GetRuntime());
227  pVideoLookup->setLanguage(lookup->GetLanguage());
228  pVideoLookup->setCountries(lookup->GetCountries());
229  pVideoLookup->setPopularity(lookup->GetPopularity());
230  pVideoLookup->setBudget(lookup->GetBudget());
231  pVideoLookup->setRevenue(lookup->GetRevenue());
232  pVideoLookup->setIMDB(lookup->GetIMDB());
233  pVideoLookup->setTMSRef(lookup->GetTMSref());
234 
235  ArtworkList coverartlist = lookup->GetArtwork(kArtworkCoverart);
236  ArtworkList::iterator c;
237  for (c = coverartlist.begin(); c != coverartlist.end(); ++c)
238  {
239  DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
240  art->setType("coverart");
241  art->setUrl((*c).url);
242  art->setThumbnail((*c).thumbnail);
243  art->setWidth((*c).width);
244  art->setHeight((*c).height);
245  }
246  ArtworkList fanartlist = lookup->GetArtwork(kArtworkFanart);
247  ArtworkList::iterator f;
248  for (f = fanartlist.begin(); f != fanartlist.end(); ++f)
249  {
250  DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
251  art->setType("fanart");
252  art->setUrl((*f).url);
253  art->setThumbnail((*f).thumbnail);
254  art->setWidth((*f).width);
255  art->setHeight((*f).height);
256  }
257  ArtworkList bannerlist = lookup->GetArtwork(kArtworkBanner);
258  ArtworkList::iterator b;
259  for (b = bannerlist.begin(); b != bannerlist.end(); ++b)
260  {
261  DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
262  art->setType("banner");
263  art->setUrl((*b).url);
264  art->setThumbnail((*b).thumbnail);
265  art->setWidth((*b).width);
266  art->setHeight((*b).height);
267  }
268  ArtworkList screenshotlist = lookup->GetArtwork(kArtworkScreenshot);
269  ArtworkList::iterator s;
270  for (s = screenshotlist.begin(); s != screenshotlist.end(); ++s)
271  {
272  DTC::ArtworkItem *art = pVideoLookup->AddNewArtwork();
273  art->setType("screenshot");
274  art->setUrl((*s).url);
275  art->setThumbnail((*s).thumbnail);
276  art->setWidth((*s).width);
277  art->setHeight((*s).height);
278  }
279  }
280  }
281 
282  pVideoLookups->setCount ( list.count() );
283  pVideoLookups->setAsOf ( MythDate::current() );
284  pVideoLookups->setVersion ( MYTH_BINARY_VERSION );
285  pVideoLookups->setProtoVer ( MYTH_PROTO_VERSION );
286 
287  delete factory;
288 
289  return pVideoLookups;
290 }
291 
293 //
295 
297 {
298  bool bResult = false;
299 
302  QScopedPointer<VideoMetadataListManager> mlm(new VideoMetadataListManager());
303  mlm->setList(videolist);
304  VideoMetadataListManager::VideoMetadataPtr metadata = mlm->byID(Id);
305 
306  if (metadata)
307  bResult = metadata->DeleteFromDatabase();
308 
309  return bResult;
310 }
311 
313 //
315 
316 bool Video::AddVideo( const QString &sFileName,
317  const QString &sHostName )
318 {
319  if ( sHostName.isEmpty() )
320  throw( QString( "Host not provided! Local storage is deprecated and "
321  "is not supported by the API." ));
322 
323  if ( sFileName.isEmpty() ||
324  (sFileName.contains("/../")) ||
325  (sFileName.startsWith("../")) )
326  {
327  throw( QString( "Filename not provided, or fails sanity checks!" ));
328  }
329 
330  StorageGroup sgroup("Videos", sHostName);
331 
332  QString fullname = sgroup.FindFile(sFileName);
333 
334  if ( !QFile::exists(fullname) )
335  throw( QString( "Provided filename does not exist!" ));
336 
337  QString hash = FileHash(fullname);
338 
339  if (hash == "NULL")
340  {
341  LOG(VB_GENERAL, LOG_ERR, "Video Hash Failed. Unless this is a DVD or "
342  "Blu-ray, something has probably gone wrong.");
343  hash = "";
344  }
345 
346  VideoMetadata newFile(sFileName, hash,
352  VideoMetadata::FilenameToMeta(sFileName, 1),
353  VideoMetadata::FilenameToMeta(sFileName, 4),
354  QString(), VIDEO_YEAR_DEFAULT,
355  QDate::fromString("0000-00-00","YYYY-MM-DD"),
356  VIDEO_INETREF_DEFAULT, 0, QString(),
358  0.0, VIDEO_RATING_DEFAULT, 0, 0,
359  VideoMetadata::FilenameToMeta(sFileName, 2).toInt(),
360  VideoMetadata::FilenameToMeta(sFileName, 3).toInt(),
361  MythDate::current().date(), 0,
363 
364  newFile.SetHost(sHostName);
365  newFile.SaveToDatabase();
366 
367  return true;
368 }
369 
371 //
373 
375  bool bWatched )
376 {
379  QScopedPointer<VideoMetadataListManager> mlm(new VideoMetadataListManager());
380  mlm->setList(videolist);
381  VideoMetadataListManager::VideoMetadataPtr metadata = mlm->byID(nId);
382 
383  if ( !metadata )
384  return false;
385 
386  metadata->SetWatched(bWatched);
387  metadata->UpdateDatabase();
388 
389  return true;
390 }
391 
393 //
395 
396 DTC::BlurayInfo* Video::GetBluray( const QString &sPath )
397 {
398  QString path = sPath;
399 
400  if (sPath.isEmpty())
401  path = gCoreContext->GetSetting( "BluRayMountpoint", "/media/cdrom");
402 
403  LOG(VB_GENERAL, LOG_NOTICE,
404  QString("Parsing Blu-ray at path: %1 ").arg(path));
405 
406  BlurayMetadata *bdmeta = new BlurayMetadata(path);
407 
408  if ( !bdmeta )
409  throw( QString( "Unable to open Blu-ray Metadata Parser!" ));
410 
411  if ( !bdmeta->OpenDisc() )
412  throw( QString( "Unable to open Blu-ray Disc/Path!" ));
413 
414  if ( !bdmeta->ParseDisc() )
415  throw( QString( "Unable to parse metadata from Blu-ray Disc/Path!" ));
416 
417  DTC::BlurayInfo *pBlurayInfo = new DTC::BlurayInfo();
418 
419  pBlurayInfo->setPath(path);
420  pBlurayInfo->setTitle(bdmeta->GetTitle());
421  pBlurayInfo->setAltTitle(bdmeta->GetAlternateTitle());
422  pBlurayInfo->setDiscLang(bdmeta->GetDiscLanguage());
423  pBlurayInfo->setDiscNum(bdmeta->GetCurrentDiscNumber());
424  pBlurayInfo->setTotalDiscNum(bdmeta->GetTotalDiscNumber());
425  pBlurayInfo->setTitleCount(bdmeta->GetTitleCount());
426  pBlurayInfo->setThumbCount(bdmeta->GetThumbnailCount());
427  pBlurayInfo->setTopMenuSupported(bdmeta->GetTopMenuSupported());
428  pBlurayInfo->setFirstPlaySupported(bdmeta->GetFirstPlaySupported());
429  pBlurayInfo->setNumHDMVTitles((uint)bdmeta->GetNumHDMVTitles());
430  pBlurayInfo->setNumBDJTitles((uint)bdmeta->GetNumBDJTitles());
431  pBlurayInfo->setNumUnsupportedTitles((uint)bdmeta->GetNumUnsupportedTitles());
432  pBlurayInfo->setAACSDetected(bdmeta->GetAACSDetected());
433  pBlurayInfo->setLibAACSDetected(bdmeta->GetLibAACSDetected());
434  pBlurayInfo->setAACSHandled(bdmeta->GetAACSHandled());
435  pBlurayInfo->setBDPlusDetected(bdmeta->GetBDPlusDetected());
436  pBlurayInfo->setLibBDPlusDetected(bdmeta->GetLibBDPlusDetected());
437  pBlurayInfo->setBDPlusHandled(bdmeta->GetBDPlusHandled());
438 
439  QStringList thumbs = bdmeta->GetThumbnails();
440  if (thumbs.size())
441  pBlurayInfo->setThumbPath(thumbs.at(0));
442 
443  delete bdmeta;
444 
445  return pBlurayInfo;
446 }
447 
449 //
451 
453  const QString &sTitle,
454  const QString &sSubTitle,
455  const QString &sTagLine,
456  const QString &sDirector,
457  const QString &sStudio,
458  const QString &sPlot,
459  const QString &sRating,
460  const QString &sInetref,
461  int nCollectionRef,
462  const QString &sHomePage,
463  int nYear,
464  const QDate &sReleasedate,
465  float fUserRating,
466  int nLength,
467  int nPlayCount,
468  int nSeason,
469  int nEpisode,
470  int nShowLevel,
471  const QString &sFileName,
472  const QString &sHash,
473  const QString &sCoverFile,
474  int nChildID,
475  bool bBrowse,
476  bool bWatched,
477  bool bProcessed,
478  const QString &sPlayCommand,
479  int nCategory,
480  const QString &sTrailer,
481  const QString &sHost,
482  const QString &sScreenshot,
483  const QString &sBanner,
484  const QString &sFanart,
485  const QDate &sInsertDate,
486  const QString &sContentType,
487  const QString &sGenres,
488  const QString &sCast,
489  const QString &sCountries)
490 {
491  bool update_required = false;
494  QScopedPointer<VideoMetadataListManager> mlm(new VideoMetadataListManager());
495  mlm->setList(videolist);
496  VideoMetadataListManager::VideoMetadataPtr metadata = mlm->byID(nId);
497 
498  if (!metadata)
499  {
500  LOG(VB_GENERAL, LOG_ERR, QString("UpdateVideoMetadata: Id=%1 not found")
501  .arg(nId));
502  return false;
503  }
504 
505  if (m_parsedParams.contains("title"))
506  {
507  metadata->SetTitle(sTitle);
508  update_required = true;
509  }
510 
511  if (m_parsedParams.contains("subtitle"))
512  {
513  metadata->SetSubtitle(sSubTitle);
514  update_required = true;
515  }
516 
517  if (m_parsedParams.contains("tagline"))
518  {
519  metadata->SetTagline(sTagLine);
520  update_required = true;
521  }
522 
523  if (m_parsedParams.contains("director"))
524  {
525  metadata->SetDirector(sDirector);
526  update_required = true;
527  }
528 
529  if (m_parsedParams.contains("studio"))
530  {
531  metadata->SetStudio(sStudio);
532  update_required = true;
533  }
534 
535  if (m_parsedParams.contains("plot"))
536  {
537  metadata->SetPlot(sPlot);
538  update_required = true;
539  }
540 
541  if (m_parsedParams.contains("userrating"))
542  {
543  metadata->SetUserRating(fUserRating);
544  update_required = true;
545  }
546 
547  if (m_parsedParams.contains("inetref"))
548  {
549  metadata->SetInetRef(sInetref);
550  update_required = true;
551  }
552 
553  if (m_parsedParams.contains("collectionref"))
554  {
555  metadata->SetCollectionRef(nCollectionRef);
556  update_required = true;
557  }
558 
559  if (m_parsedParams.contains("homepage"))
560  {
561  metadata->SetHomepage(sHomePage);
562  update_required = true;
563  }
564 
565  if (m_parsedParams.contains("year"))
566  {
567  metadata->SetYear(nYear);
568  update_required = true;
569  }
570 
571  if (m_parsedParams.contains("releasedate"))
572  {
573  metadata->SetReleaseDate(sReleasedate);
574  update_required = true;
575  }
576 
577  if (m_parsedParams.contains("rating"))
578  {
579  metadata->SetRating(sRating);
580  update_required = true;
581  }
582 
583  if (m_parsedParams.contains("length"))
584  {
585  metadata->SetLength(nLength);
586  update_required = true;
587  }
588 
589  if (m_parsedParams.contains("playcount"))
590  {
591  metadata->SetPlayCount(nPlayCount);
592  update_required = true;
593  }
594 
595  if (m_parsedParams.contains("season"))
596  {
597  metadata->SetSeason(nSeason);
598  update_required = true;
599  }
600 
601  if (m_parsedParams.contains("episode"))
602  {
603  metadata->SetEpisode(nEpisode);
604  update_required = true;
605  }
606 
607  if (m_parsedParams.contains("showlevel"))
608  {
609  metadata->SetShowLevel(ParentalLevel::Level(nShowLevel));
610  update_required = true;
611  }
612 
613  if (m_parsedParams.contains("filename"))
614  {
615  metadata->SetFilename(sFileName);
616  update_required = true;
617  }
618 
619  if (m_parsedParams.contains("hash"))
620  {
621  metadata->SetHash(sHash);
622  update_required = true;
623  }
624 
625  if (m_parsedParams.contains("coverfile"))
626  {
627  metadata->SetCoverFile(sCoverFile);
628  update_required = true;
629  }
630 
631  if (m_parsedParams.contains("childid"))
632  {
633  metadata->SetChildID(nChildID);
634  update_required = true;
635  }
636 
637  if (m_parsedParams.contains("browse"))
638  {
639  metadata->SetBrowse(bBrowse);
640  update_required = true;
641  }
642 
643  if (m_parsedParams.contains("watched"))
644  {
645  metadata->SetWatched(bWatched);
646  update_required = true;
647  }
648 
649  if (m_parsedParams.contains("processed"))
650  {
651  metadata->SetProcessed(bProcessed);
652  update_required = true;
653  }
654 
655  if (m_parsedParams.contains("playcommand"))
656  {
657  metadata->SetPlayCommand(sPlayCommand);
658  update_required = true;
659  }
660 
661  if (m_parsedParams.contains("category"))
662  {
663  metadata->SetCategoryID(nCategory);
664  update_required = true;
665  }
666 
667  if (m_parsedParams.contains("trailer"))
668  {
669  metadata->SetTrailer(sTrailer);
670  update_required = true;
671  }
672 
673  if (m_parsedParams.contains("host"))
674  {
675  metadata->SetHost(sHost);
676  update_required = true;
677  }
678 
679  if (m_parsedParams.contains("screenshot"))
680  {
681  metadata->SetScreenshot(sScreenshot);
682  update_required = true;
683  }
684 
685  if (m_parsedParams.contains("banner"))
686  {
687  metadata->SetBanner(sBanner);
688  update_required = true;
689  }
690 
691  if (m_parsedParams.contains("fanart"))
692  {
693  metadata->SetFanart(sFanart);
694  update_required = true;
695  }
696 
697  if (m_parsedParams.contains("insertdate"))
698  {
699  metadata->SetInsertdate(sInsertDate);
700  update_required = true;
701  }
702 
703  if (m_parsedParams.contains("contenttype"))
704  {
705  // valid values for ContentType are 'MOVIE','TELEVISION','ADULT','MUSICVIDEO','HOMEVIDEO'
706  VideoContentType contentType = kContentUnknown;
707  if (sContentType == "MOVIE")
708  contentType = kContentMovie;
709 
710  if (sContentType == "TELEVISION")
711  contentType = kContentTelevision;
712 
713  if (sContentType == "ADULT")
714  contentType = kContentAdult;
715 
716  if (sContentType == "MUSICVIDEO")
717  contentType = kContentMusicVideo;
718 
719  if (sContentType == "HOMEVIDEO")
720  contentType = kContentHomeMovie;
721 
722  if (contentType != kContentUnknown)
723  {
724  metadata->SetContentType(contentType);
725  update_required = true;
726  }
727  else
728  LOG(VB_GENERAL, LOG_ERR, QString("UpdateVideoMetadata: Ignoring unknown ContentType: %1").arg(sContentType));
729  }
730 
731  if (m_parsedParams.contains("genres"))
732  {
734  QStringList genresList = sGenres.split(',', QString::SkipEmptyParts);
735 
736  for (int x = 0; x < genresList.size(); x++)
737  {
738  QString genre = genresList.at(x).simplified();
739  genres.push_back(VideoMetadata::genre_list::value_type(-1, genre));
740  }
741 
742  metadata->SetGenres(genres);
743  update_required = true;
744  }
745 
746  if (m_parsedParams.contains("cast"))
747  {
749  QStringList castList = sCast.split(',', QString::SkipEmptyParts);
750 
751  for (int x = 0; x < castList.size(); x++)
752  {
753  QString castName = castList.at(x).simplified();
754  cast.push_back(VideoMetadata::cast_list::value_type(-1, castName));
755  }
756 
757  metadata->SetCast(cast);
758  update_required = true;
759  }
760 
761  if (m_parsedParams.contains("countries"))
762  {
763  VideoMetadata::country_list countries;
764  QStringList countryList = sCountries.split(',', QString::SkipEmptyParts);
765 
766  for (int x = 0; x < countryList.size(); x++)
767  {
768  QString country = countryList.at(x).simplified();
769  countries.push_back(VideoMetadata::country_list::value_type(-1, country));
770  }
771 
772  metadata->SetCountries(countries);
773  update_required = true;
774  }
775 
776  if (update_required == true)
777  metadata->UpdateDatabase();
778 
779  return true;
780 }
781 
783 //
std::vector< cast_entry > cast_list
Definition: videometadata.h:36
QString FileHash(QString filename)
ArtworkList GetArtwork(VideoArtworkType type) const
uint GetTotalDiscNumber(void)
const QString VIDEO_SCREENSHOT_DEFAULT
Definition: globals.cpp:27
QString GetIMDB() const
uint32_t GetNumHDMVTitles(void)
static void loadAllFromDatabase(metadata_list &items, const QString &sql="")
uint GetYear() const
QString GetAlternateTitle(void)
QString GetDescription() const
DTC::VideoMetadataInfo * GetVideo(int Id)
Definition: video.cpp:138
DTC::VideoLookupList * LookupVideo(const QString &Title, const QString &Subtitle, const QString &Inetref, int Season, int Episode, const QString &GrabberType, bool AllowGeneric)
Definition: video.cpp:179
QString GetTMSref() const
GrabberType
QList< QString > m_parsedParams
Definition: service.h:67
unsigned int uint
Definition: compat.h:136
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
std::vector< country_entry > country_list
Definition: videometadata.h:35
bool GetTopMenuSupported(void)
VideoLookup * AddNewVideoLookup()
bool ParseDisc(void)
QString GetSubtitle() const
float GetUserRating() const
uint GetSeason() const
QString GetTitle() const
unsigned char b
Definition: ParseText.cpp:340
uint GetEpisode() const
QString GetTagline() const
uint GetRevenue() const
const QString VIDEO_PLOT_DEFAULT
Definition: globals.cpp:32
bool AddVideo(const QString &FileName, const QString &HostName)
Definition: video.cpp:316
const QString VIDEO_TRAILER_DEFAULT
Definition: globals.cpp:26
bool GetAACSHandled(void)
bool GetBDPlusDetected(void)
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
QString GetSetting(const QString &key, const QString &defaultval="")
QStringList GetCountries() const
uint32_t GetNumBDJTitles(void)
DTC::VideoMetadataInfoList * GetVideoList(const QString &Folder, const QString &Sort, bool Descending, int StartIndex, int Count)
Definition: video.cpp:52
MetadataLookupList SynchronousLookup(QString title, QString subtitle, QString inetref, int season, int episode, QString grabber, bool allowgeneric=false)
bool OpenDisc(void)
QString GetLanguage() const
#define MYTH_PROTO_VERSION
Increment this whenever the MythTV network protocol changes.
Definition: mythversion.h:47
QString GetDiscLanguage(void)
static QString FilenameToMeta(const QString &file_name, int position)
std::vector< genre_entry > genre_list
Definition: videometadata.h:34
QString GetInetref() const
bool GetFirstPlaySupported(void)
bool GetAACSDetected(void)
QString GetTitle(void)
QStringList GetThumbnails(void)
QList< ArtworkInfo > ArtworkList
void SetHost(const QString &host)
std::list< VideoMetadataPtr > metadata_list
QDate GetReleaseDate() const
ArtworkItem * AddNewArtwork()
#define LOG(_MASK_, _LEVEL_, _STRING_)
Definition: mythlogging.h:38
DTC::BlurayInfo * GetBluray(const QString &Path)
Definition: video.cpp:396
void FillVideoMetadataInfo(DTC::VideoMetadataInfo *pVideoMetadataInfo, VideoMetadataListManager::VideoMetadataPtr pMetadata, bool bDetails)
const QString VIDEO_INETREF_DEFAULT
Definition: globals.cpp:24
QString FindFile(const QString &filename)
QString GetCollectionref() const
bool UpdateVideoMetadata(int Id, const QString &Title, const QString &SubTitle, const QString &TagLine, const QString &Director, const QString &Studio, const QString &Plot, const QString &Rating, const QString &Inetref, int CollectionRef, const QString &HomePage, int Year, const QDate &ReleaseDate, float UserRating, int Length, int PlayCount, int Season, int Episode, int ShowLevel, const QString &FileName, const QString &Hash, const QString &CoverFile, int ChildID, bool Browse, bool Watched, bool Processed, const QString &PlayCommand, int Category, const QString &Trailer, const QString &Host, const QString &Screenshot, const QString &Banner, const QString &Fanart, const QDate &InsertDate, const QString &ContentType, const QString &Genres, const QString &Cast, const QString &Countries)
Definition: video.cpp:452
DTC::VideoMetadataInfo * GetVideoByFileName(const QString &FileName)
Definition: video.cpp:157
QString GetHomepage() const
uint32_t GetNumUnsupportedTitles(void)
bool RemoveVideoFromDB(int Id)
Definition: video.cpp:296
const QString VIDEO_COVERFILE_DEFAULT
Definition: globals.cpp:25
#define MYTH_BINARY_VERSION
Update this whenever the plug-in ABI changes.
Definition: mythversion.h:15
uint GetTitleCount(void)
uint GetRuntime() const
bool UpdateVideoWatchedStatus(int Id, bool Watched)
Definition: video.cpp:374
uint GetCurrentDiscNumber(void)
const QString VIDEO_RATING_DEFAULT
Definition: globals.cpp:30
VideoContentType
uint GetThumbnailCount(void)
const QString VIDEO_FANART_DEFAULT
Definition: globals.cpp:29
bool GetLibBDPlusDetected(void)
const QString VIDEO_DIRECTOR_DEFAULT
Definition: globals.cpp:23
static VideoMetadataPtr loadOneFromDatabase(uint id)
QDateTime fromString(const QString &dtstr)
Converts kFilename && kISODate formats to QDateTime.
Definition: mythdate.cpp:34
uint GetPopularity() const
bool GetLibAACSDetected(void)
bool GetBDPlusHandled(void)
QString GetCertification() const
const QString VIDEO_BANNER_DEFAULT
Definition: globals.cpp:28
uint GetBudget() const