feat(MangaDexProvider): support multiple languages for chapter filtering

This commit is contained in:
Rodrigo Verdiani 2025-12-31 13:47:01 -03:00
parent 9e44f031d2
commit b238f66e08

View File

@ -49,14 +49,16 @@ public class MangaDexProvider implements ContentProvider, ManualImportContentPro
log.warn(e.getMessage());
}
// TODO this is filtering only pt-br chapters for now, we may want to make this configurable
// NOTE: this is getting only pt-br and en chapters for now, we may want to make this configurable
// later
var languagesToImport = Map.of("pt-br", "pt-BR", "en", "en-US");
return mangas.stream()
.filter(
c ->
c.type().equals("chapter")
&& c.attributes().isUnavailable().equals(Boolean.FALSE)
&& c.attributes().translatedLanguage().equals("pt-br"))
&& languagesToImport.containsKey(c.attributes().translatedLanguage()))
.sorted(
(o1, o2) -> {
try {
@ -73,7 +75,7 @@ public class MangaDexProvider implements ContentProvider, ManualImportContentPro
c.attributes().chapter() + " - " + c.attributes().title(),
c.id().toString(),
c.attributes().chapter(),
c.attributes().translatedLanguage()))
languagesToImport.get(c.attributes().translatedLanguage())))
.toList();
} catch (Exception e) {
log.warn(e.getMessage());