mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-26 15:52:42 +00:00
Added cases to strip feat. from track titles. (#288)
* Added cases to strip feat. from track titles.
This commit is contained in:
parent
453bbeee20
commit
734b1f6101
2 changed files with 16 additions and 3 deletions
|
@ -60,6 +60,10 @@ public void should_remove_common_tags_from_album_title(string title, string corr
|
|||
[TestCase("Songs of Experience (Deluxe Edition)", "Songs of Experience")]
|
||||
[TestCase("Mr. Bad Guy [Special Edition]", "Mr. Bad Guy")]
|
||||
[TestCase("Smooth Criminal (single)", "Smooth Criminal")]
|
||||
[TestCase("Wie Maak Die Jol Vol (Ft. Isaac Mutant, Knoffel, Jaak Paarl & Scallywag)", "Wie Maak Die Jol Vol")]
|
||||
[TestCase("Alles Schon Gesehen (Feat. Deichkind)", "Alles Schon Gesehen")]
|
||||
[TestCase("Science Fiction/Double Feature", "Science Fiction/Double Feature")]
|
||||
[TestCase("Dancing Feathers", "Dancing Feathers")]
|
||||
public void should_remove_common_tags_from_track_title(string title, string correct)
|
||||
{
|
||||
var result = Parser.Parser.CleanTrackTitle(title);
|
||||
|
|
|
@ -200,7 +200,10 @@ public static class Parser
|
|||
|
||||
private static readonly string[] Numbers = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
|
||||
|
||||
private static readonly Regex CommonTagRegex = new Regex(@"(\[|\(){1}(version|limited|deluxe|single|clean|album|special|bonus)+\s*.*(\]|\)){1}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
private static readonly Regex[] CommonTagRegex = new Regex[] {
|
||||
new Regex(@"(\[|\()*\b((featuring|feat.|feat|ft|ft.)\s{1}){1}\s*.*(\]|\))*", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
new Regex(@"(\[|\(){1}(version|limited|deluxe|single|clean|album|special|bonus)+\s*.*(\]|\)){1}", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||
};
|
||||
|
||||
public static ParsedTrackInfo ParseMusicPath(string path)
|
||||
{
|
||||
|
@ -588,12 +591,18 @@ public static string RemoveFileExtension(string title)
|
|||
|
||||
public static string CleanAlbumTitle(string album)
|
||||
{
|
||||
return CommonTagRegex.Replace(album, string.Empty).Trim();
|
||||
return CommonTagRegex[1].Replace(album, string.Empty).Trim();
|
||||
}
|
||||
|
||||
public static string CleanTrackTitle(string title)
|
||||
{
|
||||
return CommonTagRegex.Replace(title, string.Empty).Trim();
|
||||
var intermediateTitle = title;
|
||||
foreach (var regex in CommonTagRegex)
|
||||
{
|
||||
intermediateTitle = regex.Replace(intermediateTitle, string.Empty).Trim();
|
||||
}
|
||||
|
||||
return intermediateTitle;
|
||||
}
|
||||
|
||||
private static ParsedTrackInfo ParseAudioTags(string path)
|
||||
|
|
Loading…
Reference in a new issue