Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from mihon & introduce new aniyomi functions #16

Open
wants to merge 41 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a9301f8
Bump dependencies
Secozzi Jan 27, 2025
ec5e4ec
Add language and new methods in Source (#2)
Secozzi Jan 27, 2025
d3fcb34
Change some overrides to stub
Secozzi Jan 27, 2025
243417d
Fix build
Secozzi Jan 27, 2025
9f81b46
New API for user agent (#4)
Secozzi Jan 27, 2025
354e00d
Tweak rateLimit API (#3)
Secozzi Jan 27, 2025
8482696
ConfigurableSource: add methods to get source specific shared prefere…
Secozzi Jan 27, 2025
beca132
suspend variant of popular and latest methods (#7)
Secozzi Jan 27, 2025
d7d09b2
move preference getting function to Source (#8)
Secozzi Jan 27, 2025
fa680fd
Change Exception to RuntimeException
Secozzi Jan 27, 2025
1afcf16
Tweak and cleanup
Secozzi Jan 27, 2025
a67a053
Bump to Kotlin 2.1.0
Secozzi Jan 27, 2025
dc8c1a5
Add json util functions
Secozzi Jan 27, 2025
d2fc497
Update .gitignore
Secozzi Jan 27, 2025
52f2930
Add binary compatibility validator
Secozzi Jan 27, 2025
3ea3cd6
Add Ksoup with utils
Secozzi Jan 27, 2025
ebef1a7
Rework Json utils
Secozzi Jan 27, 2025
09406da
Rework network rate limit utils
Secozzi Jan 27, 2025
30b166c
Move source util functions for getting preferences
Secozzi Jan 27, 2025
acfeee9
Add deprecation replace with for cloudflare client
Secozzi Jan 27, 2025
4239876
Rework collections utils
Secozzi Jan 27, 2025
659ba9e
Rework 'UserAgentType.Any' and 'UserAgentType.Managed'
Secozzi Jan 27, 2025
233c451
Deprecate Jsoup util function and encourage Ksoup
Secozzi Jan 27, 2025
a06e800
Deprecate ParsedHttpSource
Secozzi Jan 27, 2025
670b3a6
Clean up javadoc and deprecation messages also organize code
Secozzi Jan 27, 2025
6c6675b
Merge 'getMangaDetails' and 'getChapterList'
Secozzi Jan 27, 2025
aa1aec9
Cleanup for 1.6 release (#9)
Secozzi Jan 27, 2025
697df63
fix javadoc
Secozzi Jan 27, 2025
2b03321
remove fetchXXX functions
Secozzi Jan 27, 2025
5db2421
remove unused & unnecessary functions
Secozzi Jan 27, 2025
6da6ccc
Implement resolveVideo & new hoster apis
Secozzi Jan 27, 2025
d133384
Bump version, move Hoster, and deprecate old coroutine functions
Secozzi Jan 27, 2025
e333ede
Mark as release candidate
Secozzi Jan 27, 2025
5ffa531
Add back transforming `parseAs` functions
Secozzi Jan 31, 2025
01d11e0
Inline some of the rate limit functions
Secozzi Feb 25, 2025
b605a47
Remove network from HttpSource
Secozzi Feb 25, 2025
88889bc
Add new request util functions
Secozzi Feb 25, 2025
1f47a00
Remove Source.hasSearchFilters and getMangaList filters nullable
Secozzi Feb 25, 2025
6b94938
Remove `getXXX` functions from `AnimeHttpSource`
Secozzi Feb 25, 2025
5a324c4
Update api spec
Secozzi Feb 25, 2025
24cd07a
feat(SEpisode): Add support for fillermarking, summaries and thumbnai…
quickdesh Feb 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Build files
.gradle
/local.properties
/.idea/workspace.xml
.DS_Store
/build
.idea/
*iml
*.iml
*/build
.kotlin
build

# IDE files
.idea

# Configuration files
local.properties

# macOS specific files
.DS_Store
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.dokkatoo) apply false
alias(libs.plugins.binary.compatibility.validator) apply false
}

tasks.register<Delete>("clean") {
Expand Down
13 changes: 8 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
[versions]
agp_version = "8.2.1"
coroutines_version = "1.7.1"
kotlin_version = "1.9.21"
serialization_version = "1.5.1"
kotlin_version = "2.1.0"
serialization_version = "1.8.0"
dokkatoo_version = "2.1.0"
binary_compat_validator_version = "0.17.0"

[libraries]
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines_version" }

kotlin-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization_version" }
kotlin-json-okio = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json-okio", version.ref = "serialization_version" }

injekt-core = { module = "com.github.inorichi.injekt:injekt-core", version = "65b0440" }
jsoup = { module = "org.jsoup:jsoup", version = "1.16.1" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.11" }
injekt-core = { module = "com.github.mihonapp:injekt", version = "91edab2317" }
jsoup = { module = "org.jsoup:jsoup", version = "1.18.3" }
ksoup = { module = "com.fleeksoft.ksoup:ksoup", version = "0.2.1" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "5.0.0-alpha.14" }
rxandroid = { module = "io.reactivex:rxandroid", version = "1.2.1" }
rxjava = { module = "io.reactivex:rxjava", version = "1.3.8" }

[plugins]
android-library = { id = "com.android.library", version.ref = "agp_version" }
dokkatoo = { id = "dev.adamko.dokkatoo", version.ref = "dokkatoo_version" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin_version" }
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary_compat_validator_version" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
714 changes: 714 additions & 0 deletions library/api/library.api

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ plugins {
alias(libs.plugins.kotlin.android)
`maven-publish`
alias(libs.plugins.dokkatoo)
alias(libs.plugins.binary.compatibility.validator)
}

val ver = "14"
val ver = "16-rc1"
version = ver
group = "com.github.aniyomiorg"

Expand All @@ -35,11 +36,19 @@ android {
kotlinOptions {
jvmTarget = javaVersion.toString()
}

publishing {
singleVariant("release") {
withJavadocJar()
withSourcesJar()
}
}
}

dependencies {
compileOnly(libs.okhttp)
compileOnly(libs.jsoup)
compileOnly(libs.ksoup)
compileOnly(libs.rxjava)
compileOnly(libs.rxandroid)
compileOnly(libs.injekt.core)
Expand Down Expand Up @@ -111,6 +120,7 @@ dokkatoo {
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "com.github.aniyomiorg"
artifactId = "extensions-lib"

afterEvaluate {
Expand Down
32 changes: 32 additions & 0 deletions library/src/main/java/aniyomix/source/model/Hoster.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@file:Suppress("UNUSED")

package aniyomix.source.model

import eu.kanade.tachiyomi.animesource.model.Video

/**
* Data class for representing a hoster
*
* @since extensions-lib 16
*
* @property hosterUrl url of hoster
* @property hosterName name of hoster
* @property videoList initial list of videos, if any
* @property internalData data used by the extension. Useful for getting videos
*/
data class Hoster(
val hosterUrl: String = "",
val hosterName: String = "",
val videoList: List<Video>? = null,
val internalData: String = "",
) {
/**
* Used for sites that doesn't have the concept of hosters. To use this, return a list of a
* single hoster, with `hosterName` set to `Hoster.NO_HOSTER_LIST` and a non-null video list.
*
* @since extensions-lib 16
*/
companion object {
const val NO_HOSTER_LIST = "no_hoster_list"
}
}
36 changes: 36 additions & 0 deletions library/src/main/java/aniyomix/utils/coroutines.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package aniyomix.utils

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.withContext

/**
* Parallel implementation of [Iterable.map].
*
* @since extensions-lib 16
*/
suspend inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> =
withContext(Dispatchers.IO) {
map { async { f(it) } }.awaitAll()
}

/**
* Parallel implementation of [Iterable.mapNotNull].
*
* @since extensions-lib 16
*/
suspend inline fun <A, B> Iterable<A>.parallelMapNotNull(crossinline f: suspend (A) -> B?): List<B> =
withContext(Dispatchers.IO) {
map { async { f(it) } }.awaitAll().filterNotNull()
}

/**
* Parallel implementation of [Iterable.flatMap].
*
* @since extensions-lib 16
*/
suspend inline fun <A, B> Iterable<A>.parallelFlatMap(crossinline f: suspend (A) -> Iterable<B>): List<B> =
withContext(Dispatchers.IO) {
map { async { f(it) } }.awaitAll().flatten()
}
4 changes: 2 additions & 2 deletions library/src/main/java/eu/kanade/tachiyomi/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ object AppInfo {
*
* @since extension-lib 13
*/
fun getVersionCode(): Int = throw Exception("Stub!")
fun getVersionCode(): Int = throw RuntimeException("Stub!")

/**
* Version name of the host application. May be useful for sharing as User-Agent information.
* Note that this value differs between forks so logic should not rely on it.
*
* @since extension-lib 13
*/
fun getVersionName(): String = throw Exception("Stub!")
fun getVersionName(): String = throw RuntimeException("Stub!")
}
Original file line number Diff line number Diff line change
@@ -1,73 +1,71 @@
@file:Suppress("UNUSED")

package eu.kanade.tachiyomi.animesource

import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import eu.kanade.tachiyomi.animesource.model.AnimesPage
import rx.Observable

@Deprecated(
message = "Use the base AnimeSource class instead",
replaceWith = ReplaceWith(
expression = "AnimeSource",
imports = ["eu.kanade.tachiyomi.animesource.AnimeSource"]
)
)
interface AnimeCatalogueSource : AnimeSource {

/**
* An ISO 639-1 compliant language code (two letters in lower case).
*/
val lang: String
override val language: String get() = throw RuntimeException("Stub!")

/**
* Whether the source has support for latest updates.
*/
val supportsLatest: Boolean
override val hasLatestListing: Boolean get() = throw RuntimeException("Stub!")

/**
* Get a page with a list of anime.
*
* @since extensions-lib 14
* @param page the page number to retrieve.
*/
suspend fun getPopularAnime(page: Int): AnimesPage {
throw Exception("Stub!")
}
override suspend fun getSearchFilters(): AnimeFilterList = throw RuntimeException("Stub!")

override suspend fun getDefaultAnimeList(page: Int): AnimesPage = throw RuntimeException("Stub!")

override suspend fun getLatestAnimeList(page: Int): AnimesPage = throw RuntimeException("Stub!")

override suspend fun getAnimeList(
query: String,
filters: AnimeFilterList?,
page: Int
): AnimesPage = throw RuntimeException("Stub!")

/**
* Get a page with a list of anime.
*
* @since extensions-lib 14
* @param page the page number to retrieve.
* @param query the search query.
* @param filters the list of filters to apply.
* An ISO 639-1 compliant language code (two letters in lower case).
*/
suspend fun getSearchAnime(page: Int, query: String, filters: AnimeFilterList): AnimesPage {
throw Exception("Stub!")
}
@Deprecated("Use language instead", ReplaceWith("language"))
val lang: String get() = throw RuntimeException("Stub!")

/**
* Get a page with a list of latest anime updates.
*
* @since extensions-lib 14
* @param page the page number to retrieve.
* Whether the source has support for latest updates.
*/
suspend fun getLatestUpdates(page: Int): AnimesPage {
throw Exception("Stub!")
}
@Deprecated("Use hasLatestListing instead", ReplaceWith("hasLatestListing"))
val supportsLatest: Boolean get() = throw RuntimeException("Stub!")

/**
* Returns the list of filters for the source.
*/
fun getFilterList(): AnimeFilterList
@Deprecated("Use the new suspend API instead", ReplaceWith("getSearchFilters"))
fun getFilterList(): AnimeFilterList = throw RuntimeException("Stub!")

@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getPopularAnime"),
message = "Use getDefaultAnimeList instead",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("getDefaultAnimeList")
)
fun fetchPopularAnime(page: Int): Observable<AnimesPage>
suspend fun getPopularAnime(page: Int): AnimesPage = throw RuntimeException("Stub!")

@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getSearchAnime"),
message = "Use getLatestAnimeList instead",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("getLatestAnimeList")
)
fun fetchSearchAnime(page: Int, query: String, filters: AnimeFilterList): Observable<AnimesPage>
suspend fun getLatestUpdates(page: Int): AnimesPage = throw RuntimeException("Stub!")

@Deprecated(
"Use the non-RxJava API instead",
ReplaceWith("getLatestUpdates"),
message = "Use getAnimeList instead",
level = DeprecationLevel.ERROR,
replaceWith = ReplaceWith("getAnimeList(query, filters, page)")
)
fun fetchLatestUpdates(page: Int): Observable<AnimesPage>
suspend fun getSearchAnime(page: Int, query: String, filters: AnimeFilterList): AnimesPage = throw RuntimeException("Stub!")
}
Loading