Esempio n. 1
0
 protected override void SortFolder(IMediaFolder folder,
                                    SimpleKeyedVirtualFolder series)
 {
     foreach (var f in folder.ChildFolders.ToList())
     {
         SortFolder(f, series);
     }
     foreach (var i in folder.ChildItems.ToList())
     {
         var title = i.Title;
         if (string.IsNullOrWhiteSpace(title))
         {
             continue;
         }
         var m = regSeries.Match(title);
         if (!m.Success)
         {
             continue;
         }
         var ser = m.Groups[1].Value;
         if (string.IsNullOrEmpty(ser))
         {
             continue;
         }
         series.GetFolder(ser.StemNameBase()).AddResource(i);
         folder.RemoveResource(i);
     }
 }
Esempio n. 2
0
 private static void SortFolder(VirtualFolder folder, TripleKeyedVirtualFolder artists, TripleKeyedVirtualFolder performers, DoubleKeyedVirtualFolder albums, SimpleKeyedVirtualFolder genres)
 {
     foreach (var f in folder.ChildFolders.ToList())
     {
         SortFolder(f as VirtualFolder, artists, performers, albums, genres);
     }
     foreach (var i in folder.ChildItems.ToList())
     {
         var ai = i as IMetaAudioItem;
         if (ai == null)
         {
             continue;
         }
         var album = ai.MetaAlbum;
         if (album == null)
         {
             album = "Unspecified album";
         }
         albums.GetFolder(album.StemCompareBase().First().ToString().ToUpper()).GetFolder(album.StemNameBase()).AddResource(i);
         LinkTriple(artists, i, ai.MetaArtist, album);
         LinkTriple(performers, i, ai.MetaPerformer, album);
         var genre = ai.MetaGenre;
         if (genre != null)
         {
             genres.GetFolder(genre.StemNameBase()).AddResource(i);
         }
     }
 }
Esempio n. 3
0
        private static void SortFolder(VirtualFolder folder, SimpleKeyedVirtualFolder titles)
        {
            foreach (var f in folder.ChildFolders.ToList())
            {
                SortFolder(f as VirtualFolder, titles);
            }

            foreach (var c in folder.ChildItems.ToList())
            {
                var pre = GetTitle(c);
                pre = pre[0].ToString().ToUpperInvariant();
                titles.GetFolder(pre).AddResource(c);
                folder.RemoveResource(c);
            }
        }
Esempio n. 4
0
 protected override void SortFolder(IMediaFolder folder,
                                    SimpleKeyedVirtualFolder series)
 {
     foreach (var f in folder.ChildFolders.ToList())
     {
         SortFolder(f, series);
     }
     foreach (var i in folder.ChildItems.ToList())
     {
         try
         {
             var title = i.Title;
             if (string.IsNullOrWhiteSpace(title))
             {
                 throw new Exception("No title");
             }
             var m = regSites.Match(title);
             if (!m.Success)
             {
                 throw new Exception("No match");
             }
             var site = m.Groups["site"].Value;
             if (string.IsNullOrEmpty(site))
             {
                 throw new Exception("No site");
             }
             site = site.Replace(" ", "").Replace("\t", "").Replace("-", "");
             site = regNumberStrip.Replace(site, string.Empty).TrimEnd();
             if (!regWord.IsMatch(site))
             {
                 throw new Exception("Not a site");
             }
             folder.RemoveResource(i);
             series.GetFolder(site.StemNameBase()).AddResource(i);
         }
         catch (Exception ex)
         {
             DebugFormat("{0} - {1}", ex.Message, i.Title);
             folder.RemoveResource(i);
             series.AddResource(i);
         }
     }
 }