Parse TheMovieDB vote_average field into Artwork object
This commit is contained in:
parent
ba93efa911
commit
48c7b5e701
|
@ -293,8 +293,9 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
|
|||
String width = getString(it, "width");
|
||||
String height = getString(it, "height");
|
||||
Locale language = getStringValue(it, "iso_639_1", Locale::new);
|
||||
Double rating = getStringValue(it, "vote_average", Double::parseDouble);
|
||||
|
||||
return new Artwork(Stream.of(category, String.join("x", width, height)), image, language, null);
|
||||
return new Artwork(Stream.of(category, String.join("x", width, height)), image, language, rating);
|
||||
}).sorted(Artwork.RATING_ORDER).collect(toList());
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,8 @@ public class TMDbClientTest {
|
|||
public void getArtwork() throws Exception {
|
||||
Artwork a = db.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
|
||||
assertEquals("[backdrops, 1920x1080]", a.getTags().toString());
|
||||
assertEquals("http://image.tmdb.org/t/p/original/mQPg3iZyztfzFNwrW40nCUtXy2l.jpg", a.getUrl().toString());
|
||||
assertEquals("https://image.tmdb.org/t/p/original/mQPg3iZyztfzFNwrW40nCUtXy2l.jpg", a.getUrl().toString());
|
||||
assertEquals(6.0, a.getRating(), 1.0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -130,7 +131,7 @@ public class TMDbClientTest {
|
|||
assertEquals(null, p.getJob());
|
||||
assertEquals(null, p.getDepartment());
|
||||
assertEquals("0", p.getOrder().toString());
|
||||
assertEquals("http://image.tmdb.org/t/p/original/B7VTVtnKyFk0AtYjEbqzBQlPec.jpg", p.getImage().toString());
|
||||
assertEquals("https://image.tmdb.org/t/p/original/B7VTVtnKyFk0AtYjEbqzBQlPec.jpg", p.getImage().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue