Skip to content

Commit

Permalink
fix: move some stuffs around
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed May 24, 2024
1 parent e7a60e0 commit 37949c7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
10 changes: 4 additions & 6 deletions app/src/main/java/ani/dantotsu/parsers/OfflineAnimeParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,11 @@ class OfflineAnimeParser : AnimeParser() {
episodes.add(episode)
}
}
//episodes.sortBy { MediaNameAdapter.findEpisodeNumber(it.number) }
episodes.addAll(loadEpisodesCompat(animeLink, extra, sAnime))
//filter those with the same name
return episodes.distinctBy { it.number }
.sortedBy { MediaNameAdapter.findEpisodeNumber(it.number) }
}
return emptyList()
episodes.addAll(loadEpisodesCompat(animeLink, extra, sAnime))
//filter those with the same name
return episodes.distinctBy { it.number }
.sortedBy { MediaNameAdapter.findEpisodeNumber(it.number) }
}

override suspend fun loadVideoServers(
Expand Down
24 changes: 11 additions & 13 deletions app/src/main/java/ani/dantotsu/parsers/OfflineMangaParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ class OfflineMangaParser : MangaParser() {
chapters.add(chapter)
}
}
chapters.addAll(loadChaptersCompat(mangaLink, extra, sManga))
return chapters.distinctBy { it.number }
.sortedBy { MediaNameAdapter.findChapterNumber(it.number) }
}
return emptyList()
chapters.addAll(loadChaptersCompat(mangaLink, extra, sManga))
return chapters.distinctBy { it.number }
.sortedBy { MediaNameAdapter.findChapterNumber(it.number) }
}

override suspend fun loadImages(chapterLink: String, sChapter: SChapter): List<MangaImage> {
Expand All @@ -66,17 +65,16 @@ class OfflineMangaParser : MangaParser() {
for (image in images) {
Logger.log("imageNumber: ${image.url.url}")
}
return if (images.isNotEmpty()) {
images.sortBy { image ->
val matchResult = imageNumberRegex.find(image.url.url)
matchResult?.groups?.get(1)?.value?.toIntOrNull() ?: Int.MAX_VALUE
}
images
} else {
loadImagesCompat(chapterLink, sChapter)
}
return if (images.isNotEmpty()) {
images.sortBy { image ->
val matchResult = imageNumberRegex.find(image.url.url)
matchResult?.groups?.get(1)?.value?.toIntOrNull() ?: Int.MAX_VALUE
}
images
} else {
loadImagesCompat(chapterLink, sChapter)
}
return emptyList()
}

override suspend fun search(query: String): List<ShowResponse> {
Expand Down

0 comments on commit 37949c7

Please sign in to comment.