Fix TheTVDB artwork rating issues

This commit is contained in:
Reinhard Pointner 2016-05-08 20:31:06 +08:00
parent f5304a93d4
commit ef14db36cb
2 changed files with 7 additions and 6 deletions

View File

@ -251,7 +251,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider implements Artwor
String subKey = getString(it, "subKey"); String subKey = getString(it, "subKey");
String fileName = getString(it, "fileName"); String fileName = getString(it, "fileName");
String resolution = getString(it, "resolution"); String resolution = getString(it, "resolution");
Double rating = getDecimal(getString(it, "ratingsInfo"), "average"); Double rating = getDecimal(getMap(it, "ratingsInfo"), "average");
return new Artwork(this, Stream.of(category, subKey, resolution), resolveBanner(fileName), locale, rating); return new Artwork(this, Stream.of(category, subKey, resolution), resolveBanner(fileName), locale, rating);
} catch (Exception e) { } catch (Exception e) {

View File

@ -140,13 +140,14 @@ public class TheTVDBClientTest {
} }
@Test @Test
public void getImages() throws Exception { public void getArtwork() throws Exception {
Artwork i = thetvdb.getArtwork(buffy.getId(), "fanart", Locale.ENGLISH).get(0); Artwork i = thetvdb.getArtwork(buffy.getId(), "fanart", Locale.ENGLISH).get(0);
assertEquals("[fanart, 1280x720]", i.getTags().toString()); assertEquals("[fanart, 1920x1080]", i.getTags().toString());
assertEquals("http://thetvdb.com/banners/fanart/original/70327-1.jpg", i.getUrl().toString()); assertEquals("http://thetvdb.com/banners/fanart/original/70327-7.jpg", i.getUrl().toString());
assertTrue(i.matches("fanart", "1280x720")); assertTrue(i.matches("fanart", "1920x1080"));
assertFalse(i.matches("fanart", "1280x720", "1")); assertFalse(i.matches("fanart", "1920x1080", "1"));
assertEquals(8.0, i.getRating(), 1.0);
} }
} }