Merge pull request #389 from 1337joe/add-image-logos

Add logo to images, add tests, update verifiers
This commit is contained in:
Michael Bisbjerg 2021-10-19 22:17:01 +02:00 committed by GitHub
commit ff517c3830
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 73 additions and 18 deletions

View File

@ -10,5 +10,8 @@ namespace TMDbLib.Objects.General
[JsonProperty("posters")] [JsonProperty("posters")]
public List<ImageData> Posters { get; set; } public List<ImageData> Posters { get; set; }
[JsonProperty("logos")]
public List<ImageData> Logos { get; set; }
} }
} }

View File

@ -154,11 +154,13 @@ namespace TMDbLibTests
ImageData backdrop = resp.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg"); ImageData backdrop = resp.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg");
ImageData poster = resp.Posters.Single(s => s.FilePath == "/c4G6lW5hAWmwveThfLSqs52yHB1.jpg"); ImageData poster = resp.Posters.Single(s => s.FilePath == "/c4G6lW5hAWmwveThfLSqs52yHB1.jpg");
ImageData logo = resp.Logos.Single(s => s.FilePath == "/sZcHIwp0UD7aqOKzPkOqtd63F9r.png");
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }
@ -171,11 +173,13 @@ namespace TMDbLibTests
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg"); ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/js3J4SBiRfLvmRzaHoTA2tpKROw.jpg");
ImageData poster = images.Posters.Single(s => s.FilePath == "/9Zq88w35f1PpM22TIbf2amtjHD6.jpg"); ImageData poster = images.Posters.Single(s => s.FilePath == "/9Zq88w35f1PpM22TIbf2amtjHD6.jpg");
ImageData logo = images.Logos.Single(s => s.FilePath == "/sZcHIwp0UD7aqOKzPkOqtd63F9r.png");
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }
@ -189,11 +193,13 @@ namespace TMDbLibTests
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/4U9fN2jsQ94GQfDGeLEe8UaReRO.jpg"); ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/4U9fN2jsQ94GQfDGeLEe8UaReRO.jpg");
ImageData poster = images.Posters.Single(s => s.FilePath == "/8VV4YUwOGxgolFZTo2SgNwsfznR.jpg"); ImageData poster = images.Posters.Single(s => s.FilePath == "/8VV4YUwOGxgolFZTo2SgNwsfznR.jpg");
ImageData logo = images.Logos.Single(s => s.FilePath == "/jIWzq9B4KPH9hyUISlma02ijTFb.png");
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }

View File

@ -153,11 +153,13 @@ namespace TMDbLibTests
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/tsRy63Mu5cu8etL1X7ZLyf7UP1M.jpg"); ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/tsRy63Mu5cu8etL1X7ZLyf7UP1M.jpg");
ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg"); ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg");
ImageData logo = images.Logos.Single(s => s.FilePath == "/chw44B2VnLha8iiTdyZcIW0ZELC.png");
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }
@ -170,11 +172,13 @@ namespace TMDbLibTests
ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/otCnAN1edreRudT5E2OHk8beiDu.jpg"); ImageData backdrop = images.Backdrops.Single(s => s.FilePath == "/otCnAN1edreRudT5E2OHk8beiDu.jpg");
ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg"); ImageData poster = images.Posters.Single(s => s.FilePath == "/ggFHVNu6YYI5L9pCfOacjizRGt.jpg");
ImageData logo = images.Logos.Single(s => s.FilePath == "/bM2bNffZlZ2UxZqwHaxr5VS3UUI.svg");
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }
@ -195,11 +199,13 @@ namespace TMDbLibTests
ImageData backdrop = null; ImageData backdrop = null;
ImageData poster = resp.Images.Posters.Single(s => s.FilePath == "/30erzlzIOtOK3k3T3BAl1GiVMP1.jpg"); ImageData poster = resp.Images.Posters.Single(s => s.FilePath == "/30erzlzIOtOK3k3T3BAl1GiVMP1.jpg");
ImageData logo = null;
await Verify(new await Verify(new
{ {
backdrop, backdrop,
poster poster,
logo
}); });
} }

View File

