mirror of
https://github.com/Radarr/Radarr
synced 2025-02-21 22:07:21 +00:00
Fixed: ImdbIds not being padded with zeroes, which messes up matching.
This commit is contained in:
parent
0903269b7c
commit
64e8fde0e1
2 changed files with 12 additions and 1 deletions
|
@ -124,5 +124,15 @@ public void should_parse_edition_lenient_mapping(string postTitle, string foundT
|
|||
{
|
||||
Parser.Parser.ParseMinimalMovieTitle(postTitle, foundTitle, 1290).Edition.Should().Be(edition);
|
||||
}
|
||||
|
||||
[TestCase("123", "tt0000123")]
|
||||
[TestCase("1234567", "tt1234567")]
|
||||
[TestCase("tt1234567", "tt1234567")]
|
||||
[TestCase("tt12345678", "tt12345678")]
|
||||
[TestCase("12345678", "tt12345678")]
|
||||
public void should_normalize_imdbid(string imdbid, string normalized)
|
||||
{
|
||||
Parser.Parser.NormalizeImdbId(imdbid).Should().BeEquivalentTo(normalized);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,7 +352,8 @@ public static string NormalizeImdbId(string imdbId)
|
|||
{
|
||||
if (imdbId.Length > 2)
|
||||
{
|
||||
return (imdbId.Substring(0,2) != "tt" ? $"tt{imdbId}" : imdbId);
|
||||
imdbId = imdbId.Replace("tt", "").PadLeft(7, '0');
|
||||
return $"tt{imdbId}";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue