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