public void TitlesHelper(ScraperEngineResponse response) { var results = response.Doc.DocumentNode.SelectNodes("//title"); if (results != null) { foreach (var result in results) { if (result.OuterHtml == null || result.InnerText == "") { TitleDescCheck title = new TitleDescCheck("Missing title", result.InnerText, response.Url); EmptyTitles.Add(title); AllTitles.Add(title); } else if (result.InnerText.Length >= 60) { TitleDescCheck title = new TitleDescCheck("Too long", result.InnerText, response.Url); LongTitles.Add(title); AllTitles.Add(title); } else if (result.InnerText.Length <= 40) { TitleDescCheck title = new TitleDescCheck("Too short", result.InnerText, response.Url); ShortTitles.Add(title); AllTitles.Add(title); } else { TitleDescCheck title = new TitleDescCheck("Good", result.InnerText, response.Url); HealthyTitles.Add(title); AllTitles.Add(title); } StateHasChangedDelegate?.Invoke(); } } }
private void Process(List <File> selection, List <File> allFiles) { string currAlbum = null; string currArtist = null; string currAA = null; string currGenre = null; string currComposer = null; string currConductor = null; string currGrouping = null; string currCopyright = null; bool set = false; foreach (File f in allFiles) { if (f.Tags.Title != null && f.Tags.Title.Length > 0) { AllTitles.Add(f.Tags.Title); } string fname = Path.GetFileName(f.FileName); Match match = Regex.Match(fname, @"(?:\d+\.?)?(?:[\s_]?-[\s_]?)?(.*?)\.[^\.]+$"); if (match.Success) { string val = match.Groups[1].Value; val = val.Replace('_', ' '); val = val.Replace('.', ' '); val = Regex.Replace(val, @"\s+", " "); val = val.Trim(); if (val.Length > 0) { AllTitles.Add(val); } if (f.Tags.Album != null && f.Tags.Album.Length > 0) { AllAlbums.Add(f.Tags.Album); } if (f.Tags.Artists != null && f.Tags.Artists.Length > 0) { AllArtists.Add(f.Tags.Artists); } if (f.Tags.AlbumArtists != null && f.Tags.AlbumArtists.Length > 0) { AllAlbumArtists.Add(f.Tags.AlbumArtists); } if (f.Tags.Genres != null && f.Tags.Genres.Length > 0) { AllGenres.Add(f.Tags.Genres); } if (f.Tags.Composers != null && f.Tags.Composers.Length > 0) { AllComposers.Add(f.Tags.Composers); } if (f.Tags.Conductor != null && f.Tags.Conductor.Length > 0) { AllConductors.Add(f.Tags.Conductor); } if (f.Tags.Grouping != null && f.Tags.Grouping.Length > 0) { AllGroupings.Add(f.Tags.Grouping); } if (f.Tags.Copyright != null && f.Tags.Copyright.Length > 0) { AllCopyrights.Add(f.Tags.Copyright); } } } foreach (File f in selection) { if (!set) { currAlbum = f.Tags.Album; currArtist = f.Tags.Artists; currAA = f.Tags.AlbumArtists; currGenre = f.Tags.Genres; currComposer = f.Tags.Composers; currConductor = f.Tags.Conductor; currGrouping = f.Tags.Grouping; currCopyright = f.Tags.Copyright; } else { if (SameAlbum && currAlbum != f.Tags.Album) { SameAlbum = false; } else { currAlbum = f.Tags.Album; } if (SameArtists && currArtist != f.Tags.Artists) { SameArtists = false; } else { currArtist = f.Tags.Artists; } if (SameAlbumArtists && currAA != f.Tags.AlbumArtists) { SameAlbumArtists = false; } else { currAA = f.Tags.AlbumArtists; } if (SameGenres && currGenre != f.Tags.Genres) { SameGenres = false; } else { currGenre = f.Tags.Genres; } if (SameComposers && currComposer != f.Tags.Composers) { SameComposers = false; } else { currComposer = f.Tags.Composers; } if (SameConductor && currConductor != f.Tags.Conductor) { SameConductor = false; } else { currConductor = f.Tags.Conductor; } if (SameGrouping && currGrouping != f.Tags.Grouping) { SameGrouping = false; } else { currGrouping = f.Tags.Grouping; } if (SameCopyright && currCopyright != f.Tags.Copyright) { SameCopyright = false; } else { currCopyright = f.Tags.Copyright; } } set = true; } SetValues(selection); }
public static JobTitle FromString(string roleString) { return(AllTitles.Single(r => String.Equals(r.Name, roleString, StringComparison.OrdinalIgnoreCase))); }
public static JobTitle FromValue(int value) { return(AllTitles.Single(r => r.Value == value)); }
private JobTitle(int val, string name) { Value = val; Name = name; AllTitles.Add(this); }