Ejemplo n.º 1
0
        public override IMediaFolder Transform(IMediaFolder oldRoot)
        {
            var root   = new VirtualClonedFolder(oldRoot);
            var sorted = new SimpleKeyedVirtualFolder(root, Name);

            SortFolder(root, sorted);
            DebugFormat("sort {0} - {1}", sorted.ChildFolders.Count(), sorted.ChildItems.Count());
            DebugFormat("root {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());
            foreach (var f in sorted.ChildFolders.ToList())
            {
                if (f.ChildCount < 2)
                {
                    foreach (var file in f.ChildItems)
                    {
                        root.AddResource(file);
                    }
                    continue;
                }

                var fsmi = f as VirtualFolder;
                root.AdoptFolder(fsmi);
            }

            foreach (var f in sorted.ChildItems.ToList())
            {
                root.AddResource(f);
            }
            DebugFormat("merg {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());
            MergeFolders(root, root);
            DebugFormat("done {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());

            if (!cascade || root.ChildFolders.LongCount() <= 50)
            {
                return(root);
            }
            var cascaded = new DoubleKeyedVirtualFolder(root, "Series");

            foreach (var i in root.ChildFolders.ToList())
            {
                var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
                folder.AdoptFolder(i);
            }

            foreach (var i in root.ChildItems.ToList())
            {
                var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
                folder.AddResource(i);
            }

            return(cascaded);
        }
Ejemplo n.º 2
0
 public override IMediaFolder Transform(IMediaFolder Root)
 {
   var root = new VirtualClonedFolder(Root);
   var series = new SimpleKeyedVirtualFolder(root, "Series");
   SortFolder(root, series);
   foreach (var f in series.ChildFolders.ToList()) {
     if (f.ChildCount < 2) {
       foreach (var file in f.ChildItems) {
         root.AddResource(file);
       }
       continue;
     }
     var fsmi = f as VirtualFolder;
     root.AdoptFolder(fsmi);
   }
   if (!cascade || root.ChildFolders.LongCount() <= 50) {
     return root;
   }
   var cascaded = new DoubleKeyedVirtualFolder(root, "Series");
   foreach (var i in root.ChildFolders.ToList()) {
     var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
     folder.AdoptFolder(i);
   }
   foreach (var i in root.ChildItems.ToList()) {
     var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
     folder.AddResource(i);
   }
   return cascaded;
 }
Ejemplo n.º 3
0
        public override IMediaFolder Transform(IMediaFolder oldRoot)
        {
            var root = new VirtualClonedFolder(oldRoot);
              var sorted = new SimpleKeyedVirtualFolder(root, Name);
              SortFolder(root, sorted);
              DebugFormat("sort {0} - {1}", sorted.ChildFolders.Count(), sorted.ChildItems.Count());
              DebugFormat("root {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());
              foreach (var f in sorted.ChildFolders.ToList()) {
            if (f.ChildCount < 2) {
              foreach (var file in f.ChildItems) {
            root.AddResource(file);
              }
              continue;
            }
            var fsmi = f as VirtualFolder;
            root.AdoptFolder(fsmi);
              }
              foreach (var f in sorted.ChildItems.ToList()) {
            root.AddResource(f);
              }
              DebugFormat("merg {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());
              MergeFolders(root, root);
              DebugFormat("done {0} - {1}", root.ChildFolders.Count(), root.ChildItems.Count());

              if (!cascade || root.ChildFolders.LongCount() <= 50) {
            return root;
              }
              var cascaded = new DoubleKeyedVirtualFolder(root, "Series");
              foreach (var i in root.ChildFolders.ToList()) {
            var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
            folder.AdoptFolder(i);
              }
              foreach (var i in root.ChildItems.ToList()) {
            var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
            folder.AddResource(i);
              }
              return cascaded;
        }
Ejemplo n.º 4
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var root   = new VirtualClonedFolder(Root);
            var series = new SimpleKeyedVirtualFolder(root, "Series");

            SortFolder(root, series);
            foreach (var f in series.ChildFolders.ToList())
            {
                if (f.ChildCount < 2)
                {
                    foreach (var file in f.ChildItems)
                    {
                        root.AddResource(file);
                    }
                    continue;
                }
                var fsmi = f as VirtualFolder;
                root.AdoptFolder(fsmi);
            }
            return(root);
        }
Ejemplo n.º 5
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var root   = new VirtualClonedFolder(Root);
            var series = new SimpleKeyedVirtualFolder(root, "Series");

            SortFolder(root, series);
            foreach (var f in series.ChildFolders.ToList())
            {
                if (f.ChildCount < 2)
                {
                    foreach (var file in f.ChildItems)
                    {
                        root.AddResource(file);
                    }
                    continue;
                }
                var fsmi = f as VirtualFolder;
                root.AdoptFolder(fsmi);
            }
            if (!cascade || root.ChildFolders.LongCount() <= 50)
            {
                return(root);
            }
            var cascaded = new DoubleKeyedVirtualFolder(root, "Series");

            foreach (var i in root.ChildFolders.ToList())
            {
                var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
                folder.AdoptFolder(i);
            }
            foreach (var i in root.ChildItems.ToList())
            {
                var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
                folder.AddResource(i);
            }
            return(cascaded);
        }