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 {
87  m_d = new TreeNodeDataPrivate(metadata);
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 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
240  QStringList path = insert_chunk.split("/", QString::SkipEmptyParts);
241 #else
242  QStringList path = insert_chunk.split("/", Qt::SkipEmptyParts);
243 #endif
244  if (path.size() > 1)
245  {
246  path.pop_back();
247  }
248  else
249  {
250  path.clear();
251  }
252 
253  for (const auto & part : qAsConst(path))
254  {
255  smart_dir_node sdn = start->addSubDir(part, "" , host, prefix);
256  start = sdn.get();
257  }
258 
259  start->addEntry(smart_meta_node(new meta_data_node(metadata)));
260 
261  return start;
262 }
263 
265 {
267  {
268  return smn->getData();
269  }
270 
272  {
273  return &data;
274  }
275 
278  {
279  return data.get();
280  }
281 };
282 
284  MythGenericTree *where_to_add,
285  const QString& name, QString fqPath, bool add_up_dirs,
286  QString host = "", QString prefix = "")
287 {
288  // Add the subdir node...
289  MythGenericTree *sub_node =
290  where_to_add->addNode(name, kSubFolder, false);
291  sub_node->SetData(QVariant::fromValue(TreeNodeData(std::move(fqPath), std::move(host), std::move(prefix))));
292  sub_node->SetText(name, "title");
293  sub_node->DisplayState("subfolder", "nodetype");
294 
295  // ...and the updir node.
296  if (add_up_dirs)
297  {
298  MythGenericTree *up_node =
299  sub_node->addNode(where_to_add->GetText(), kUpFolder,
300  true, false);
301  up_node->DisplayState("subfolder", "nodetype");
302  }
303 
304  return sub_node;
305 }
306 
307 int AddFileNode(MythGenericTree *where_to_add, const QString& name,
308  VideoMetadata *metadata)
309 {
310  MythGenericTree *sub_node = where_to_add->addNode(name, 0, true);
311  sub_node->SetData(QVariant::fromValue(TreeNodeData(metadata)));
312  sub_node->SetTextCb( &VideoMetadata::MetadataGetTextCb, metadata);
313  sub_node->SetImageCb(&VideoMetadata::MetadataGetImageCb, metadata);
314  sub_node->SetStateCb(&VideoMetadata::MetadataGetStateCb, metadata);
315 
316  // Assign images to parent node if this is the first child
317  if (where_to_add->visibleChildCount() == 1 &&
318  where_to_add->getInt() == kSubFolder)
319  {
320  InfoMap imageMap;
321  metadata->GetImageMap(imageMap);
322  where_to_add->SetImageFromMap(imageMap);
323  where_to_add->SetImage("buttonimage", imageMap["smartimage"]);
324  }
325 
326  return 1;
327 }
328 
330 {
331  public:
332  using metadata_view_list = std::vector<VideoMetadata *>;
333 
334  private:
343 
344  public:
345  VideoListImp();
346 
348  bool include_updirs);
350  bool filebrowser, bool flatlist,
351  int group_type, const ParentalLevel &parental_level,
352  bool include_updirs);
353 
354  void refreshList(bool filebrowser, const ParentalLevel &parental_level,
355  bool flat_list, int group_type);
356  bool refreshNode(MythGenericTree *node);
357 
358  unsigned int count(void) const
359  {
360  return m_metadataViewFlat.size();
361  }
362 
364  {
365  return m_videoFilter;
366  }
367 
369  {
370  m_videoFilter = filter;
371  }
372 
373  int TryFilter(const VideoFilterSettings &filter) const
374  {
375  auto list = m_metadata.getList();
376  auto filtermatch =
377  [filter](const auto & md){ return filter.matches_filter(*md); };
378  return std::count_if(list.cbegin(), list.cend(), filtermatch);
379  }
380 
382  {
383  return m_metadata;
384  }
385 
386  unsigned int getFilterChangedState(void)
387  {
389  }
390 
391  bool Delete(unsigned int video_id, VideoList &/*dummy*/)
392  {
393  bool ret = false;
394  MetadataPtr mp = m_metadata.byID(video_id);
395  if (mp)
396  {
397  ret = mp->DeleteFile();
398  if (ret)
399  {
400  ret = m_metadata.purgeByID(video_id);
401  // Force refresh
403  }
404  }
405 
406  return ret;
407  }
408 
410  {
411  return m_videoTreeRoot.data();
412  }
413 
415  // Set the type to none to avoid refreshList thinking it doesn't
416  // need to.
418 
419  metadata_list ml;
421  m_metadata.setList(ml);
422  }
423 
424  private:
425  void sort_view_data(bool flat_list);
426  void fillMetadata(metadata_list_type whence);
427 
428  void buildFsysList(void);
429  void buildGroupList(metadata_list_type whence);
430  void buildDbList(void);
431  void buildTVList(void);
432  void buildFileList(smart_dir_node &directory, metadata_list &metalist,
433  const QString &prefix) const;
434 
435  void update_meta_view(bool flat_list);
436 
437  private:
438  bool m_listUnknown {false};
439  bool m_loadMetaData {false};
440 
441  QScopedPointer <MythGenericTree> m_videoTreeRoot;
442 
444  meta_dir_node m_metadataTree; // master list for tree views
445 
448 
450 
452 };
453 
455 {
456  m_imp = new VideoListImp;
457 }
458 
460 {
461  delete m_imp;
462 }
463 
465  bool filebrowser, bool flatlist,
466  int group_type, const ParentalLevel &parental_level,
467  bool include_updirs)
468 {
469  return m_imp->buildVideoList(filebrowser, flatlist,
470  group_type, parental_level, include_updirs);
471 }
472 
473 void VideoList::refreshList(bool filebrowser,
474  const ParentalLevel &parental_level,
475  bool flat_list, int group_type)
476 {
477  m_imp->refreshList(filebrowser, parental_level, flat_list, group_type);
478 }
479 
481 {
482  return m_imp->refreshNode(node);
483 }
484 
485 unsigned int VideoList::count(void) const
486 {
487  return m_imp->count();
488 }
489 
491 {
492  return m_imp->getCurrentVideoFilter();
493 }
494 
496 {
497  m_imp->setCurrentVideoFilter(filter);
498 }
499 
501 {
502  return m_imp->TryFilter(filter);
503 }
504 
506 {
507  return m_imp->getListCache();
508 }
509 
511 {
512  return m_imp->getFilterChangedState();
513 }
514 
515 bool VideoList::Delete(int video_id)
516 {
517  return m_imp->Delete(video_id, *this);
518 }
519 
521 {
522  return m_imp->GetTreeRoot();
523 }
524 
526 {
528 }
529 
531 // VideoListImp
533 VideoListImp::VideoListImp() : m_metadataViewTree("", "top")
534 {
535  m_listUnknown = gCoreContext->GetBoolSetting("VideoListUnknownFileTypes", false);
536 
537  m_loadMetaData = gCoreContext->GetBoolSetting("VideoTreeLoadMetaData", false);
538 }
539 
541  bool include_updirs)
542 {
543  if (src->DataIsValid())
544  {
546  dst->SetData(src->GetData());
547  return;
548  }
549 
550  for (auto dir = src->dirs_begin();
551  dir != src->dirs_end(); ++dir)
552  {
553  if ((*dir)->has_entries())
554  {
555  bool incUpDir = include_updirs;
556  // Only include upnodes when there is a parent to move up to
557  if (!dst->getParent())
558  incUpDir = false;
559 
561  dst, (*dir)->getName(),
562  (*dir)->getFQPath(), incUpDir, (*dir)->GetHost(),
563  (*dir)->GetPrefix());
564 
565  build_generic_tree(t, dir->get(), include_updirs);
566  }
567  }
568 
569  for (auto entry = src->entries_begin();
570  entry != src->entries_end(); ++entry)
571  {
572  if (((*entry)->getData()->GetSeason() > 0) ||
573  ((*entry)->getData()->GetEpisode() > 0))
574  {
575  QString seas = QString::number((*entry)->getData()->GetSeason());
576  QString ep = QString::number((*entry)->getData()->GetEpisode());
577  QString title = (*entry)->getData()->GetTitle();
578  QString subtitle = (*entry)->getData()->GetSubtitle();
579 
580  if (ep.size() < 2)
581  ep.prepend("0");
582 
583  QString displayTitle = QString("%1 %2x%3 - %4")
584  .arg(title, seas, ep, subtitle);
585 
586  if (src->getName() == title)
587  {
588  displayTitle = QString("%2x%3 - %4")
589  .arg(seas, ep, subtitle);
590  }
591  AddFileNode(dst, displayTitle, (*entry)->getData());
592  }
593  else if ((*entry)->getData()->GetSubtitle().isEmpty())
594  {
595  AddFileNode(
596  dst, (*entry)->getData()->GetTitle(), (*entry)->getData());
597  }
598  else
599  {
600  QString TitleSub = QString("%1 - %2")
601  .arg((*entry)->getData()->GetTitle(),
602  (*entry)->getData()->GetSubtitle());
603  AddFileNode(dst, TitleSub, (*entry)->getData());
604  }
605  }
606 }
607 
608 // Build a generic tree containing the video files. You can control the
609 // contents and the shape of the tree in de following ways:
610 // filebrowser:
611 // If true, the actual state of the filesystem is examined. If a video
612 // is already known to the system, this info is retrieved. If not, some
613 // basic info is provided.
614 // If false, only video information already present in the database is
615 // presented.
616 // flatlist:
617 // If true, the tree is reduced to a single level containing all the
618 // videos found.
619 // If false, the hierarchy present on the filesystem or in the database
620 // is preserved. In this mode, both sub-dirs and updirs are present.
622  bool filebrowser, bool flatlist, int group_type,
623  const ParentalLevel &parental_level, bool include_updirs)
624 {
625  refreshList(filebrowser, parental_level, flatlist, group_type);
626 
627  m_videoTreeRoot.reset(new MythGenericTree(QObject::tr("Video Home"),
628  kRootNode, false));
629 
631  include_updirs);
632 
633  if (m_metadataViewFlat.empty())
634  {
635  m_videoTreeRoot.reset(new MythGenericTree(QObject::tr("Video Home"),
636  kRootNode, false));
637  m_videoTreeRoot.data()->addNode(QObject::tr("No files found"),
638  kNoFilesFound, false);
639  }
640 
641  return m_videoTreeRoot.data();
642 }
643 
645 {
646  if (!node)
647  return false;
648 
649  // node->GetData() provides information on how/where to refresh the
650  // data for this node
651 
652  QVariant data = node->GetData();
653  if (!data.isValid())
654  return false;
655 
656  // currently only UPNPScanner can refresh data
657  if (UPNPScanner::Instance() && UPNPScanner::Instance()->GetMetadata(data))
658  {
659  // force a refresh
661  return true;
662  }
663 
664  return false;
665 }
666 
667 void VideoListImp::refreshList(bool filebrowser,
668  const ParentalLevel &parental_level,
669  bool flat_list, int group_type)
670 {
671 
672  m_videoFilter.setParentalLevel(parental_level.GetLevel());
673 
674  if (filebrowser)
675  {
677  }
678  else
679  {
680  switch (group_type)
681  {
684  LOG(VB_GENERAL, LOG_DEBUG, "Using Folder mode");
685  break;
688  LOG(VB_GENERAL, LOG_DEBUG, "Using Genre mode");
689  break;
692  LOG(VB_GENERAL, LOG_DEBUG, "Using Category mode");
693  break;
696  LOG(VB_GENERAL, LOG_DEBUG, "Using Year mode");
697  break;
700  LOG(VB_GENERAL, LOG_DEBUG, "Using Director mode");
701  break;
704  LOG(VB_GENERAL, LOG_DEBUG, "Using Studio mode");
705  break;
708  LOG(VB_GENERAL, LOG_DEBUG, "Using Cast Mode");
709  break;
712  LOG(VB_GENERAL, LOG_DEBUG, "Using User Rating Mode");
713  break;
716  LOG(VB_GENERAL, LOG_DEBUG, "Using Insert Date Mode");
717  break;
720  LOG(VB_GENERAL, LOG_DEBUG, "Using TV/Movie Mode");
721  break;
722  default:
724  break;
725  }
726  }
727  update_meta_view(flat_list);
728 }
729 
730 void VideoListImp::sort_view_data(bool flat_list)
731 {
732  if (flat_list)
733  {
734  sort(m_metadataViewFlat.begin(), m_metadataViewFlat.end(),
736  }
737  else
738  {
741  }
742 }
743 
745 {
746  if (m_metadataListType != whence)
747  {
748  m_metadataListType = whence;
749  // flush existing data
750  metadata_list ml;
751  m_metadata.setList(ml);
753 
754  switch (whence)
755  {
756  case ltFileSystem:
757  buildFsysList();
758  break;
759  case ltDBMetadata:
760  buildDbList();
761  break;
762  case ltTVMetadata:
763  buildTVList();
764  break;
765  case ltDBGenreGroup:
766  case ltDBCategoryGroup:
767  case ltDBYearGroup:
768  case ltDBDirectorGroup:
769  case ltDBStudioGroup:
770  case ltDBCastGroup:
771  case ltDBUserRatingGroup:
772  case ltDBInsertDateGroup:
773  buildGroupList(whence);
774  break;
775  case ltNone:
776  break;
777  }
778  }
779 }
780 
782 {
783  metadata_list ml;
785  m_metadata.setList(ml);
786 
787  metadata_view_list mlist;
788  mlist.reserve(m_metadata.getList().size());
789 
790  std::back_insert_iterator<metadata_view_list> mli(mlist);
791  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
792  mli, to_metadata_ptr());
793 
794 #ifdef SORT_METADATA_LIST
796  std::sort(mlist.begin(), mlist.end(), mps);
797 #endif
798 
799  using group_to_node_map = std::map<QString, meta_dir_node *>;
800  group_to_node_map gtnm;
801 
802  meta_dir_node *video_root = &m_metadataTree;
803 
804  smart_dir_node sdn1 = video_root->addSubDir("All");
805  meta_dir_node* all_group_node = sdn1.get();
806 
807  for (auto *data : mlist)
808  {
809  all_group_node->addEntry(smart_meta_node(new meta_data_node(data)));
810 
811  std::vector<QString> groups;
812  auto take_second = [](const auto& item){ return item.second; };
813 
814  switch (whence)
815  {
816  case ltDBGenreGroup:
817  {
818  const std::vector<std::pair <int, QString> >& genres =
819  data->GetGenres();
820 
821  std::transform(genres.cbegin(), genres.cend(),
822  std::back_inserter(groups), take_second);
823  break;
824  }
825  case ltDBCategoryGroup:
826  {
827  groups.push_back(data->GetCategory());
828  break;
829  }
830  case ltDBYearGroup:
831  {
832  groups.push_back(QString::number(data->GetYear()));
833  break;
834  }
835  case ltDBDirectorGroup:
836  {
837  groups.push_back(data->GetDirector());
838  break;
839  }
840  case ltDBStudioGroup:
841  {
842  groups.push_back(data->GetStudio());
843  break;
844  }
845  case ltDBCastGroup:
846  {
847  const std::vector<std::pair<int, QString> >& cast = data->GetCast();
848 
849  std::transform(cast.cbegin(), cast.cend(),
850  std::back_inserter(groups), take_second);
851  break;
852  }
853  case ltDBUserRatingGroup:
854  {
855  int i = data->GetUserRating();
856  groups.push_back(QString::number(i));
857  break;
858  }
859  case ltDBInsertDateGroup:
860  {
861  QDate date = data->GetInsertdate();
862  QString tmp = MythDate::toString(
864  groups.push_back(tmp);
865  break;
866  }
867  default:
868  {
869  LOG(VB_GENERAL, LOG_ERR, "Invalid type of grouping");
870  break;
871  }
872  }
873 
874  if (groups.empty())
875  {
876  meta_dir_node *group_node = gtnm["Unknown"];
877 
878  if (group_node == nullptr)
879  {
880  smart_dir_node sdn2 = video_root->addSubDir("Unknown");
881  group_node = sdn2.get();
882  gtnm["Unknown"] = group_node;
883  }
884 
885  group_node->addEntry(smart_meta_node(new meta_data_node(data)));
886  }
887 
888  for (const auto& item : groups)
889  {
890  meta_dir_node *group_node = gtnm[item];
891 
892  if (group_node == nullptr)
893  {
894  smart_dir_node sdn2 = video_root->addSubDir(item);
895  group_node = sdn2.get();
896  gtnm[item] = group_node;
897  }
898 
899  group_node->addEntry(smart_meta_node(new meta_data_node(data)));
900  }
901  }
902 }
903 
905 {
906  metadata_list ml;
908  m_metadata.setList(ml);
909 
910  metadata_view_list mlist;
911  mlist.reserve(m_metadata.getList().size());
912 
913  std::back_insert_iterator<metadata_view_list> mli(mlist);
914  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
915  mli, to_metadata_ptr());
916 
917 #ifdef SORT_METADATA_LIST
919  sort(mlist.begin(), mlist.end(), mps);
920 #endif
921 
922  meta_dir_node *video_root = &m_metadataTree;
923 
924  smart_dir_node sdn1 = video_root->addSubDir(QObject::tr("Television"));
925  meta_dir_node* television_node = sdn1.get();
926 
927  smart_dir_node vdn = video_root->addSubDir(QObject::tr("Movies"));
928  meta_dir_node* movie_node = vdn.get();
929 
930  for (auto & p : mlist)
931  {
932  VideoMetadata *data = p;
933 
934  if ((p->GetSeason() > 0) || (p->GetEpisode() > 0))
935  {
936  smart_dir_node sdn2 = television_node->addSubDir(p->GetTitle());
937  meta_dir_node* title_node = sdn2.get();
938 
939  smart_dir_node ssdn = title_node->addSubDir(
940  QObject::tr("Season %1").arg(p->GetSeason()));
941  meta_dir_node* season_node = ssdn.get();
942 
943  season_node->addEntry(smart_meta_node(new meta_data_node(data)));
944  }
945  else
946  movie_node->addEntry(smart_meta_node(new meta_data_node(data)));
947  }
948 }
949 
951 {
952  metadata_list ml;
954  m_metadata.setList(ml);
955 
956  metadata_view_list mlist;
957  mlist.reserve(m_metadata.getList().size());
958 
959  std::back_insert_iterator<metadata_view_list> mli(mlist);
960  transform(m_metadata.getList().begin(), m_metadata.getList().end(),
961  mli, to_metadata_ptr());
962 
963 // print_meta_list(mlist);
964 
965 #ifdef SORT_METADATA_LIST
967  std::sort(mlist.begin(), mlist.end(), mps);
968 #endif
969 
970  // TODO: break out the prefix in the DB so this isn't needed
971  using prefix_to_node_map = std::map<QString, meta_dir_node *>;
972  prefix_to_node_map ptnm;
973 
974  QStringList dirs = GetVideoDirs();
975 
976  if (dirs.isEmpty())
977  return;
978 
979  QString test_prefix(dirs[0]);
980 
981  meta_dir_node *video_root = &m_metadataTree;
982  if (dirs.size() == 1)
983  {
984  video_root->setPathRoot();
985  video_root->setPath(test_prefix);
986  video_root->setName("videos");
987  ptnm.insert(prefix_to_node_map::value_type(test_prefix, video_root));
988  }
989 
990  for (auto & mv : mlist)
991  AddMetadataToDir(mv, video_root);
992 
993 // print_dir_tree(m_metadataTree); // AEW DEBUG
994 }
995 
997 {
998  //
999  // Fill metadata from directory structure
1000  //
1001 
1002  using node_to_path_list = std::vector<std::pair<QString, QString> >;
1003 
1004  node_to_path_list node_paths;
1005 
1006  QStringList dirs = GetVideoDirs();
1007  if (dirs.size() > 1)
1008  {
1009  auto new_pl = [](const auto& dir)
1010  { return node_to_path_list::value_type(path_to_node_name(dir), dir); };
1011  std::transform(dirs.cbegin(), dirs.cend(), std::back_inserter(node_paths), new_pl);
1012  }
1013  else
1014  {
1015  node_paths.push_back(
1016  node_to_path_list::value_type(QObject::tr("videos"), dirs[0]));
1017  }
1018 
1019  //
1020  // Add all root-nodes to the tree.
1021  //
1022  metadata_list ml;
1023  for (auto & path : node_paths)
1024  {
1025  smart_dir_node root = m_metadataTree.addSubDir(path.second, path.first);
1026  root->setPathRoot();
1027 
1028  buildFileList(root, ml, path.second);
1029  }
1030 
1031  // retrieve any MediaServer data that may be available
1032  if (UPNPScanner::Instance())
1034 
1035  // See if we can find this filename in DB
1036  if (m_loadMetaData)
1037  {
1038  // Load the DB data so metadata lookups work
1039  // TODO: ugly, pass the list
1041  metadata_list db_metadata;
1043  mdlm.setList(db_metadata);
1044  for (auto & list : ml)
1045  list->FillDataFromFilename(mdlm);
1046  }
1047  m_metadata.setList(ml);
1048 }
1049 
1050 
1052  const VideoFilterSettings &filter)
1053 {
1054  for (auto e = src.entries_begin(); e != src.entries_end(); ++e)
1055  {
1056  if (filter.matches_filter(*((*e)->getData())))
1057  {
1058  dst.addEntry(
1059  smart_meta_node(new meta_data_node((*e)->getData())));
1060  }
1061  }
1062 }
1063 
1065  const VideoFilterSettings &filter)
1066 {
1067  copy_entries(dst, src, filter);
1068  for (auto dir = src.dirs_begin(); dir != src.dirs_end(); ++dir)
1069  {
1070  simple_ref_ptr<meta_dir_node> node = *dir;
1071  if (node == nullptr)
1072  continue;
1073 
1074  smart_dir_node sdn = dst.addSubDir(node->getPath(),
1075  node->getName(),
1076  node->GetHost(),
1077  node->GetPrefix(),
1078  node->GetData());
1079  copy_filtered_tree(*sdn, **dir, filter);
1080  }
1081 }
1082 
1083 void tree_view_to_flat(meta_dir_node &tree,
1086 {
1088 
1090  {
1091  tree_view_to_flat(*(sdn.get()), m_list);
1092  }
1093 
1095 };
1096 
1097 // Fills a flat view with pointers to all entries in a tree.
1100 {
1101  std::back_insert_iterator<VideoListImp::metadata_view_list> bip(flat);
1102  transform(tree.entries_begin(), tree.entries_end(), bip,
1103  to_metadata_ptr());
1104 
1105  for_each(tree.dirs_begin(), tree.dirs_end(), call_tree_flat(flat));
1106 }
1107 
1109 {
1110  m_metadataViewFlat.clear();
1111  m_metadataViewFlat.reserve(m_metadata.getList().size());
1112 
1114 
1115  if (flat_list)
1116  {
1117  for (const auto & md : m_metadata.getList())
1118  {
1119  if (m_videoFilter.matches_filter(*md))
1120  {
1121  m_metadataViewFlat.push_back(md.get());
1122  }
1123  }
1124 
1125  sort_view_data(flat_list);
1126 
1127  for (auto & md : m_metadataViewFlat)
1129  }
1130  else
1131  {
1135  m_videoFilter);
1136 
1137  sort_view_data(flat_list);
1138 
1140  }
1141 }
1142 
1144 {
1145  public:
1146  using free_list = std::list<simple_ref_ptr<DirectoryHandler> >;
1147 
1148  public:
1149  dirhandler(smart_dir_node &directory, const QString &prefix,
1151  free_list &dh_free_list, bool infer_title) :
1152  m_directory(directory), m_prefix(prefix), m_metalist(metalist),
1153  m_dhFreeList(dh_free_list), m_inferTitle(infer_title)
1154  {
1155  }
1156 
1157  DirectoryHandler *newDir(const QString &dir_name,
1158  const QString &fq_dir_name) override // DirectoryHandler
1159  {
1160  (void) fq_dir_name;
1161  smart_dir_node dir = m_directory->addSubDir(dir_name);
1163  m_dhFreeList,
1164  m_inferTitle);
1165  m_dhFreeList.push_back(dh);
1166  return dh;
1167  }
1168 
1169  void handleFile(const QString &file_name,
1170  const QString &fq_file_name,
1171  const QString &extension)
1172  {
1173  handleFile(file_name, fq_file_name, extension, "");
1174  }
1175 
1176  void handleFile(const QString &file_name,
1177  const QString &fq_file_name,
1178  const QString &extension,
1179  const QString &host) override // DirectoryHandler
1180  {
1181  (void) file_name;
1182  (void) extension;
1183  const QString& file_string(fq_file_name);
1184 
1186  new VideoMetadata(file_string));
1187  QFileInfo qfi(file_string);
1188  QString title = qfi.completeBaseName();
1189  if (m_inferTitle)
1190  {
1191  QString tmptitle(VideoMetadata::FilenameToMeta(file_string, 1));
1192  if (!tmptitle.isEmpty())
1193  title = tmptitle;
1194  }
1195  myData->SetTitle(title);
1196  myData->SetPrefix(m_prefix);
1197 
1198  myData->SetHost(host);
1199  m_metalist.push_back(myData);
1200 
1201  m_directory->addEntry(new meta_data_node(myData.get()));
1202  }
1203 
1204  private:
1206  const QString &m_prefix;
1209  const bool m_inferTitle;
1210 };
1211 
1213  smart_dir_node &directory, metadata_list &metalist, const QString &prefix) const
1214 {
1217 
1219  dirhandler dh(directory, prefix, metalist, fl, false);
1220  (void) ScanVideoDirectory(
1221  directory->getFQPath(), &dh, ext_list, m_listUnknown);
1222 }
VideoMetadata
Definition: videometadata.h:24
meta_dir_node::entries_begin
entry_iterator entries_begin()
Definition: videometadatalistmanager.cpp:414
VideoListImp::getCurrentVideoFilter
const VideoFilterSettings & getCurrentVideoFilter() const
Definition: videolist.cpp:363
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:1087
VideoList::getFilterChangedState
unsigned int getFilterChangedState()
Definition: videolist.cpp:510
VideoMetadata::FilenameToMeta
static QString FilenameToMeta(const QString &file_name, int position)
Definition: videometadata.cpp:1142
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
kRootNode
@ kRootNode
Definition: videolist.h:8
metadata_sort::operator()
bool operator()(const VideoMetadata *lhs, const VideoMetadata *rhs)
Definition: videolist.cpp:158
MythGenericTree::SetData
void SetData(QVariant data)
Definition: mythgenerictree.h:97
VideoDialog::BRS_USERRATING
@ BRS_USERRATING
Definition: videodlg.h:42
FileAssociations::getExtensionIgnoreList
void getExtensionIgnoreList(ext_ignore_list &ext_ignore) const
Definition: dbaccess.cpp:811
MythGenericTree::GetText
QString GetText(const QString &name="") const
Definition: mythgenerictree.cpp:557
dirhandler::free_list
std::list< simple_ref_ptr< DirectoryHandler > > free_list
Definition: videolist.cpp:1146
dirscan.h
dirhandler::m_inferTitle
const bool m_inferTitle
Definition: videolist.cpp:1209
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:223
VideoMetadata::MetadataGetImageCb
static QString MetadataGetImageCb(const QString &name, void *data)
Definition: videometadata.cpp:1521
VideoMetadata::GetHost
const QString & GetHost() const
Definition: videometadata.cpp:1837
meta_dir_node::GetPrefix
const QString & GetPrefix() const
Definition: videometadatalistmanager.cpp:295
TreeNodeData::TreeNodeData
TreeNodeData()=default
VideoMetadataListManager
Definition: videometadatalistmanager.h:10
UPNPScanner::GetInitialMetadata
void GetInitialMetadata(VideoMetadataListManager::metadata_list *list, meta_dir_node *node)
Definition: upnpscanner.cpp:217
VideoListImp::m_metadataTree
meta_dir_node m_metadataTree
Definition: videolist.cpp:444
VideoDialog::BRS_INSERTDATE
@ BRS_INSERTDATE
Definition: videodlg.h:42
meta_dir_node::sort
void sort(DirSort dir_sort, EntrySort entry_sort)
Definition: videometadatalistmanager.h:128
simple_ref_ptr
Definition: quicksp.h:24
metadata_path_sort
Definition: videolist.cpp:172
dirhandler::handleFile
void handleFile(const QString &file_name, const QString &fq_file_name, const QString &extension, const QString &host) override
Definition: videolist.cpp:1176
VideoList::refreshList
void refreshList(bool filebrowser, const ParentalLevel &parental_level, bool flat_list, int group_type)
Definition: videolist.cpp:473
call_tree_flat::operator()
void operator()(smart_dir_node &sdn)
Definition: videolist.cpp:1089
parentalcontrols.h
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:500
smart_meta_node
simple_ref_ptr< meta_data_node > smart_meta_node
Definition: videometadatalistmanager.h:77
MythGenericTree::getInt
int getInt() const
Definition: mythgenerictree.h:73
VideoListImp::ltDBDirectorGroup
@ ltDBDirectorGroup
Definition: videolist.cpp:337
VideoListImp::ltDBMetadata
@ ltDBMetadata
Definition: videolist.cpp:335
meta_dir_node::dirs_end
dir_iterator dirs_end()
Definition: videometadatalistmanager.cpp:399
MythGenericTree::SetImageCb
void SetImageCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:586
MythGenericTree::GetData
QVariant GetData(void) const
Definition: mythgenerictree.h:98
VideoListImp::fillMetadata
void fillMetadata(metadata_list_type whence)
Definition: videolist.cpp:744
TreeNodeDataPrivate::GetMetadata
VideoMetadata * GetMetadata(void)
Definition: videolist.cpp:53
dirhandler::m_prefix
const QString & m_prefix
Definition: videolist.cpp:1206
VideoListImp::ltFileSystem
@ ltFileSystem
Definition: videolist.cpp:335
meta_dir_node
Definition: videometadatalistmanager.h:82
meta_dir_node::setName
void setName(const QString &name)
Definition: videometadatalistmanager.cpp:270
VideoListImp::ltDBUserRatingGroup
@ ltDBUserRatingGroup
Definition: videolist.cpp:339
MythGenericTree::SetImageFromMap
void SetImageFromMap(const InfoMap &infoMap)
Definition: mythgenerictree.cpp:580
MythGenericTree::SetTextCb
void SetTextCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:551
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
TreeNodeDataPrivate::GetPath
QString GetPath(void) const
Definition: videolist.cpp:63
VideoMetadataListManager::getList
const metadata_list & getList() const
Definition: videometadatalistmanager.cpp:165
meta_dir_node::addEntry
void addEntry(const smart_meta_node &entry)
Definition: videometadatalistmanager.cpp:372
VideoMetadataListManager::setList
void setList(metadata_list &list)
Definition: videometadatalistmanager.cpp:159
VideoListImp::VideoListImp
VideoListImp()
Definition: videolist.cpp:533
VideoListImp::ltDBYearGroup
@ ltDBYearGroup
Definition: videolist.cpp:337
call_tree_flat::m_list
VideoListImp::metadata_view_list & m_list
Definition: videolist.cpp:1094
TreeNodeData
Definition: videolist.h:68
meta_dir_node::DataIsValid
bool DataIsValid(void) const
Definition: videometadatalistmanager.cpp:327
meta_dir_node::entries_end
entry_iterator entries_end()
Definition: videometadatalistmanager.cpp:419
to_metadata_ptr
Definition: videolist.cpp:264
metadata_path_sort::operator()
bool operator()(const smart_dir_node &lhs, const smart_dir_node &rhs)
Definition: videolist.cpp:186
VideoDialog::BRS_STUDIO
@ BRS_STUDIO
Definition: videodlg.h:43
MythGenericTree::SetStateCb
void SetStateCb(mgtCbFn fn, void *data)
Definition: mythgenerictree.cpp:617
hardwareprofile.distros.mythtv_data.data_mythtv.prefix
string prefix
Definition: data_mythtv.py:40
VideoList::InvalidateCache
void InvalidateCache()
Definition: videolist.cpp:525
VideoDialog::BRS_CATEGORY
@ BRS_CATEGORY
Definition: videodlg.h:40
VideoListImp::buildTVList
void buildTVList(void)
Definition: videolist.cpp:904
VideoMetadataListManager::loadAllFromDatabase
static void loadAllFromDatabase(metadata_list &items, const QString &sql="")
Load videometadata database into memory.
Definition: videometadatalistmanager.cpp:128
VideoList::buildVideoList
MythGenericTree * buildVideoList(bool filebrowser, bool flatlist, int group_type, const ParentalLevel &parental_level, bool include_updirs)
Definition: videolist.cpp:464
tmp
static guint32 * tmp
Definition: goom_core.cpp:32
dbaccess.h
VideoDialog::BRS_CAST
@ BRS_CAST
Definition: videodlg.h:41
VideoListImp::m_videoTreeRoot
QScopedPointer< MythGenericTree > m_videoTreeRoot
Definition: videolist.cpp:441
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:87
videofilter.h
TreeNodeDataPrivate::GetPrefix
QString GetPrefix(void) const
Definition: videolist.cpp:73
VideoList::VideoList
VideoList()
Definition: videolist.cpp:454
VideoListImp::metadata_list_type
metadata_list_type
Definition: videolist.cpp:335
dirhandler::handleFile
void handleFile(const QString &file_name, const QString &fq_file_name, const QString &extension)
Definition: videolist.cpp:1169
TreeNodeData::GetPath
QString GetPath() const
Definition: videolist.cpp:132
to_metadata_ptr::operator()
VideoMetadata * operator()(const VideoMetadataListManager::VideoMetadataPtr &data)
Definition: videolist.cpp:276
VideoListImp::m_loadMetaData
bool m_loadMetaData
Definition: videolist.cpp:439
VideoDialog::BRS_TVMOVIE
@ BRS_TVMOVIE
Definition: videodlg.h:43
VideoListImp::buildFsysList
void buildFsysList(void)
Definition: videolist.cpp:996
VideoList::Delete
bool Delete(int video_id)
Definition: videolist.cpp:515
mythdate.h
VideoMetadata::GetFilename
const QString & GetFilename() const
Definition: videometadata.cpp:1817
kSubFolder
@ kSubFolder
Definition: videolist.h:6
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:332
to_metadata_ptr::operator()
VideoMetadata * operator()(VideoMetadata &data)
Definition: videolist.cpp:271
videolist.h
VideoListImp::m_metadataViewTree
meta_dir_node m_metadataViewTree
Definition: videolist.cpp:447
GetVideoDirs
QStringList GetVideoDirs()
Definition: videoutils.cpp:121
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:199
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:341
VideoListImp::ltDBCategoryGroup
@ ltDBCategoryGroup
Definition: videolist.cpp:336
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:574
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:307
metadata_sort::metadata_sort
metadata_sort(const VideoFilterSettings &vfs)
Definition: videolist.cpp:156
copy_entries
static void copy_entries(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter)
Definition: videolist.cpp:1051
dirhandler::m_dhFreeList
free_list & m_dhFreeList
Definition: videolist.cpp:1208
VideoListImp::m_listUnknown
bool m_listUnknown
Definition: videolist.cpp:438
VideoDialog::BRS_YEAR
@ BRS_YEAR
Definition: videodlg.h:41
stringutil.h
copy_filtered_tree
static void copy_filtered_tree(meta_dir_node &dst, meta_dir_node &src, const VideoFilterSettings &filter)
Definition: videolist.cpp:1064
VideoList::getCurrentVideoFilter
const VideoFilterSettings & getCurrentVideoFilter() const
Definition: videolist.cpp:490
metadata_sort::m_vfs
const VideoFilterSettings & m_vfs
Definition: videolist.cpp:169
VideoMetadata::GetImageMap
void GetImageMap(InfoMap &imageMap)
Definition: videometadata.cpp:1453
VideoMetadata::GetSortFilename
const QString & GetSortFilename() const
Definition: videometadata.cpp:1822
mythgenerictree.h
VideoListImp::getFilterChangedState
unsigned int getFilterChangedState(void)
Definition: videolist.cpp:386
VideoListImp::count
unsigned int count(void) const
Definition: videolist.cpp:358
VideoDialog::BRS_DIRECTOR
@ BRS_DIRECTOR
Definition: videodlg.h:41
meta_dir_node::setPath
void setPath(const QString &path, const QString &sortPath=nullptr)
Definition: videometadatalistmanager.cpp:310
VideoListImp::sort_view_data
void sort_view_data(bool flat_list)
Definition: videolist.cpp:730
VideoDialog::BRS_FOLDER
@ BRS_FOLDER
Definition: videodlg.h:40
kUpFolder
@ kUpFolder
Definition: videolist.h:7
meta_dir_node::clear
void clear()
Definition: videometadatalistmanager.cpp:378
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:283
gCoreContext
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
Definition: mythcorecontext.cpp:59
VideoMetadata::GetPrefix
const QString & GetPrefix() const
Definition: videometadata.cpp:1537
VideoFilterSettings::setParentalLevel
void setParentalLevel(ParentalLevel::Level parental_level)
Definition: videofilter.h:194
VideoList::setCurrentVideoFilter
void setCurrentVideoFilter(const VideoFilterSettings &filter)
Definition: videolist.cpp:495
VideoList
Definition: videolist.h:23
TreeNodeData::operator=
TreeNodeData & operator=(const TreeNodeData &rhs)
Definition: videolist.cpp:100
VideoListImp::ltDBInsertDateGroup
@ ltDBInsertDateGroup
Definition: videolist.cpp:339
meta_dir_node::GetHost
const QString & GetHost() const
Definition: videometadatalistmanager.cpp:285
VideoListImp::buildDbList
void buildDbList(void)
Definition: videolist.cpp:950
videometadatalistmanager.h
VideoListImp::ltDBStudioGroup
@ ltDBStudioGroup
Definition: videolist.cpp:338
VideoListImp::refreshNode
bool refreshNode(MythGenericTree *node)
Definition: videolist.cpp:644
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:667
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:831
VideoFilterSettings
Definition: videofilter.h:73
VideoListImp::m_videoFilter
VideoFilterSettings m_videoFilter
Definition: videolist.cpp:451
VideoMetadataListManager::purgeByID
bool purgeByID(unsigned int db_id)
Definition: videometadatalistmanager.cpp:187
VideoListImp::buildFileList
void buildFileList(smart_dir_node &directory, metadata_list &metalist, const QString &prefix) const
Definition: videolist.cpp:1212
meta_dir_node::getName
const QString & getName() const override
Definition: videometadatalistmanager.cpp:275
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
VideoListImp::Delete
bool Delete(unsigned int video_id, VideoList &)
Definition: videolist.cpp:391
TreeNodeDataPrivate::m_path
QString m_path
Definition: videolist.cpp:81
meta_data_node
Definition: videometadatalistmanager.h:60
ScanVideoDirectory
bool ScanVideoDirectory(const QString &start_path, DirectoryHandler *handler, const FileAssociations::ext_ignore_list &ext_disposition, bool list_unknown_extensions)
Definition: dirscan.cpp:227
metadata_path_sort::operator()
bool operator()(const VideoMetadata &lhs, const VideoMetadata &rhs)
Definition: videolist.cpp:176
VideoListImp
Definition: videolist.cpp:329
meta_dir_node::dirs_begin
dir_iterator dirs_begin()
Definition: videometadatalistmanager.cpp:394
MythGenericTree::getParent
MythGenericTree * getParent(void) const
Definition: mythgenerictree.cpp:372
ParentalLevel
Definition: parentalcontrols.h:9
VideoDialog::BRS_GENRE
@ BRS_GENRE
Definition: videodlg.h:40
dirhandler::m_directory
smart_dir_node m_directory
Definition: videolist.cpp:1205
VideoList::count
unsigned int count() const
Definition: videolist.cpp:485
VideoListImp::m_metadataViewFlat
metadata_view_list m_metadataViewFlat
Definition: videolist.cpp:446
UPNPScanner::Instance
static UPNPScanner * Instance(UPNPSubscription *sub=nullptr)
Definition: upnpscanner.cpp:166
std
Definition: mythchrono.h:23
VideoListImp::m_metadataListType
metadata_list_type m_metadataListType
Definition: videolist.cpp:449
VideoListImp::buildVideoList
MythGenericTree * buildVideoList(bool filebrowser, bool flatlist, int group_type, const ParentalLevel &parental_level, bool include_updirs)
Definition: videolist.cpp:621
tree_view_to_flat
void tree_view_to_flat(meta_dir_node &tree, VideoListImp::metadata_view_list &flat)
Definition: videolist.cpp:1098
VideoMetadataListManager::VideoMetadataPtr
simple_ref_ptr< VideoMetadata > VideoMetadataPtr
Definition: videometadatalistmanager.h:13
VideoFilterSettings::getChangedState
unsigned int getChangedState()
Definition: videofilter.h:214
VideoListImp::ltNone
@ ltNone
Definition: videolist.cpp:335
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:305
MythGenericTree::DisplayState
void DisplayState(const QString &state, const QString &name="")
Definition: mythgenerictree.cpp:623
mythcontext.h
metadata_path_sort::metadata_path_sort
metadata_path_sort(void)=default
VideoList::~VideoList
~VideoList()
Definition: videolist.cpp:459
dirhandler::m_metalist
VideoMetadataListManager::metadata_list & m_metalist
Definition: videolist.cpp:1207
VideoListImp::TryFilter
int TryFilter(const VideoFilterSettings &filter) const
Definition: videolist.cpp:373
meta_dir_node::GetData
const QVariant & GetData() const
Definition: videometadatalistmanager.cpp:322
to_metadata_ptr::operator()
VideoMetadata * operator()(smart_meta_node &smn)
Definition: videolist.cpp:266
VideoListImp::metadata_view_list
std::vector< VideoMetadata * > metadata_view_list
Definition: videolist.cpp:332
call_tree_flat
Definition: videolist.cpp:1085
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
quicksp.h
VideoListImp::ltDBGenreGroup
@ ltDBGenreGroup
Definition: videolist.cpp:336
VideoList::refreshNode
bool refreshNode(MythGenericTree *node)
Definition: videolist.cpp:480
VideoListImp::buildGroupList
void buildGroupList(metadata_list_type whence)
Definition: videolist.cpp:781
MythGenericTree::SetText
void SetText(const QString &text, const QString &name="", const QString &state="")
Definition: mythgenerictree.cpp:519
VideoList::GetTreeRoot
MythGenericTree * GetTreeRoot()
Definition: videolist.cpp:520
VideoListImp::m_metadata
VideoMetadataListManager m_metadata
Definition: videolist.cpp:443
upnpscanner.h
meta_dir_node::getPath
const QString & getPath() const override
Definition: videometadatalistmanager.cpp:300
VideoMetadata::MetadataGetTextCb
static QString MetadataGetTextCb(const QString &name, void *data)
Definition: videometadata.cpp:1507
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:1149
VideoMetadata::MetadataGetStateCb
static QString MetadataGetStateCb(const QString &name, void *data)
Definition: videometadata.cpp:1529
VideoListImp::ltDBCastGroup
@ ltDBCastGroup
Definition: videolist.cpp:338
VideoListImp::setCurrentVideoFilter
void setCurrentVideoFilter(const VideoFilterSettings &filter)
Definition: videolist.cpp:368
DirectoryHandler
Definition: dirscan.h:6
kDynamicSubFolder
@ kDynamicSubFolder
Definition: videolist.h:10
VideoFilterSettings::matches_filter
bool matches_filter(const VideoMetadata &mdata) const
Definition: videofilter.cpp:198
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:409
VideoListImp::build_generic_tree
void build_generic_tree(MythGenericTree *dst, meta_dir_node *src, bool include_updirs)
Definition: videolist.cpp:540
VideoFilterSettings::meta_less_than
bool meta_less_than(const VideoMetadata &lhs, const VideoMetadata &rhs) const
Compares two VideoMetadata instances.
Definition: videofilter.cpp:318
TreeNodeData::~TreeNodeData
~TreeNodeData()
Definition: videolist.cpp:111
VideoListImp::update_meta_view
void update_meta_view(bool flat_list)
Definition: videolist.cpp:1108
VideoList::getListCache
const VideoMetadataListManager & getListCache() const
Definition: videolist.cpp:505
videoutils.h
kNoFilesFound
@ kNoFilesFound
Definition: videolist.h:9
dirhandler
Definition: videolist.cpp:1143
TreeNodeDataPrivate::TreeNodeDataPrivate
TreeNodeDataPrivate(VideoMetadata *metadata)
Definition: videolist.cpp:39
TreeNodeDataPrivate::GetHost
QString GetHost(void) const
Definition: videolist.cpp:68
VideoListImp::ltTVMetadata
@ ltTVMetadata
Definition: videolist.cpp:340
videodlg.h
metadata_sort
metadata sort function
Definition: videolist.cpp:154
VideoListImp::getListCache
const VideoMetadataListManager & getListCache(void) const
Definition: videolist.cpp:381
VideoListImp::InvalidateCache
void InvalidateCache()
Definition: videolist.cpp:414
simple_ref_ptr::get
T * get() const
Definition: quicksp.h:73
dirhandler::newDir
DirectoryHandler * newDir(const QString &dir_name, const QString &fq_dir_name) override
Definition: videolist.cpp:1157
TreeNodeData::GetPrefix
QString GetPrefix() const
Definition: videolist.cpp:146
VideoMetadataListManager::byID
VideoMetadataPtr byID(unsigned int db_id) const
Definition: videometadatalistmanager.cpp:177