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; }
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); }
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) { Trace.WriteLine($"Partioning folder {i.Title}"); using (var prefixer = new Prefixer()) { PartitionChildren(i as VirtualFolder, prefixer); } } root.AdoptFolder(i); } return(root); }
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); }