1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-21 23:38:50 -05:00

Stick to 1nd pass with Manami

This commit is contained in:
Reinhard Pointner 2019-05-19 20:28:03 +07:00
parent 6d93c99376
commit 175b4df976
4 changed files with 18 additions and 5 deletions

View File

@ -33,7 +33,7 @@ import net.filebot.web.ThumbnailProvider;
public enum ThumbnailServices implements ThumbnailProvider {
TheTVDB, TheMovieDB;
TheTVDB, TheMovieDB, AniDB;
protected String getResource(String file) {
return "https://api.filebot.net/images/" + name().toLowerCase() + "/thumb/poster/" + file;

View File

@ -28,11 +28,13 @@ import net.filebot.media.LocalDatasource;
import net.filebot.similarity.MetricAvg;
import net.filebot.web.AcoustIDClient;
import net.filebot.web.AnidbClient;
import net.filebot.web.Artwork;
import net.filebot.web.Datasource;
import net.filebot.web.EpisodeListProvider;
import net.filebot.web.FanartTVClient;
import net.filebot.web.ID3Lookup;
import net.filebot.web.LocalSearch;
import net.filebot.web.Manami;
import net.filebot.web.Movie;
import net.filebot.web.MovieIdentificationService;
import net.filebot.web.MusicIdentificationService;
@ -240,7 +242,7 @@ public final class WebServices {
}
}
public static class AnidbClientWithLocalSearch extends AnidbClient {
public static class AnidbClientWithLocalSearch extends AnidbClient implements ThumbnailProvider {
public AnidbClientWithLocalSearch(String client, int clientver) {
super(client, clientver);
@ -250,6 +252,16 @@ public final class WebServices {
public SearchResult[] getAnimeTitles() throws Exception {
return releaseInfo.getAnidbIndex();
}
@Override
public List<Artwork> getArtwork(int id, String category, Locale locale) throws Exception {
return Manami.AniDB.getArtwork(id, category, locale);
}
@Override
public Map<SearchResult, Icon> getThumbnails(List<SearchResult> keys, ResolutionVariant variant) throws Exception {
return ThumbnailServices.AniDB.getThumbnails(keys, variant);
}
}
public static class OpenSubtitlesClientWithLocalSearch extends OpenSubtitlesClient {

View File

@ -5,6 +5,7 @@ import static java.util.stream.Collectors.*;
import static net.filebot.CachedResource.*;
import static net.filebot.util.JsonUtilities.*;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@ -34,9 +35,9 @@ public enum Manami implements ArtworkProvider {
public List<Artwork> getArtwork(int id, String category, Locale locale) throws Exception {
List<Artwork> artwork = new ArrayList<Artwork>(1);
Optional<String> picture = getRecord(id).map(r -> getString(r, "picture")).filter(r -> r.endsWith(".jpg"));
Optional<URI> picture = getRecord(id).map(r -> getStringValue(r, "picture", URI::create)).filter(r -> r.getPath().endsWith(".jpg"));
if (picture.isPresent()) {
artwork.add(new Artwork(Stream.of("picture"), new URL(picture.get()), null, null));
artwork.add(new Artwork(Stream.of("picture"), picture.get().toURL(), null, null));
}
return artwork;

View File

@ -10,7 +10,7 @@ public interface ThumbnailProvider {
Map<SearchResult, Icon> getThumbnails(List<SearchResult> keys, ResolutionVariant variant) throws Exception;
enum ResolutionVariant {
public static enum ResolutionVariant {
NORMAL(1), RETINA(2);