Exemplo n.º 1
0
 public BandWithExternalInfo LoadMembersFromSource(BandWithExternalInfo band, IWikiPageText wikiPageText, ProcessingRulesEngine processingRulesEngine)
 {
     if (band.ExternalInfoIdentifier == 0)
     {
         return(band);
     }
     wikiPageText.LoadPage(band.ExternalInfoIdentifier);
     band.Members = new List <Artist>();
     foreach (var artistName in processingRulesEngine.ApplyAllRules(wikiPageText.ParsedPage.WikiText.AllText))
     {
         Log.Information("Found member: {0}", artistName);
         band.Members.Add(new Artist {
             Name = artistName
         });
     }
     return(band);
 }
Exemplo n.º 2
0
 public IEnumerable <BandWithPossibleMember> CleanMembers(BandWithExternalInfo band, ProcessingRulesEngine processingRulesEngine)
 {
     if (band.Members.Any())
     {
         foreach (var existingArtist in band.Members)
         {
             foreach (var cleanedArtistName in processingRulesEngine.ApplyAllRules(existingArtist.Name))
             {
                 Log.Information("Cleaned member: {0}", cleanedArtistName);
                 yield return(new BandWithPossibleMember
                 {
                     Band = new Artist {
                         ArtistId = band.ArtistId, Name = band.Name
                     },
                     Member = new Artist {
                         ArtistId = Guid.Empty, Name = cleanedArtistName
                     }
                 });
             }
         }
     }
 }