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

Add anime-lists parser

* https://github.com/ScudLee/anime-lists
This commit is contained in:
Reinhard Pointner 2019-06-08 04:46:30 +07:00
parent 9360bc9e65
commit e9af2bb216
2 changed files with 35 additions and 18 deletions

View File

@ -65,6 +65,7 @@ import net.filebot.mediainfo.MediaInfoException;
import net.filebot.similarity.Normalization;
import net.filebot.similarity.SimilarityComparator;
import net.filebot.util.FileUtilities;
import net.filebot.web.AnimeLists;
import net.filebot.web.AudioTrack;
import net.filebot.web.Episode;
import net.filebot.web.EpisodeFormat;
@ -792,22 +793,6 @@ public class MediaBindingBean {
});
}
@Define("xem")
public DynamicBindings getXrossEntityMapper() {
return new DynamicBindings(XEM::names, k -> {
if (infoObject instanceof Episode) {
Episode e = getEpisode();
XEM origin = XEM.forName(e.getSeriesInfo().getDatabase());
XEM destination = XEM.forName(k);
if (origin == destination) {
return e;
}
return origin.map(e, destination).orElse(e);
}
return undefined(k);
});
}
@Define("az")
public String getSortInitial() {
try {
@ -1162,6 +1147,38 @@ public class MediaBindingBean {
return new FFProbe().open(getInferredMediaFile());
}
@Define("XEM")
public DynamicBindings getXrossEntityMapper() {
return new DynamicBindings(XEM::names, k -> {
if (infoObject instanceof Episode) {
Episode e = getEpisode();
XEM origin = XEM.forName(e.getSeriesInfo().getDatabase());
XEM destination = XEM.forName(k);
if (origin == destination) {
return e;
}
return origin.map(e, destination).orElse(e);
}
return undefined(k);
});
}
@Define("AnimeLists")
public DynamicBindings getAnimeLists() {
return new DynamicBindings(AnimeLists::names, k -> {
if (infoObject instanceof Episode) {
Episode e = getEpisode();
AnimeLists origin = AnimeLists.forName(e.getSeriesInfo().getDatabase());
AnimeLists destination = AnimeLists.forName(k);
if (origin == destination) {
return e;
}
return origin.map(e, destination).orElse(e);
}
return undefined(k);
});
}
public SeriesInfo getPrimarySeriesInfo() {
if (TheTVDB.getIdentifier().equals(getSeriesInfo().getDatabase())) {
try {

View File

@ -14,11 +14,11 @@ import java.util.function.Function;
public final class EpisodeUtilities {
private static Episode mapEpisode(Episode episode, Function<Episode, Episode> mapper) {
public static Episode mapEpisode(Episode episode, Function<Episode, Episode> mapper) {
return createEpisode(getMultiEpisodeList(episode).stream().map(mapper).sorted(EPISODE_NUMBERS_COMPARATOR).collect(toList()));
}
private static Episode selectEpisode(List<Episode> episodelist, Episode selection) {
public static Episode selectEpisode(List<Episode> episodelist, Episode selection) {
return createEpisode(episodelist.stream().filter(getMultiEpisodeList(selection)::contains).sorted(EPISODE_NUMBERS_COMPARATOR).collect(toList()));
}