Skip to content

Commit

Permalink
Merge branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jmir1 committed Feb 10, 2023
2 parents a2f1874 + 71dac9a commit 9d3dcb0
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface SAnime {

var thumbnail_url: String?

var update_strategy: UpdateStrategy

var initialized: Boolean

companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package eu.kanade.tachiyomi.animesource.model

enum class UpdateStrategy {
ALWAYS_UPDATE,
ONLY_FETCH_ONCE
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.animesource.online
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.animesource.AnimeCatalogueSource
import eu.kanade.tachiyomi.animesource.model.*
import eu.kanade.tachiyomi.network.GET
import okhttp3.Headers
import okhttp3.OkHttpClient
import okhttp3.Request
Expand Down Expand Up @@ -270,15 +269,37 @@ abstract class AnimeHttpSource : AnimeCatalogueSource {
throw Exception("Stub!")
}


/**
* Returns the url of the provided anime
*
* @since extensions-lib 14
* @param anime the anime
* @return url of the anime
*/
open fun getAnimeUrl(anime: SAnime): String {
throw Exception("Stub!")
}

/**
* Returns the url of the provided episode
*
* @since extensions-lib 14
* @param episode the episode
* @return url of the episode
*/
open fun getEpisodeUrl(episode: SEpisode): String {
throw Exception("Stub!")
}

/**
* Called before inserting a new episode into database. Use it if you need to override episode
* fields, like the title or the episode number. Do not change anything to [anime].
*
* @param episode the episode to be added.
* @param anime the anime of the episode.
*/
open fun prepareNewEpisode(episode: SEpisode, anime: SAnime) {
}
open fun prepareNewEpisode(episode: SEpisode, anime: SAnime) {}

/**
* Returns the list of filters for the source.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package eu.kanade.tachiyomi.network

import android.content.Context

/**
* Util for evaluating JavaScript in sources.
*/
class JavaScriptEngine(context: Context) {

/**
* Evaluate arbitrary JavaScript code and get the result as a primtive type
* (e.g., String, Int).
*
* @since extensions-lib 14
* @param script JavaScript to execute.
* @return Result of JavaScript code as a primitive type.
*/
suspend fun <T> evaluate(script: String): T = throw Exception("Stub!")
}
11 changes: 11 additions & 0 deletions library/src/main/java/eu/kanade/tachiyomi/network/Requests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.network

import okhttp3.CacheControl
import okhttp3.Headers
import okhttp3.HttpUrl
import okhttp3.Request
import okhttp3.RequestBody

Expand All @@ -16,6 +17,16 @@ fun GET(url: String,
throw Exception("Stub!")
}

/**
* @since extensions-lib 14
*/
fun GET(url: HttpUrl,
headers: Headers = DEFAULT_HEADERS,
cache: CacheControl = DEFAULT_CACHE_CONTROL): Request {

throw Exception("Stub!")
}

fun POST(url: String,
headers: Headers = DEFAULT_HEADERS,
body: RequestBody = DEFAULT_BODY,
Expand Down

0 comments on commit 9d3dcb0

Please sign in to comment.