Exemplo n.º 1
0
        public override IMediaFolder Transform(IMediaFolder oldRoot)
        {
            var root   = new VirtualClonedFolder(oldRoot);
            var titles = new SimpleKeyedVirtualFolder(root, "titles");

            SortFolder(root, titles);
            foreach (var i in root.ChildFolders.ToList())
            {
                root.ReleaseFolder(i);
            }
            foreach (var i in titles.ChildFolders.ToList())
            {
                if (i.ChildCount > 100)
                {
                    DebugFormat("Partioning folder {0}", i.Title);
                    using (var prefixer = new Prefixer())
                    {
                        PartitionChildren(i as VirtualFolder, prefixer);
                    }
                }

                root.AdoptFolder(i);
            }

            return(root);
        }
Exemplo 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;
 }
Exemplo n.º 3
0
 public override IMediaFolder Transform(IMediaFolder root)
 {
     if (filter == null) {
     return root;
       }
       root = new VirtualClonedFolder(root);
       ProcessFolder(root);
       return root;
 }
Exemplo n.º 4
0
 public override IMediaFolder Transform(IMediaFolder root)
 {
     if (filter == null)
     {
         return(root);
     }
     root = new VirtualClonedFolder(root);
     ProcessFolder(root);
     return(root);
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var root   = new VirtualClonedFolder(Root);
            var titles = new TitlesFolder(root);

            SortFolder(root, titles);
            foreach (var i in root.ChildFolders.ToList())
            {
                root.ReleaseFolder(i);
            }
            foreach (var i in titles.ChildFolders.ToList())
            {
                root.AdoptFolder(i);
            }
            return(root);
        }
Exemplo n.º 7
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var r = new VirtualClonedFolder(Root);
              var cross = from f in r.ChildFolders
                  from t in r.ChildFolders
                  where f != t
                  orderby f.Title, t.Title
                  select new { f = f as VirtualFolder, t = t as VirtualFolder };
              foreach (var c in cross) {
            MergeFolders(c.f, c.t);
              }

              TransformInternal(r, r);
              MergeFolders(r, r);
              return r;
        }
Exemplo n.º 8
0
 public override IMediaFolder Transform(IMediaFolder Root)
 {
     var root = new VirtualClonedFolder(Root);
       var titles = new SimpleKeyedVirtualFolder(root, "titles");
       SortFolder(root, titles);
       foreach (var i in root.ChildFolders.ToList()) {
     root.ReleaseFolder(i);
       }
       foreach (var i in titles.ChildFolders.ToList()) {
     if (i.ChildCount > 100) {
       _logger.ErrorFormat("Partioning folder {0}", i.Title);
       PartitionChildren(i as VirtualFolder, new Prefixer());
     }
     root.AdoptFolder(i);
       }
       return root;
 }
Exemplo n.º 9
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var r     = new VirtualClonedFolder(Root);
            var cross = from f in r.ChildFolders
                        from t in r.ChildFolders
                        where f != t
                        orderby f.Title, t.Title
                select new { f = f as VirtualFolder, t = t as VirtualFolder };

            foreach (var c in cross)
            {
                MergeFolders(c.f, c.t);
            }

            TransformInternal(r, r);
            MergeFolders(r, r);
            return(r);
        }
Exemplo n.º 10
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var root       = new VirtualClonedFolder(Root);
            var artists    = new TripleKeyedVirtualFolder(root, "Artists");
            var performers = new TripleKeyedVirtualFolder(root, "Performers");
            var albums     = new DoubleKeyedVirtualFolder(root, "Albums");
            var genres     = new SimpleKeyedVirtualFolder(root, "Genre");
            var folders    = new VirtualFolder(root, "Folders");

            SortFolder(root, artists, performers, albums, genres);
            foreach (var f in root.ChildFolders.ToList())
            {
                folders.AdoptFolder(f);
            }
            root.AdoptFolder(artists);
            root.AdoptFolder(performers);
            root.AdoptFolder(albums);
            root.AdoptFolder(genres);
            root.AdoptFolder(folders);
            return(root);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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;
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
 public override IMediaFolder Transform(IMediaFolder root)
 {
     root = new VirtualClonedFolder(root);
     ProcessFolder(root);
     return(root);
 }
Exemplo n.º 15
0
        public override IMediaFolder Transform(IMediaFolder Root)
        {
            var root   = new VirtualClonedFolder(Root);
            var series = new SimpleKeyedVirtualFolder(root, "Series");
            var movies = new SimpleKeyedVirtualFolder(root, "Movies");

            //SortFolder(root, series);

            /*
             * foreach (var f in series.ChildFolders.ToList()) {
             * var fsmi = f as VirtualFolder;
             * root.AdoptFolder(fsmi);
             * }
             * if (!cascade) {
             * 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 c in i.ChildItems)
             * {
             *  var c0 = c as IMediaVideoResource;
             *  var folder = cascaded.GetFolder(c0 != null ? c0.MovieTitle : i.Title);
             *  folder.AddResource(c);
             * }
             * }
             * foreach (var i in root.ChildItems.ToList()) {
             * //        var folder = cascaded.GetFolder(i.Title.StemCompareBase().Substring(0, 1).ToUpper());
             * //        folder.AddResource(i);
             * //        cascaded.AddResource(i);
             * var c0 = i as IMediaVideoResource;
             * var folder = cascaded.GetFolder(c0 != null ? c0.MovieTitle : i.Title);
             * folder.AddResource(i);
             * }
             */
            /*
             * var items = (from i in root.AllItems.ToList()
             *            let d = (i as IMediaVideoResource).InfoDate
             *            orderby d
             *            select i).ToList();
             */
            foreach (var c in root.AllItems.ToList())
            {
                var c0     = c as IMediaVideoResource;
                var folder = (c0 != null && c0.IsSeries ? series : movies).GetFolder(c0 != null ? c0.MovieTitle : c.Title);
                //var folder = new DoubleKeyedVirtualFolder((c0 != null && c0.IsSeries ? series : movies),(c0 != null ? c0.MovieTitle : c.Title) );
                if (c0.Progress <= 85)
                {
                    folder.AddResource(c);
                }
                else
                {
                    var folder1 = folder.ChildFolders.ToList().Find(f => f.Title == "WATCHED");
                    if (folder1 == null)
                    {
                        folder1 = new VirtualFolder(folder, "WATCHED");
                    }

                    folder1.AddResource(c);
                    folder.AdoptFolder(folder1);
                }

                root.RemoveResource(c);
            }
            foreach (var f in root.ChildFolders.ToList())
            {
                root.ReleaseFolder(f);
            }

            root.AdoptFolder(series);
            root.AdoptFolder(movies);
            return(root);
        }
Exemplo n.º 16
0
 public override IMediaFolder Transform(IMediaFolder oldRoot)
 {
     oldRoot = new VirtualClonedFolder(oldRoot);
       ProcessFolder(oldRoot);
       return oldRoot;
 }