MythTV  master
videolist.cpp
Go to the documentation of this file.
1 // C++
2 #include <algorithm>
3 #include <iterator>
4 #include <map>
5 #include <utility>
6 
7 // Qt
8 #include <QFileInfo>
9 #include <QList>
10 #include <QScopedPointer>
11 
12 // MythTV
13 #include "libmyth/mythcontext.h"
14 #include "libmythbase/mythdate.h"
15 #include "libmythbase/stringutil.h"
23 
24 // MythFrontend
25 #include "upnpscanner.h"
26 #include "videodlg.h"
27 #include "videofilter.h"
28 #include "videolist.h"
29 
30 // Sorting or not sorting the metadata list doesn't seem to have any
31 // effect. The metadataViewFlat and metadataViewTree that are
32 // constructed from this list get sorted, and those are what is used
33 // to build the UI screens.
34 #undef SORT_METADATA_LIST
35 
37 {
38  public:
39  explicit TreeNodeDataPrivate(VideoMetadata *metadata) :
40  m_metadata(metadata)
41  {
42  if (m_metadata)
44  else
45  m_host = "";
46  }
47 
48  TreeNodeDataPrivate(QString path, QString host, QString prefix) :
49  m_host(std::move(host)), m_path(std::move(path)), m_prefix(std::move(prefix))
50  {
51  }
52 
54  {
55  return m_metadata;
56  }
57 
58  const VideoMetadata *GetMetadata(void) const
59  {
60  return m_metadata;
61  }
62 
63  QString GetPath(void) const
64  {
65  return m_path;
66  }
67 
68  QString GetHost(void) const
69  {
70  return m_host;
71  }
72 
73  QString GetPrefix(void) const
74  {
75  return m_prefix;
76  }
77 
78  private:
80  QString m_host;
81  QString m_path;
82  QString m_prefix;
83 };
84 
86  : m_d(new TreeNodeDataPrivate(metadata))
87 {
88 }
89 
90 TreeNodeData::TreeNodeData(QString path, QString host, QString prefix)
91 {
92  m_d = new TreeNodeDataPrivate(std::move(path), std::move(host), std::move(prefix));
93 }
94 
96 {
97  *this = other;
98 }
99 
101 {
102  if (this != &rhs)
103  {
104  delete m_d;
105  m_d = new TreeNodeDataPrivate(*rhs.m_d);
106  }
107 
108  return *this;
109 }
110 
112 {
113  delete m_d;
114 }
115 
117 {
118  if (m_d)
119  return m_d->GetMetadata();
120 
121  return nullptr;
122 }
123 
124 const VideoMetadata *TreeNodeData::GetMetadata(void) const
125 {
126  if (m_d)
127  return m_d->GetMetadata();
128 
129  return nullptr;
130 }
131 
132 QString TreeNodeData::GetPath(void) const
133 {
134  if (m_d)
135  return m_d->GetPath();
136  return {};
137 }
138 
139 QString TreeNodeData::GetHost(void) const
140 {
141  if (m_d)
142  return m_d->GetHost();
143  return {};
144 }
145 
146 QString TreeNodeData::GetPrefix(void) const
147 {
148  if (m_d)
149  return m_d->GetPrefix();
150  return {};
151 }
152 
155 {
156  explicit metadata_sort(const VideoFilterSettings &vfs) : m_vfs(vfs) {}
157 
158  bool operator()(const VideoMetadata *lhs, const VideoMetadata *rhs)
159  {
160  return m_vfs.meta_less_than(*lhs, *rhs);
161  }
162 
163  bool operator()(const smart_meta_node &lhs, const smart_meta_node &rhs)
164  {
165  return m_vfs.meta_less_than(*(lhs->getData()), *(rhs->getData()));
166  }
167 
168  private:
170 };
171 
173 {
174  explicit metadata_path_sort(void) = default;
175 
176  bool operator()(const VideoMetadata &lhs, const VideoMetadata &rhs)
177  {
178  return sort(&lhs, &rhs);
179  }
180 
181  bool operator()(const VideoMetadata *lhs, const VideoMetadata *rhs)
182  {
183  return sort(lhs, rhs);
184  }
185 
186  bool operator()(const smart_dir_node &lhs, const smart_dir_node &rhs)
187  {
188  return sort(lhs->getSortPath(), rhs->getSortPath());
189  }
190 
191  private:
192  static bool sort(const VideoMetadata *lhs, const VideoMetadata *rhs)
193  {
194  return sort(lhs->GetSortFilename(), rhs->GetSortFilename());
195  }
196 
197  static bool sort(const QString &lhs, const QString &rhs)
198  {
199  return StringUtil::naturalSortCompare(lhs, rhs);
200  }
201 };
202 
203 static QString path_to_node_name(const QString &path)
204 {
205  QString ret;
206  int slashLoc = path.lastIndexOf('/', -2) + 1;
207  if (path.endsWith("/"))
208  ret = path.mid(slashLoc, path.length() - slashLoc - 1);
209  else
210  ret = path.mid(slashLoc);
211 
212  return ret;
213 }
214 
216  meta_dir_node *dir,
217  meta_dir_node *hint = nullptr)
218 {
219  meta_dir_node *start = dir;
220  QString insert_chunk = metadata->GetFilename();
221  QString host = metadata->GetHost();
222  QString prefix = metadata->GetPrefix();
223 
224  if (hint)
225  {
226  if (metadata->GetFilename().startsWith(hint->getFQPath() + "/"))
227  {
228  start = hint;
229  insert_chunk =
230  metadata->GetFilename().mid(hint->getFQPath().length());
231  }
232  }
233 
234  if (insert_chunk.startsWith(dir->getFQPath() + "/"))
235  {
236  insert_chunk = metadata->GetFilename().mid(dir->getFQPath().length());
237  }
238 
239  QStringList path = insert_chunk.split("/", Qt::SkipEmptyParts);
240  if (path.size() > 1)
241  {
242  path.pop_back();
243  }
244  else
245  {
246  path.clear();
247  }
248 
249  for (const auto & part : std::as_const(path))
250  {
251  smart_dir_node sdn = start->addSubDir(part, "" , host, prefix);
252  start = sdn.get();
253  }
254 
255  start->addEntry(smart_meta_node(new meta_data_node(metadata)));
256 
257  return start;
258 }
259 
261 {
263  {
264  return smn->getData();
265  }
266 
268  {
269  return &data;
270  }
271 
274  {
275  return data.get();
276  }
277 };
278 
280  MythGenericTree *where_to_add,
281  const QString& name, QString fqPath, bool add_up_dirs,
282  QString host = "", QString prefix = "")
283 {
284  // Add the subdir node...
285  MythGenericTree *sub_node =
286  where_to_add->addNode(name, kSubFolder, false);
287  sub_node->SetData(QVariant::fromValue(TreeNodeData(std::move(fqPath), std::move(host), std::move(prefix))));
288  sub_node->SetText(name, "title");
289  sub_node->DisplayState("subfolder", "nodetype");
290 
291  // ...and the updir node.
292  if (add_up_dirs)
293  {
294  MythGenericTree *up_node =
295  sub_node->addNode(where_to_add->GetText(), kUpFolder,
296  true, false);
297  up_node->DisplayState("subfolder", "nodetype");
298  }
299 
300  return sub_node;
301 }
302 
303 int AddFileNode(MythGenericTree *where_to_add, const QString& name,
304  VideoMetadata *metadata)
305 {
306  MythGenericTree *sub_node = where_to_add->addNode(name, 0, true);
307  sub_node->SetData(QVariant::fromValue(TreeNodeData(metadata)));
308  sub_node->SetTextCb( &VideoMetadata::MetadataGetTextCb, metadata);
309  sub_node->SetImageCb(&VideoMetadata::MetadataGetImageCb, metadata);
310  sub_node->SetStateCb(&VideoMetadata::MetadataGetStateCb, metadata);
311 
312  // Assign images to parent node if this is the first child
313  if (where_to_add->visibleChildCount() == 1 &&
314  where_to_add->getInt() == kSubFolder)
315  {
316  InfoMap imageMap;
317  metadata->GetImageMap(imageMap);
318  where_to_add->SetImageFromMap(imageMap);
319  where_to_add->SetImage("buttonimage", imageMap["smartimage"]);
320  }
321 
322  return 1;
323 }
324 
326 {
327  public:
328  using metadata_view_list = std::vector<VideoMetadata *>;
329 
330  private:
331  enum metadata_list_type : std::uint8_t
340 
341  public:
342  VideoListImp();
343 
345  bool include_updirs);
347  bool filebrowser, bool flatlist,
348  int group_type, const ParentalLevel &parental_level,
349  bool include_updirs);
350 
351  void refreshList(bool filebrowser, const ParentalLevel &parental_level,
352  bool flat_list, int group_type);
353  bool refreshNode(MythGenericTree *node);
354 
355  unsigned int count(void) const
356  {
357  return m_metadataViewFlat.size();
358  }
359 
361  {
362  return m_videoFilter;
363  }
364 
366  {
367  m_videoFilter = filter;
368  }
369 
370  int TryFilter(const VideoFilterSettings &filter) const
371  {
372  auto list = m_metadata.getList();
373  auto filtermatch =
374  [filter](const auto & md){ return filter.matches_filter(*md); };
375  return std::count_if(list.cbegin(), list.cend(), filtermatch);
376  }
377 
379  {
380  return m_metadata;
381  }
382 
383  unsigned int getFilterChangedState(void)
384  {
386  }
387 
388  bool Delete(unsigned int video_id, VideoList &/*dummy*/)
389  {
390  bool ret = false;
391  MetadataPtr mp = m_metadata.byID(video_id);
392  if (mp)
393  {
394  ret = mp->DeleteFile();
395  if (ret)
396  {
397  ret = m_metadata.purgeByID(video_id);
398  // Force refresh
400  }
401  }
402 
403  return ret;
404  }
405 
407  {
408  return m_videoTreeRoot.data();
409  }
410 
412  // Set the type to none to avoid refreshList thinking it doesn't
413  // need to.
415 
416  metadata_list ml;
418  m_metadata.setList(ml);
419  }
420 
421  private:
422  void sort_view_data(bool flat_list);
423  void fillMetadata(metadata_list_type whence);
424 
425  void buildFsysList(void);
426  void buildGroupList(metadata_list_type whence);
427  void buildDbList(void);
428  void buildTVList(void);
429  void buildFileList(smart_dir_node &directory, metadata_list &metalist,
430  const QString &prefix) const;
431 
432  void update_meta_view(bool flat_list);
433 
434  private:
435  bool m_listUnknown {false};
436  bool m_loadMetaData {false};
437 
438  QScopedPointer <MythGenericTree> m_videoTreeRoot;
439 
441  meta_dir_node m_metadataTree; // master list for tree views
442 
445 
447 
449 };
450 
452  : m_imp(new VideoListImp)
453 {
454 }
455 
457 {
458  delete m_imp;
459 }
460 
462  bool filebrowser, bool flatlist,
463  int group_type, const ParentalLevel &parental_level,
464  bool include_updirs)
465 {
466  return m_imp->buildVideoList(filebrowser, flatlist,
467  group_type, parental_level, include_updirs);
468 }
469 
470 void VideoList::refreshList(bool filebrowser,
471  const ParentalLevel &parental_level,
472  bool flat_list, int group_type)
473 {
474  m_imp->refreshList(filebrowser, parental_level, flat_list, group_type);
475 }
476 
478 {
479  return m_imp->refreshNode(node);
480 }
481 
482 unsigned int VideoList::count(void) const
483 {
484  return m_imp->count();
485 }
486 
488 {
489  return m_imp->getCurrentVideoFilter();
490 }
491 
493 {
494  m_imp->setCurrentVideoFilter(filter);
495 }
496 
498 {
499  return m_imp->TryFilter(filter);
500 }
501 
503 {
504  return m_imp->getListCache();
505 }
506 
508 {
509  return m_imp->getFilterChangedState();
510 }
511 
512 bool VideoList::Delete(int video_id)
513 {
514  return m_imp->Delete(video_id, *this);
515 }
516 
518 {
519  return m_imp->GetTreeRoot();
520 }
521 
523 {
525 }
526 
528 // VideoListImp
530 VideoListImp::VideoListImp() : m_metadataViewTree("", "top")
531 {
532  m_listUnknown = gCoreContext->GetBoolSetting("VideoListUnknownFileTypes", false);
533 
534  m_loadMetaData = gCoreContext->GetBoolSetting("VideoTreeLoadMetaData", false);
535 }
536 
538  bool include_updirs)
539 {
540  if (src->DataIsValid())
541  {
543  dst->SetData(src->GetData());
544  return;
545  }
546 
547  for (auto dir = src->dirs_begin();
548  dir != src->dirs_end(); ++dir)
549  {
550  if ((*dir)->has_entries())
551  {
552  bool incUpDir = include_updirs;
553  // Only include upnodes when there is a parent to move up to
554  if (!dst->getParent())
555  incUpDir = false;
556 
558  dst, (*dir)->getName(),
559  (*dir)->getFQPath(), incUpDir, (*dir)->GetHost(),
560  (*dir)->GetPrefix());
561 
562  build_generic_tree(t, dir->get(), include_updirs);
563  }
564  }
565 
566  for (auto entry = src->entries_begin();
567  entry != src->entries_end(); ++entry)
568  {
569  if (((*entry)->getData()->GetSeason() > 0) ||
570  ((*entry)->getData()->GetEpisode() > 0))
571  {
572  QString seas = QString::number((*entry)->getData()->GetSeason());
573  QString ep = QString::number((*entry)->getData()->GetEpisode());
574  QString title = (*entry)->getData()->GetTitle();
575  QString subtitle = (*entry)->getData()->GetSubtitle();
576 
577  if (ep.size() < 2)
578  ep.prepend("0");
579 
580  QString displayTitle = QString("%1 %2x%3 - %4")
581  .arg(title, seas, ep, subtitle);
582 
583  if (src->getName() == title)
584  {
585  displayTitle = QString("%2x%3 - %4")
586  .arg(seas, ep, subtitle);
587  }
588  AddFileNode(dst, displayTitle, (*entry)->getData());
589  }
590  else if ((*entry)->getData()->GetSubtitle().isEmpty())
591  {
592  AddFileNode(
593  dst, (*entry)->getData()->GetTitle(), (*entry)->getData());
594  }
595  else
596  {
597  QString TitleSub = QString("%1 - %2")
598  .arg((*entry)->getData()->GetTitle(),
599  (*entry)->getData()->GetSubtitle());
600  AddFileNode(dst, TitleSub, (*entry)->getData());
601  }
602  }
603 }
604 
605 // Build a generic tree containing the video files. You can control the
606 // contents and the shape of the tree in de following ways:
607 // filebrowser:
608 // If true, the actual state of the filesystem is examined. If a video
609 // is already known to the system, this info is retrieved. If not, some
610 // basic info is provided.
611 // If false, only video information already present in the database is
612 // presented.
613 // flatlist:
614 // If true, the tree is reduced to a single level containing all the
615 // videos found.
616 // If false, the hierarchy present on the filesystem or in the database
617 // is preserved. In this mode, both sub-dirs and updirs are present.
619  bool filebrowser, bool flatlist, int group_type,
620  const ParentalLevel &parental_level, bool include_updirs)
621 {
622  refreshList(filebrowser, parental_level, flatlist, group_type);
623 
624  m_videoTreeRoot.reset(new MythGenericTree(QObject::tr("Video Home"),
625  kRootNode, false));
626 
628  include_updirs);
629 
630  if (m_metadataViewFlat.empty())
631  {
632  m_videoTreeRoot.reset(new MythGenericTree(QObject::tr("Video Home"),
633  kRootNode, false));
634  m_videoTreeRoot.data()->addNode(QObject::tr("No files found"),
635  kNoFilesFound, false);
636  }
637 
638  return m_videoTreeRoot.data();
639 }
640 
642 {
643  if (!node)
644  return false;
645 
646  // node->GetData() provides information on how/where to refresh the
647  // data for this node
648 
649  QVariant data = node->GetData();
650  if (!data.isValid())
651  return false;
652 
653  // currently only UPNPScanner can refresh data
654  if (UPNPScanner::Instance() && UPNPScanner::Instance()->GetMetadata(data))
655  {
656  // force a refresh
658  return true;
659  }
660 
661  return false;
662 }
663 
664 void VideoListImp::refreshList(bool filebrowser,
665  const ParentalLevel &parental_level,
666  bool flat_list, int group_type)
667 {
668 
669  m_videoFilter.setParentalLevel(parental_level.GetLevel());
670 
671  if (filebrowser)
672  {
674  }
675  else
676  {
677  switch (group_type)
678  {
681  LOG(VB_GENERAL, LOG_DEBUG, "Using Folder mode");
682  break;
685  LOG(VB_GENERAL, LOG_DEBUG, "Using Genre mode");
686  break;
689  LOG(VB_GENERAL, LOG_DEBUG, "Using Category mode");
690  break;
693  LOG(VB_GENERAL, LOG_DEBUG, "Using Year mode");
694  break;
697  LOG(VB_GENERAL, LOG_DEBUG, "Using Director mode");
698  break;
701  LOG(VB_GENERAL, LOG_DEBUG, "Using Studio mode");
702  break;
705  LOG(VB_GENERAL, LOG_DEBUG, "Using Cast Mode");
706  break;
709  LOG(VB_GENERAL, LOG_DEBUG, "Using User Rating Mode");
710  break;
713  LOG(VB_GENERAL, LOG_DEBUG, "Using Insert Date Mode");
714  break;
717  LOG(VB_GENERAL, LOG_DEBUG, "Using TV/Movie Mode");
718  break;
719  default:
721  break;
722  }
723  }
724  update_meta_view(flat_list);
725 }
726 
727 void VideoListImp::sort_view_data(bool flat_list)
728 {
729  if (flat_list)
730  {
731  sort(m_metadataViewFlat.begin(), m_metadataViewFlat.end(),
733  }
734  else
735  {
738  }
739 }
740 
742 {
743  if (m_metadataListType != whence)
744  {
745  m_metadataListType = whence;
746  // flush existing data
747  metadata_list ml;
748  m_metadata.setList(ml);
750 
751  switch (whence)
752  {
753  case ltFileSystem:
754  buildFsysList();
755  break;
756  case ltDBMetadata:
757  buildDbList();
758  break;
759  case ltTVMetadata:
760  buildTVList();
761  break;
762  case ltDBGenreGroup:
763  case ltDBCategoryGroup:
764  case ltDBYearGroup:
765  case ltDBDirectorGroup:
766  case ltDBStudioGroup:
767  case ltDBCastGroup:
768  case ltDBUserRatingGroup:
769  case ltDBInsertDateGroup:
770  buildGroupList(whence);
771  break;
772  case ltNone:
773  break;
774  }
775  }
776 }
777 
779 {
780  metadata_list ml;
782  m_metadata.setList(ml);
783 
784  metadata_view_list mlist;
785  mlist.reserve(m_metadata.getList().size());
786 
787  std::back_insert_iterator<metadata_view_list> mli(mlist);
788  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
789  mli, to_metadata_ptr());
790 
791 #ifdef SORT_METADATA_LIST
793  std::sort(mlist.begin(), mlist.end(), mps);
794 #endif
795 
796  using group_to_node_map = std::map<QString, meta_dir_node *>;
797  group_to_node_map gtnm;
798 
799  meta_dir_node *video_root = &m_metadataTree;
800 
801  smart_dir_node sdn1 = video_root->addSubDir("All");
802  meta_dir_node* all_group_node = sdn1.get();
803 
804  for (auto *data : mlist)
805  {
806  all_group_node->addEntry(smart_meta_node(new meta_data_node(data)));
807 
808  std::vector<QString> groups;
809  auto take_second = [](const auto& item){ return item.second; };
810 
811  switch (whence)
812  {
813  case ltDBGenreGroup:
814  {
815  const std::vector<std::pair <int, QString> >& genres =
816  data->GetGenres();
817 
818  std::transform(genres.cbegin(), genres.cend(),
819  std::back_inserter(groups), take_second);
820  break;
821  }
822  case ltDBCategoryGroup:
823  {
824  groups.push_back(data->GetCategory());
825  break;
826  }
827  case ltDBYearGroup:
828  {
829  groups.push_back(QString::number(data->GetYear()));
830  break;
831  }
832  case ltDBDirectorGroup:
833  {
834  groups.push_back(data->GetDirector());
835  break;
836  }
837  case ltDBStudioGroup:
838  {
839  groups.push_back(data->GetStudio());
840  break;
841  }
842  case ltDBCastGroup:
843  {
844  const std::vector<std::pair<int, QString> >& cast = data->GetCast();
845 
846  std::transform(cast.cbegin(), cast.cend(),
847  std::back_inserter(groups), take_second);
848  break;
849  }
850  case ltDBUserRatingGroup:
851  {
852  int i = data->GetUserRating();
853  groups.push_back(QString::number(i));
854  break;
855  }
856  case ltDBInsertDateGroup:
857  {
858  QDate date = data->GetInsertdate();
859  QString tmp = MythDate::toString(
861  groups.push_back(tmp);
862  break;
863  }
864  default:
865  {
866  LOG(VB_GENERAL, LOG_ERR, "Invalid type of grouping");
867  break;
868  }
869  }
870 
871  if (groups.empty())
872  {
873  meta_dir_node *group_node = gtnm["Unknown"];
874 
875  if (group_node == nullptr)
876  {
877  smart_dir_node sdn2 = video_root->addSubDir("Unknown");
878  group_node = sdn2.get();
879  gtnm["Unknown"] = group_node;
880  }
881 
882  group_node->addEntry(smart_meta_node(new meta_data_node(data)));
883  }
884 
885  for (const auto& item : groups)
886  {
887  meta_dir_node *group_node = gtnm[item];
888 
889  if (group_node == nullptr)
890  {
891  smart_dir_node sdn2 = video_root->addSubDir(item);
892  group_node = sdn2.get();
893  gtnm[item] = group_node;
894  }
895 
896  group_node->addEntry(smart_meta_node(new meta_data_node(data)));
897  }
898  }
899 }
900 
902 {
903  metadata_list ml;
905  m_metadata.setList(ml);
906 
907  metadata_view_list mlist;
908  mlist.reserve(m_metadata.getList().size());
909 
910  std::back_insert_iterator<metadata_view_list> mli(mlist);
911  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
912  mli, to_metadata_ptr());
913 
914 #ifdef SORT_METADATA_LIST
916  sort(mlist.begin(), mlist.end(), mps);
917 #endif
918 
919  meta_dir_node *video_root = &m_metadataTree;
920 
921  smart_dir_node sdn1 = video_root->addSubDir(QObject::tr("Television"));
922  meta_dir_node* television_node = sdn1.get();
923 
924  smart_dir_node vdn = video_root->addSubDir(QObject::tr("Movies"));
925  meta_dir_node* movie_node = vdn.get();
926 
927  for (auto & p : mlist)
928  {
929  VideoMetadata *data = p;
930 
931  if ((p->GetSeason() > 0) || (p->GetEpisode() > 0))
932  {
933  smart_dir_node sdn2 = television_node->addSubDir(p->GetTitle());
934  meta_dir_node* title_node = sdn2.get();
935 
936  smart_dir_node ssdn = title_node->addSubDir(
937  QObject::tr("Season %1").arg(p->GetSeason()));
938  meta_dir_node* season_node = ssdn.get();
939 
940  season_node->addEntry(smart_meta_node(new meta_data_node(data)));
941  }
942  else
943  {
944  movie_node->addEntry(smart_meta_node(new meta_data_node(data)));
945  }
946  }
947 }
948 
950 {
951  metadata_list ml;
953  m_metadata.setList(ml);
954 
955  metadata_view_list mlist;
956  mlist.reserve(m_metadata.getList().size());
957 
958  std::back_insert_iterator<metadata_view_list> mli(mlist);
959  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
960  mli, to_metadata_ptr());
961 
962 // print_meta_list(mlist);
963 
964 #ifdef SORT_METADATA_LIST
966  std::sort(mlist.begin(), mlist.end(), mps);
967 #endif
968 
969  // TODO: break out the prefix in the DB so this isn't needed
970  using prefix_to_node_map = std::map<QString, meta_dir_node *>;
971  prefix_to_node_map ptnm;
972 
973  QStringList dirs = GetVideoDirs();
974 
975  if (dirs.isEmpty())
976  return;
977 
978  QString test_prefix(dirs[0]);
979 
980  meta_dir_node *video_root = &m_metadataTree;
981  if (dirs.size() == 1)
982  {
983  video_root->setPathRoot();
984  video_root->setPath(test_prefix);
985  video_root->setName("videos");
986  ptnm.insert(prefix_to_node_map::value_type(test_prefix, video_root));
987  }
988 
989  for (auto & mv : mlist)
990  AddMetadataToDir(mv, video_root);
991 
992 // print_dir_tree(m_metadataTree); // AEW DEBUG
993 }
994 
996 {
997  //
998  // Fill metadata from directory structure
999  //
1000 
1001  using node_to_path_list = std::vector<std::pair<QString, QString> >;
1002 
1003  node_to_path_list node_paths;
1004 
1005  QStringList dirs = GetVideoDirs();
1006  if (dirs.size() > 1)
1007  {
1008  auto new_pl = [](const auto& dir)
1009  { return node_to_path_list::value_type(path_to_node_name(dir), dir); };
1010  std::transform(dirs.cbegin(), dirs.cend(), std::back_inserter(node_paths), new_pl);
1011  }
1012  else
1013  {
1014  node_paths.emplace_back(QObject::tr("videos"), dirs[0]);
1015  }
1016 
1017  //
1018  // Add all root-nodes to the tree.
1019  //
1020  metadata_list ml;
1021  for (auto & path : node_paths)
1022  {
1023  smart_dir_node root = m_metadataTree.addSubDir(path.second, path.first);
1024  root->setPathRoot();
1025 
1026  buildFileList(root, ml, path.second);
1027  }
1028 
1029  // retrieve any MediaServer data that may be available
1030  if (UPNPScanner::Instance())
1032 
1033  // See if we can find this filename in DB
1034  if (m_loadMetaData)
1035  {
1036  // Load the DB data so metadata lookups work
1037  // TODO: ugly, pass the list
1039  metadata_list db_metadata;
1041  mdlm.setList(db_metadata);
1042  for (auto & list : ml)
1043  list->FillDataFromFilename(mdlm);
1044  }
1045  m_metadata.setList(ml);
1046 }
1047 
1048 
1050  const VideoFilterSettings &filter)
1051 {
1052  for (auto e = src.entries_begin(); e != src.entries_end(); ++e)
1053  {
1054  if (filter.matches_filter(*((*e)->getData())))
1055  {
1056  dst.addEntry(
1057  smart_meta_node(new meta_data_node((*e)->getData())));
1058  }
1059  }
1060 }
1061 
1063  const VideoFilterSettings &filter)
1064 {
1065  copy_entries(dst, src, filter);
1066  for (auto dir = src.dirs_begin(); dir != src.dirs_end(); ++dir)
1067  {
1068  const simple_ref_ptr<meta_dir_node>& node = *dir;
1069  if (node == nullptr)
1070  continue;
1071 
1072  smart_dir_node sdn = dst.addSubDir(node->getPath(),
1073  node->getName(),
1074  node->GetHost(),
1075  node->GetPrefix(),
1076  node->GetData());
1077  copy_filtered_tree(*sdn, **dir, filter);
1078  }
1079 }
1080 
1081 void tree_view_to_flat(meta_dir_node &tree,
1084 {
1086 
1088  {
1089  tree_view_to_flat(*(sdn.get()), m_list);
1090  }
1091 
1093 };
1094 
1095 // Fills a flat view with pointers to all entries in a tree.
1098 {
1099  std::back_insert_iterator<VideoListImp::metadata_view_list> bip(flat);
1100  transform(tree.entries_begin(), tree.entries_end(), bip,
1101  to_metadata_ptr());
1102 
1103  for_each(tree.dirs_begin(), tree.dirs_end(), call_tree_flat(flat));
1104 }
1105 
1107 {
1108  m_metadataViewFlat.clear();
1109  m_metadataViewFlat.reserve(m_metadata.getList().size());
1110 
1112 
1113  if (flat_list)
1114  {
1115  for (const auto & md : m_metadata.getList())
1116  {
1117  if (m_videoFilter.matches_filter(*md))
1118  {
1119  m_metadataViewFlat.push_back(md.get());
1120  }
1121  }
1122 
1123  sort_view_data(flat_list);
1124 
1125  for (auto & md : m_metadataViewFlat)
1127  }
1128  else
1129  {
1133  m_videoFilter);
1134 
1135  sort_view_data(flat_list);
1136 
1138  }
1139 }
1140 
1142 {
1143  public:
1144  using free_list = std::list<simple_ref_ptr<DirectoryHandler> >;
1145 
1146  public:
1147  dirhandler(smart_dir_node &directory, const QString &prefix,
1149  free_list &dh_free_list, bool infer_title) :
1150  m_directory(directory), m_prefix(prefix), m_metalist(metalist),
1151  m_dhFreeList(dh_free_list), m_inferTitle(infer_title)
1152  {
1153  }
1154 
1155  DirectoryHandler *newDir(const QString &dir_name,
1156  [[maybe_unused]] const QString &fq_dir_name) override // DirectoryHandler
1157  {
1158  smart_dir_node dir = m_directory->addSubDir(dir_name);
1160  m_dhFreeList,
1161  m_inferTitle);
1162  m_dhFreeList.emplace_back(dh);
1163  return dh;
1164  }
1165 
1166  void handleFile(const QString &file_name,
1167  const QString &fq_file_name,
1168  const QString &extension)
1169  {
1170  handleFile(file_name, fq_file_name, extension, "");
1171  }
1172 
1173  void handleFile([[maybe_unused]] const QString &file_name,
1174  const QString &fq_file_name,
1175  [[maybe_unused]] const QString &extension,
1176  const QString &host) override // DirectoryHandler
1177  {
1178  const QString& file_string(fq_file_name);
1179 
1181  new VideoMetadata(file_string));
1182  QFileInfo qfi(file_string);
1183  QString title = qfi.completeBaseName();
1184  if (m_inferTitle)
1185  {
1186  QString tmptitle(VideoMetadata::FilenameToMeta(file_string, 1));
1187  if (!tmptitle.isEmpty())
1188  title = tmptitle;
1189  }
1190  myData->SetTitle(title);
1191  myData->SetPrefix(m_prefix);
1192 
1193  myData->SetHost(host);
1194  m_metalist.push_back(myData);
1195 
1196  m_directory->addEntry(new meta_data_node(myData.get()));
1197  }
1198 
1199  private:
1201  const QString &m_prefix;
1204  const bool m_inferTitle;
1205 };
1206 
1208  smart_dir_node &directory, metadata_list &metalist, const QString &prefix) const
1209 {
1212 
1214  dirhandler dh(directory, prefix, metalist, fl, false);
1215  (void) ScanVideoDirectory(
1216  directory->getFQPath(), &dh, ext_list, m_listUnknown);
1217 }
kSubFolder
@ kSubFolder
Definition: videolist.h:6
VideoListImp::ltDBMetadata
@ ltDBMetadata
Definition: videolist.cpp:332
VideoMetadata
Definition: videometadata.h:24
meta_dir_node::entries_begin
entry_iterator entries_begin()
Definition: videometadatalistmanager.cpp:417
VideoListImp::getCurrentVideoFilter
const VideoFilterSettings & getCurrentVideoFilter() const
Definition: videolist.cpp:360
VideoDialog::BRS_USERRATING
@ BRS_USERRATING
Definition: videodlg.h:44
MythDate::toString
QString toString(const QDateTime &raw_dt, uint format)
Returns formatted string representing the time.
Definition: mythdate.cpp:84
TreeNodeDataPrivate::m_prefix
QString m_prefix
Definition: videolist.cpp:82
call_tree_flat::call_tree_flat
call_tree_flat(VideoListImp::metadata_view_list &list)
Definition: videolist.cpp:1085
VideoList::getFilterChangedState
unsigned int getFilterChangedState()
Definition: videolist.cpp:507
VideoMetadata::FilenameToMeta
static QString FilenameToMeta(const QString &file_name, int position)
Definition: videometadata.cpp:1137
metadata_path_sort::sort
static bool sort(const VideoMetadata *lhs, const VideoMetadata *rhs)
Definition: videolist.cpp:192
TreeNodeDataPrivate::GetMetadata
const VideoMetadata * GetMetadata(void) const
Definition: videolist.cpp:58
TreeNodeDataPrivate
Definition: videolist.cpp:36
VideoListImp::ltFileSystem
@ ltFileSystem
Definition: videolist.cpp:332
metadata_sort::operator()
bool operator()(const VideoMetadata *lhs, const VideoMetadata *rhs)
Definition: videolist.cpp:158
VideoListImp::ltDBUserRatingGroup
@ ltDBUserRatingGroup
Definition: videolist.cpp:336
MythGenericTree::SetData
void SetData(QVariant data)
Definition: mythgenerictree.h:97
VideoListImp::metadata_list_type
metadata_list_type
Definition: videolist.cpp:331
FileAssociations::getExtensionIgnoreList
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
Definition: dbaccess.cpp:816
MythGenericTree::GetText
QString GetText(const QString &name="") const
Definition: mythgenerictree.cpp:555
dirhandler::free_list
std::list< simple_ref_ptr< DirectoryHandler > > free_list
Definition: videolist.cpp:1144
dirscan.h
dirhandler::m_inferTitle
const bool m_inferTitle
Definition: videolist.cpp:1204
VideoDialog::BRS_INSERTDATE
@ BRS_INSERTDATE
Definition: videodlg.h:44
StringUtil::naturalSortCompare
bool naturalSortCompare(const QString &a, const QString &b, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
naturalCompare as a std::sort compatible function (ignoring the third parameter, which is never used)...
Definition: stringutil.h:54
MythGenericTree::setInt
void setInt(int an_int)
Definition: mythgenerictree.h:72
meta_node::setPathRoot
void setPathRoot(bool is_root=true)
Definition: videometadatalistmanager.cpp:226
VideoMetadata::MetadataGetImageCb
static QString MetadataGetImageCb(const QString &name, void *data)
Definition: videometadata.cpp:1518
VideoMetadata::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:1834
kRootNode
@ kRootNode
Definition: videolist.h:8
meta_dir_node::GetPrefix
const QString & GetPrefix() const
Definition: videometadatalistmanager.cpp:298
TreeNodeData::TreeNodeData
TreeNodeData()=default
kNoFilesFound
@ kNoFilesFound
Definition: videolist.h:9
VideoMetadataListManager
Definition: videometadatalistmanager.h:10
UPNPScanner::GetInitialMetadata
void GetInitialMetadata(VideoMetadataListManager::metadata_list *list, meta_dir_node *node)
Definition: upnpscanner.cpp:212
VideoListImp::m_metadataTree
meta_dir_node m_metadataTree
Definition: videolist.cpp:441
VideoDialog::BRS_CAST
@ BRS_CAST
Definition: videodlg.h:43
meta_dir_node::sort
void sort(DirSort dir_sort, EntrySort entry_sort)
Definition: videometadatalistmanager.h:129
simple_ref_ptr
Definition: quicksp.h:24
metadata_path_sort
Definition: videolist.cpp:172
VideoList::refreshList
void refreshList(bool filebrowser, const ParentalLevel &parental_level, bool flat_list, int group_type)
Definition: videolist.cpp:470
call_tree_flat::operator()
void operator()(smart_dir_node &sdn)
Definition: videolist.cpp:1087
parentalcontrols.h
VideoListImp::ltTVMetadata
@ ltTVMetadata
Definition: videolist.cpp:337
metadata_sort::operator()
bool operator()(const smart_meta_node &lhs, const smart_meta_node &rhs)
Definition: videolist.cpp:163
MythGenericTree::visibleChildCount
uint visibleChildCount() const
Definition: mythgenerictree.h:101
VideoList::TryFilter
int TryFilter(const VideoFilterSettings &filter) const
Definition: videolist.cpp:497
kUpFolder
@ kUpFolder
Definition: videolist.h:7
smart_meta_node
simple_ref_ptr< meta_data_node > smart_meta_node
Definition: videometadatalistmanager.h:78
MythGenericTree::getInt
int getInt() const
Definition: mythgenerictree.h:73
kDynamicSubFolder
@ kDynamicSubFolder
Definition: videolist.h:10
meta_dir_node::dirs_end
dir_iterator dirs_end()
Definition: videometadatalistmanager.cpp:402
MythGenericTree::SetImageCb
void SetImageCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:584
MythGenericTree::GetData
QVariant GetData(void) const
Definition: mythgenerictree.h:98
VideoListImp::fillMetadata
void fillMetadata(metadata_list_type whence)
Definition: videolist.cpp:741
TreeNodeDataPrivate::GetMetadata
VideoMetadata * GetMetadata(void)
Definition: videolist.cpp:53
dirhandler::m_prefix
const QString & m_prefix
Definition: videolist.cpp:1201
meta_dir_node
Definition: videometadatalistmanager.h:83
meta_dir_node::setName
void setName(const QString &name)
Definition: videometadatalistmanager.cpp:273
MythGenericTree::SetImageFromMap
void SetImageFromMap(const InfoMap &infoMap)
Definition: mythgenerictree.cpp:578
MythGenericTree::SetTextCb
void SetTextCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:549
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39
TreeNodeDataPrivate::GetPath
QString GetPath(void) const
Definition: videolist.cpp:63
VideoMetadataListManager::getList
const metadata_list & getList() const
Definition: videometadatalistmanager.cpp:168
meta_dir_node::addEntry
void addEntry(const smart_meta_node &entry)
Definition: videometadatalistmanager.cpp:375
VideoMetadataListManager::setList
void setList(metadata_list &list)
Definition: videometadatalistmanager.cpp:162
VideoListImp::VideoListImp
VideoListImp()
Definition: videolist.cpp:530
VideoListImp::ltDBYearGroup
@ ltDBYearGroup
Definition: videolist.cpp:334
call_tree_flat::m_list
VideoListImp::metadata_view_list & m_list
Definition: videolist.cpp:1092
TreeNodeData
Definition: videolist.h:68
meta_dir_node::DataIsValid
bool DataIsValid(void) const
Definition: videometadatalistmanager.cpp:330
meta_dir_node::entries_end
entry_iterator entries_end()
Definition: videometadatalistmanager.cpp:422
to_metadata_ptr
Definition: videolist.cpp:260
metadata_path_sort::operator()
bool operator()(const smart_dir_node &lhs, const smart_dir_node &rhs)
Definition: videolist.cpp:186
MythGenericTree::SetStateCb
void SetStateCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:615
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
VideoList::InvalidateCache
void InvalidateCache()
Definition: videolist.cpp:522
VideoListImp::buildTVList
void buildTVList(void)
Definition: videolist.cpp:901
VideoList::buildVideoList
MythGenericTree * buildVideoList(bool filebrowser, bool flatlist, int group_type, const ParentalLevel &parental_level, bool include_updirs)
Definition: videolist.cpp:461
tmp
static guint32 * tmp
Definition: goom_core.cpp:26
dbaccess.h
VideoListImp::m_videoTreeRoot
QScopedPointer< MythGenericTree > m_videoTreeRoot
Definition: videolist.cpp:438
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
MythGenericTree::addNode
MythGenericTree * addNode(const QString &a_string, int an_int=0, bool selectable_flag=false, bool visible=true)
Definition: mythgenerictree.cpp:85
VideoMetadataListManager::loadAllFromDatabase
static void loadAllFromDatabase(metadata_list &items, const QString &sql="", const QString &bindValue="")
Load videometadata database into memory.
Definition: videometadatalistmanager.cpp:128
videofilter.h
TreeNodeDataPrivate::GetPrefix
QString GetPrefix(void) const
Definition: videolist.cpp:73
VideoList::VideoList
VideoList()
Definition: videolist.cpp:451
dirhandler::handleFile
void handleFile(const QString &file_name, const QString &fq_file_name, const QString &extension)
Definition: videolist.cpp:1166
TreeNodeData::GetPath
QString GetPath() const
Definition: videolist.cpp:132
to_metadata_ptr::operator()
VideoMetadata * operator()(const VideoMetadataListManager::VideoMetadataPtr &data)
Definition: videolist.cpp:272
VideoListImp::m_loadMetaData
bool m_loadMetaData
Definition: videolist.cpp:436
VideoListImp::buildFsysList
void buildFsysList(void)
Definition: videolist.cpp:995
VideoList::Delete
bool Delete(int video_id)
Definition: videolist.cpp:512
mythdate.h
VideoMetadata::GetFilename
const QString & GetFilename() const
Definition: videometadata.cpp:1814
meta_dir_node::addSubDir
smart_dir_node addSubDir(const QString &subdir, const QString &name="", const QString &host="", const QString &prefix="", const QVariant &data=QVariant())
Definition: videometadatalistmanager.cpp:335
to_metadata_ptr::operator()
VideoMetadata * operator()(VideoMetadata &data)
Definition: videolist.cpp:267
videolist.h
VideoListImp::m_metadataViewTree
meta_dir_node m_metadataViewTree
Definition: videolist.cpp:444
GetVideoDirs
QStringList GetVideoDirs()
Definition: videoutils.cpp:116
TreeNodeData::GetMetadata
VideoMetadata * GetMetadata()
Definition: videolist.cpp:116
hardwareprofile.config.p
p
Definition: config.py:33
meta_node::getFQPath
const QString & getFQPath()
Definition: videometadatalistmanager.cpp:202
VideoListImp::ltDBGenreGroup
@ ltDBGenreGroup
Definition: videolist.cpp:333
hardwareprofile.i18n.t
t
Definition: i18n.py:36
FileAssociations::ext_ignore_list
std::vector< std::pair< QString, bool > > ext_ignore_list
Definition: dbaccess.h:155
VideoListImp::metadata_list
VideoMetadataListManager::metadata_list metadata_list
Definition: videolist.cpp:338
TreeNodeDataPrivate::TreeNodeDataPrivate
TreeNodeDataPrivate(QString path, QString host, QString prefix)
Definition: videolist.cpp:48
VideoList::m_imp
class VideoListImp * m_imp
Definition: videolist.h:61
MythGenericTree::SetImage
void SetImage(const QString &filename, const QString &name="")
Definition: mythgenerictree.cpp:572
metadata_path_sort::operator()
bool operator()(const VideoMetadata *lhs, const VideoMetadata *rhs)
Definition: videolist.cpp:181
AddFileNode
int AddFileNode(MythGenericTree *where_to_add, const QString &name, VideoMetadata *metadata)
Definition: videolist.cpp:303
metadata_sort::metadata_sort
metadata_sort(const VideoFilterSettings &vfs)
Definition: videolist.cpp:156
VideoDialog::BRS_CATEGORY
@ BRS_CATEGORY
Definition: videodlg.h:42
copy_entries
static void copy_entries(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter)
Definition: videolist.cpp:1049
dirhandler::m_dhFreeList
free_list & m_dhFreeList
Definition: videolist.cpp:1203
VideoListImp::m_listUnknown
bool m_listUnknown
Definition: videolist.cpp:435
stringutil.h
dirhandler::handleFile
void handleFile([[maybe_unused]] const QString &file_name, const QString &fq_file_name, [[maybe_unused]] const QString &extension, const QString &host) override
Definition: videolist.cpp:1173
copy_filtered_tree
static void copy_filtered_tree(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter)
Definition: videolist.cpp:1062
VideoList::getCurrentVideoFilter
const VideoFilterSettings & getCurrentVideoFilter() const
Definition: videolist.cpp:487
metadata_sort::m_vfs
const VideoFilterSettings & m_vfs
Definition: videolist.cpp:169
VideoMetadata::GetImageMap
void GetImageMap(InfoMap &imageMap)
Definition: videometadata.cpp:1450
VideoDialog::BRS_GENRE
@ BRS_GENRE
Definition: videodlg.h:42
VideoMetadata::GetSortFilename
const QString & GetSortFilename() const
Definition: videometadata.cpp:1819
VideoListImp::ltDBCastGroup
@ ltDBCastGroup
Definition: videolist.cpp:335
mythgenerictree.h
VideoListImp::getFilterChangedState
unsigned int getFilterChangedState(void)
Definition: videolist.cpp:383
VideoListImp::count
unsigned int count(void) const
Definition: videolist.cpp:355
meta_dir_node::setPath
void setPath(const QString &path, const QString &sortPath=nullptr)
Definition: videometadatalistmanager.cpp:313
VideoListImp::sort_view_data
void sort_view_data(bool flat_list)
Definition: videolist.cpp:727
meta_dir_node::clear
void clear()
Definition: videometadatalistmanager.cpp:381
metadata_path_sort::sort
static bool sort(const QString &lhs, const QString &rhs)
Definition: videolist.cpp:197
AddDirNode
static MythGenericTree * AddDirNode(MythGenericTree *where_to_add, const QString &name, QString fqPath, bool add_up_dirs, QString host="", QString prefix="")
Definition: videolist.cpp:279
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:55
VideoMetadata::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:1534
VideoFilterSettings::setParentalLevel
void setParentalLevel(ParentalLevel::Level parental_level)
Definition: videofilter.h:194
VideoList::setCurrentVideoFilter
void setCurrentVideoFilter(const VideoFilterSettings &filter)
Definition: videolist.cpp:492
VideoList
Definition: videolist.h:23
TreeNodeData::operator=
TreeNodeData & operator=(const TreeNodeData &rhs)
Definition: videolist.cpp:100
meta_dir_node::GetHost
const QString & GetHost() const
Definition: videometadatalistmanager.cpp:288
VideoListImp::buildDbList
void buildDbList(void)
Definition: videolist.cpp:949
videometadatalistmanager.h
VideoListImp::refreshNode
bool refreshNode(MythGenericTree *node)
Definition: videolist.cpp:641
AddMetadataToDir
static meta_dir_node * AddMetadataToDir(VideoMetadata *metadata, meta_dir_node *dir, meta_dir_node *hint=nullptr)
Definition: videolist.cpp:215
VideoListImp::refreshList
void refreshList(bool filebrowser, const ParentalLevel &parental_level, bool flat_list, int group_type)
Definition: videolist.cpp:664
MythDate::kSimplify
@ kSimplify
Do Today/Yesterday/Tomorrow transform.
Definition: mythdate.h:26
MythCoreContext::GetBoolSetting
bool GetBoolSetting(const QString &key, bool defaultval=false)
Definition: mythcorecontext.cpp:910
FileAssociations::getFileAssociation
static FileAssociations & getFileAssociation()
Definition: dbaccess.cpp:836
VideoFilterSettings
Definition: videofilter.h:73
VideoListImp::m_videoFilter
VideoFilterSettings m_videoFilter
Definition: videolist.cpp:448
VideoMetadataListManager::purgeByID
bool purgeByID(unsigned int db_id)
Definition: videometadatalistmanager.cpp:190
VideoListImp::buildFileList
void buildFileList(smart_dir_node &directory, metadata_list &metalist, const QString &prefix) const
Definition: videolist.cpp:1207
meta_dir_node::getName
const QString & getName() const override
Definition: videometadatalistmanager.cpp:278
path_to_node_name
static QString path_to_node_name(const QString &path)
Definition: videolist.cpp:203
TreeNodeData::m_d
class TreeNodeDataPrivate * m_d
Definition: videolist.h:87
dirhandler::newDir
DirectoryHandler * newDir(const QString &dir_name, [[maybe_unused]] const QString &fq_dir_name) override
Definition: videolist.cpp:1155
VideoListImp::Delete
bool Delete(unsigned int video_id, VideoList &)
Definition: videolist.cpp:388
TreeNodeDataPrivate::m_path
QString m_path
Definition: videolist.cpp:81
meta_data_node
Definition: videometadatalistmanager.h:61
ScanVideoDirectory
bool ScanVideoDirectory(const QString &start_path, DirectoryHandler *handler, const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown_extensions)
Definition: dirscan.cpp:229
metadata_path_sort::operator()
bool operator()(const VideoMetadata &lhs, const VideoMetadata &rhs)
Definition: videolist.cpp:176
VideoListImp
Definition: videolist.cpp:325
VideoListImp::ltDBStudioGroup
@ ltDBStudioGroup
Definition: videolist.cpp:335
meta_dir_node::dirs_begin
dir_iterator dirs_begin()
Definition: videometadatalistmanager.cpp:397
MythGenericTree::getParent
MythGenericTree * getParent(void) const
Definition: mythgenerictree.cpp:370
VideoDialog::BRS_YEAR
@ BRS_YEAR
Definition: videodlg.h:43
ParentalLevel
Definition: parentalcontrols.h:9
dirhandler::m_directory
smart_dir_node m_directory
Definition: videolist.cpp:1200
VideoList::count
unsigned int count() const
Definition: videolist.cpp:482
VideoListImp::ltDBDirectorGroup
@ ltDBDirectorGroup
Definition: videolist.cpp:334
VideoListImp::m_metadataViewFlat
metadata_view_list m_metadataViewFlat
Definition: videolist.cpp:443
UPNPScanner::Instance
static UPNPScanner * Instance(UPNPSubscription *sub=nullptr)
Definition: upnpscanner.cpp:161
VideoListImp::m_metadataListType
metadata_list_type m_metadataListType
Definition: videolist.cpp:446
VideoListImp::buildVideoList
MythGenericTree * buildVideoList(bool filebrowser, bool flatlist, int group_type, const ParentalLevel &parental_level, bool include_updirs)
Definition: videolist.cpp:618
tree_view_to_flat
void tree_view_to_flat(meta_dir_node &tree, VideoListImp::metadata_view_list &flat)
Definition: videolist.cpp:1096
VideoMetadataListManager::VideoMetadataPtr
simple_ref_ptr< VideoMetadata > VideoMetadataPtr
Definition: videometadatalistmanager.h:13
VideoFilterSettings::getChangedState
unsigned int getChangedState()
Definition: videofilter.h:214
TreeNodeDataPrivate::m_metadata
VideoMetadata * m_metadata
Definition: videolist.cpp:79
MythGenericTree
Definition: mythgenerictree.h:27
meta_dir_node::getSortPath
const QString & getSortPath() const
Definition: videometadatalistmanager.cpp:308
VideoDialog::BRS_FOLDER
@ BRS_FOLDER
Definition: videodlg.h:42
MythGenericTree::DisplayState
void DisplayState(const QString &state, const QString &name="")
Definition: mythgenerictree.cpp:621
mythcontext.h
metadata_path_sort::metadata_path_sort
metadata_path_sort(void)=default
VideoList::~VideoList
~VideoList()
Definition: videolist.cpp:456
dirhandler::m_metalist
VideoMetadataListManager::metadata_list & m_metalist
Definition: videolist.cpp:1202
VideoListImp::TryFilter
int TryFilter(const VideoFilterSettings &filter) const
Definition: videolist.cpp:370
meta_dir_node::GetData
const QVariant & GetData() const
Definition: videometadatalistmanager.cpp:325
to_metadata_ptr::operator()
VideoMetadata * operator()(smart_meta_node &smn)
Definition: videolist.cpp:262
VideoListImp::metadata_view_list
std::vector< VideoMetadata * > metadata_view_list
Definition: videolist.cpp:328
call_tree_flat
Definition: videolist.cpp:1083
TreeNodeDataPrivate::m_host
QString m_host
Definition: videolist.cpp:80
MythDate::kDateFull
@ kDateFull
Default local time.
Definition: mythdate.h:19
VideoMetadataListManager::metadata_list
std::list< VideoMetadataPtr > metadata_list
Definition: videometadatalistmanager.h:14
VideoListImp::ltDBCategoryGroup
@ ltDBCategoryGroup
Definition: videolist.cpp:333
quicksp.h
VideoList::refreshNode
bool refreshNode(MythGenericTree *node)
Definition: videolist.cpp:477
VideoListImp::ltNone
@ ltNone
Definition: videolist.cpp:332
VideoDialog::BRS_STUDIO
@ BRS_STUDIO
Definition: videodlg.h:45
VideoListImp::buildGroupList
void buildGroupList(metadata_list_type whence)
Definition: videolist.cpp:778
MythGenericTree::SetText
void SetText(const QString &text, const QString &name="", const QString &state="")
Definition: mythgenerictree.cpp:517
VideoList::GetTreeRoot
MythGenericTree * GetTreeRoot()
Definition: videolist.cpp:517
VideoListImp::m_metadata
VideoMetadataListManager m_metadata
Definition: videolist.cpp:440
upnpscanner.h
VideoListImp::ltDBInsertDateGroup
@ ltDBInsertDateGroup
Definition: videolist.cpp:336
meta_dir_node::getPath
const QString & getPath() const override
Definition: videometadatalistmanager.cpp:303
VideoMetadata::MetadataGetTextCb
static QString MetadataGetTextCb(const QString &name, void *data)
Definition: videometadata.cpp:1504
dirhandler::dirhandler
dirhandler(smart_dir_node &directory, const QString &prefix, VideoMetadataListManager::metadata_list &metalist, free_list &dh_free_list, bool infer_title)
Definition: videolist.cpp:1147
VideoMetadata::MetadataGetStateCb
static QString MetadataGetStateCb(const QString &name, void *data)
Definition: videometadata.cpp:1526
VideoListImp::setCurrentVideoFilter
void setCurrentVideoFilter(const VideoFilterSettings &filter)
Definition: videolist.cpp:365
DirectoryHandler
Definition: dirscan.h:6
VideoFilterSettings::matches_filter
bool matches_filter(const VideoMetadata &mdata) const
Definition: videofilter.cpp:194
ParentalLevel::GetLevel
Level GetLevel() const
Definition: parentalcontrols.cpp:128
TreeNodeData::GetHost
QString GetHost() const
Definition: videolist.cpp:139
VideoListImp::GetTreeRoot
MythGenericTree * GetTreeRoot(void)
Definition: videolist.cpp:406
VideoListImp::build_generic_tree
void build_generic_tree(MythGenericTree *dst, meta_dir_node *src, bool include_updirs)
Definition: videolist.cpp:537
VideoFilterSettings::meta_less_than
bool meta_less_than(const VideoMetadata &lhs, const VideoMetadata &rhs) const
Compares two VideoMetadata instances.
Definition: videofilter.cpp:314
TreeNodeData::~TreeNodeData
~TreeNodeData()
Definition: videolist.cpp:111
VideoListImp::update_meta_view
void update_meta_view(bool flat_list)
Definition: videolist.cpp:1106
VideoList::getListCache
const VideoMetadataListManager & getListCache() const
Definition: videolist.cpp:502
videoutils.h
VideoDialog::BRS_DIRECTOR
@ BRS_DIRECTOR
Definition: videodlg.h:43
dirhandler
Definition: videolist.cpp:1141
TreeNodeDataPrivate::TreeNodeDataPrivate
TreeNodeDataPrivate(VideoMetadata *metadata)
Definition: videolist.cpp:39
TreeNodeDataPrivate::GetHost
QString GetHost(void) const
Definition: videolist.cpp:68
videodlg.h
metadata_sort
metadata sort function
Definition: videolist.cpp:154
VideoListImp::getListCache
const VideoMetadataListManager & getListCache(void) const
Definition: videolist.cpp:378
VideoListImp::InvalidateCache
void InvalidateCache()
Definition: videolist.cpp:411
simple_ref_ptr::get
T * get() const
Definition: quicksp.h:73
VideoDialog::BRS_TVMOVIE
@ BRS_TVMOVIE
Definition: videodlg.h:45
TreeNodeData::GetPrefix
QString GetPrefix() const
Definition: videolist.cpp:146
VideoMetadataListManager::byID
VideoMetadataPtr byID(unsigned int db_id) const
Definition: videometadatalistmanager.cpp:180