@ -8,12 +8,13 @@ namespace TMDbLibTests.Helpers
{ {
public static class TestImagesHelpers public static class TestImagesHelpers
{ {
private static readonly Regex ImagePathRegex = new Regex(@"^/[a-zA-Z0-9]{26,}\.(?:jpg|png)$", RegexOptions.Compiled); private static readonly Regex ImagePathRegex = new Regex(@"^/[a-zA-Z0-9]{26,}\.(?:jpg|png|svg)$", RegexOptions.Compiled);
public static void TestImagePaths(Images images) public static void TestImagePaths(Images images)
{ {
TestImagePaths(images.Backdrops); TestImagePaths(images.Backdrops);
TestImagePaths(images.Posters); TestImagePaths(images.Posters);
TestImagePaths(images.Logos);
} }
public static void TestImagePaths(IEnumerable<string> imagePaths) public static void TestImagePaths(IEnumerable<string> imagePaths)

View File

@ -1,16 +1,23 @@
{ {
backdrop: { backdrop: {
aspect_ratio: 1.777777777777778, aspect_ratio: 1.778,
file_path: <non-empty>, file_path: <non-empty>,
height: 720, height: 720,
iso_639_1: en, iso_639_1: en,
width: 1280 width: 1280
}, },
poster: { poster: {
aspect_ratio: 0.6666666666666666, aspect_ratio: 0.667,
file_path: <non-empty>, file_path: <non-empty>,
height: 2100, height: 2100,
iso_639_1: it, iso_639_1: it,
width: 1400 width: 1400
},
logo: {
aspect_ratio: 2.732,
file_path: <non-empty>,
height: 467,
iso_639_1: en,
width: 1276
} }
} }

View File

@ -1,16 +1,23 @@
{ {
backdrop: { backdrop: {
aspect_ratio: 1.777777777777778, aspect_ratio: 1.778,
file_path: <non-empty>, file_path: <non-empty>,
height: 720, height: 720,
iso_639_1: en, iso_639_1: en,
width: 1280 width: 1280
}, },
poster: { poster: {
aspect_ratio: 0.6666666666666666, aspect_ratio: 0.667,
file_path: <non-empty>, file_path: <non-empty>,
height: 2100, height: 2100,
iso_639_1: en, iso_639_1: en,
width: 1400 width: 1400
},
logo: {
aspect_ratio: 2.732,
file_path: <non-empty>,
height: 467,
iso_639_1: en,
width: 1276
} }
} }

View File

@ -1,16 +1,23 @@
{ {
backdrop: { backdrop: {
aspect_ratio: 1.777777777777778, aspect_ratio: 1.778,
file_path: <non-empty>, file_path: <non-empty>,
height: 1080, height: 1080,
iso_639_1: de, iso_639_1: de,
width: 1920 width: 1920
}, },
poster: { poster: {
aspect_ratio: 0.6666666666666666, aspect_ratio: 0.667,
file_path: <non-empty>, file_path: <non-empty>,
height: 1500, height: 1500,
iso_639_1: de, iso_639_1: de,
width: 1000 width: 1000
},
logo: {
aspect_ratio: 3.841,
file_path: <non-empty>,
height: 207,
iso_639_1: de,
width: 795
} }
} }

View File

@ -1,16 +1,23 @@
{ {
backdrop: { backdrop: {
aspect_ratio: 1.777777777777778, aspect_ratio: 1.778,
file_path: <non-empty>, file_path: <non-empty>,
height: 1080, height: 1080,
iso_639_1: en, iso_639_1: en,
width: 1920 width: 1920
}, },
poster: { poster: {
aspect_ratio: 0.6666666666666666, aspect_ratio: 0.667,
file_path: <non-empty>, file_path: <non-empty>,
height: 1800, height: 1800,
iso_639_1: en, iso_639_1: en,
width: 1200 width: 1200
},
logo: {
aspect_ratio: 1.68,
file_path: <non-empty>,
height: 219,
iso_639_1: en,
width: 368
} }
} }

View File

@ -1,15 +1,22 @@
{ {
backdrop: { backdrop: {
aspect_ratio: 1.777251184834123, aspect_ratio: 1.777,
file_path: <non-empty>, file_path: <non-empty>,
height: 1688, height: 1688,
width: 3000 width: 3000
}, },
poster: { poster: {
aspect_ratio: 0.6666666666666666, aspect_ratio: 0.667,
file_path: <non-empty>, file_path: <non-empty>,
height: 1800, height: 1800,
iso_639_1: en, iso_639_1: en,
width: 1200 width: 1200
},
logo: {
aspect_ratio: 1.68,
file_path: <non-empty>,
height: 1300,
iso_639_1: en,
width: 2184
} }
} }

View File

@ -82,7 +82,7 @@ namespace TestApplication
Console.WriteLine("Fetching images for '" + movie.Title + "'"); Console.WriteLine("Fetching images for '" + movie.Title + "'");
// Images come in two forms, each dispayed below // Images come in three forms, each dispayed below
Console.WriteLine("Displaying Backdrops"); Console.WriteLine("Displaying Backdrops");
await ProcessImages(client, movie.Images.Backdrops.Take(3), client.Config.Images.BackdropSizes); await ProcessImages(client, movie.Images.Backdrops.Take(3), client.Config.Images.BackdropSizes);
Console.WriteLine(); Console.WriteLine();
@ -91,6 +91,10 @@ namespace TestApplication
await ProcessImages(client, movie.Images.Posters.Take(3), client.Config.Images.PosterSizes); await ProcessImages(client, movie.Images.Posters.Take(3), client.Config.Images.PosterSizes);
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Displaying Logos");
await ProcessImages(client, movie.Images.Logos.Take(3), client.Config.Images.LogoSizes);
Console.WriteLine();
Spacer(); Spacer();
} }