Initial commit
This commit is contained in:
commit
98ed7e8839
2263 changed files with 108711 additions and 0 deletions
8
src/en/superstream/build.gradle
Normal file
8
src/en/superstream/build.gradle
Normal file
|
@ -0,0 +1,8 @@
|
|||
ext {
|
||||
extName = 'SuperStream'
|
||||
extClass = '.SuperStream'
|
||||
extVersionCode = 11
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
BIN
src/en/superstream/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/en/superstream/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.4 KiB |
BIN
src/en/superstream/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/en/superstream/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
src/en/superstream/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/en/superstream/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
src/en/superstream/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/en/superstream/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
src/en/superstream/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/en/superstream/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
src/en/superstream/res/web_hi_res_512.png
Normal file
BIN
src/en/superstream/res/web_hi_res_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 210 KiB |
|
@ -0,0 +1,289 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.superstream
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonElement
|
||||
|
||||
@Serializable
|
||||
data class LinkData(
|
||||
val id: Int,
|
||||
val type: Int,
|
||||
val season: Int?,
|
||||
val episode: Int?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class LinkDataProp(
|
||||
val code: Int? = null,
|
||||
val msg: String? = null,
|
||||
val data: ParsedLinkData? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ParsedLinkData(
|
||||
val seconds: Int? = null,
|
||||
val quality: ArrayList<String> = arrayListOf(),
|
||||
val list: ArrayList<LinkList> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class LinkList(
|
||||
val path: String? = null,
|
||||
val quality: String? = null,
|
||||
val real_quality: String? = null,
|
||||
val format: String? = null,
|
||||
val size: String? = null,
|
||||
val size_bytes: Long? = null,
|
||||
val count: Int? = null,
|
||||
val dateline: Long? = null,
|
||||
val fid: Int? = null,
|
||||
val mmfid: Int? = null,
|
||||
val h265: Int? = null,
|
||||
val hdr: Int? = null,
|
||||
val filename: String? = null,
|
||||
val original: Int? = null,
|
||||
val colorbit: Int? = null,
|
||||
val success: Int? = null,
|
||||
val timeout: Int? = null,
|
||||
val vip_link: Int? = null,
|
||||
val fps: Int? = null,
|
||||
val bitstream: String? = null,
|
||||
val width: Int? = null,
|
||||
val height: Int? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class LoadData(
|
||||
val id: Int,
|
||||
val type: Int?,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class DataJSON(
|
||||
val data: ArrayList<ListJSON> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class ListJSON(
|
||||
val code: Int? = null,
|
||||
val type: String? = null,
|
||||
val name: String? = null,
|
||||
val box_type: Int? = null,
|
||||
val list: ArrayList<PostJSON> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PostJSON(
|
||||
val id: Int? = null,
|
||||
val title: String? = null,
|
||||
val poster: String? = null,
|
||||
val poster_2: String? = null,
|
||||
val box_type: Int? = null,
|
||||
val imdb_rating: String? = null,
|
||||
val quality_tag: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MainData(
|
||||
val data: ArrayList<Data> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Data(
|
||||
val id: Int? = null,
|
||||
val mid: Int? = null,
|
||||
val tid: Int? = null,
|
||||
val box_type: Int? = null,
|
||||
val title: String? = null,
|
||||
val poster_org: String? = null,
|
||||
val poster: String? = null,
|
||||
val cats: String? = null,
|
||||
val year: Int? = null,
|
||||
val imdb_rating: String? = null,
|
||||
val quality_tag: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MovieDataProp(
|
||||
val data: MovieData? = MovieData(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class MovieData(
|
||||
val id: Int? = null,
|
||||
val title: String? = null,
|
||||
val director: String? = null,
|
||||
val writer: String? = null,
|
||||
val actors: String? = null,
|
||||
val runtime: Int? = null,
|
||||
val poster: String? = null,
|
||||
val description: String? = null,
|
||||
val cats: String? = null,
|
||||
val year: Int? = null,
|
||||
val update_time: Int? = null,
|
||||
val imdbId: String? = null,
|
||||
val imdb_rating: String? = null,
|
||||
val trailer: String? = null,
|
||||
val released: String? = null,
|
||||
val content_rating: String? = null,
|
||||
val tmdb_id: Int? = null,
|
||||
val tomatoMeter: Int? = null,
|
||||
val poster_org: String? = null,
|
||||
val trailer_url: String? = null,
|
||||
val imdb_link: String? = null,
|
||||
val box_type: Int? = null,
|
||||
val recommend: List<Data> = listOf(), // series does not have any recommendations :pensive:
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SeriesDataProp(
|
||||
val code: Int? = null,
|
||||
val msg: String? = null,
|
||||
val data: SeriesData? = SeriesData(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SeriesLanguage(
|
||||
val title: String? = null,
|
||||
val lang: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SeriesData(
|
||||
val id: Int? = null,
|
||||
val mb_id: Int? = null,
|
||||
val title: String? = null,
|
||||
val display: Int? = null,
|
||||
val state: Int? = null,
|
||||
val vip_only: Int? = null,
|
||||
val code_file: Int? = null,
|
||||
val director: String? = null,
|
||||
val writer: String? = null,
|
||||
val actors: String? = null,
|
||||
val add_time: Int? = null,
|
||||
val poster: String? = null,
|
||||
val poster_imdb: Int? = null,
|
||||
val banner_mini: String? = null,
|
||||
val description: String? = null,
|
||||
val imdb_id: String? = null,
|
||||
val cats: String? = null,
|
||||
val year: Int? = null,
|
||||
val collect: Int? = null,
|
||||
val view: Int? = null,
|
||||
val download: Int? = null,
|
||||
val update_time: JsonElement? = null,
|
||||
val released: String? = null,
|
||||
val released_timestamp: Int? = null,
|
||||
val episode_released: String? = null,
|
||||
val episode_released_timestamp: Int? = null,
|
||||
val max_season: Int? = null,
|
||||
val max_episode: Int? = null,
|
||||
val remark: String? = null,
|
||||
val imdb_rating: String? = null,
|
||||
val content_rating: String? = null,
|
||||
val tmdb_id: Int? = null,
|
||||
val tomato_url: String? = null,
|
||||
val tomato_meter: Int? = null,
|
||||
val tomato_meter_count: Int? = null,
|
||||
val tomato_meter_state: String? = null,
|
||||
val reelgood_url: String? = null,
|
||||
val audience_score: Int? = null,
|
||||
val audience_score_count: Int? = null,
|
||||
val no_tomato_url: Int? = null,
|
||||
val order_year: Int? = null,
|
||||
val episodate_id: String? = null,
|
||||
val weights_day: Double? = null,
|
||||
val poster_min: String? = null,
|
||||
val poster_org: String? = null,
|
||||
val banner_mini_min: String? = null,
|
||||
val banner_mini_org: String? = null,
|
||||
val trailer_url: String? = null,
|
||||
val years: ArrayList<Int> = arrayListOf(),
|
||||
val season: ArrayList<Int> = arrayListOf(),
|
||||
val history: ArrayList<String> = arrayListOf(),
|
||||
val imdb_link: String? = null,
|
||||
val episode: ArrayList<SeriesEpisode> = arrayListOf(),
|
||||
val language: ArrayList<SeriesLanguage> = arrayListOf(),
|
||||
val box_type: Int? = null,
|
||||
val year_year: String? = null,
|
||||
val season_episode: String? = null,
|
||||
val recommend: List<Data> = listOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SeriesSeasonProp(
|
||||
val code: Int? = null,
|
||||
val msg: String? = null,
|
||||
val data: ArrayList<SeriesEpisode>? = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SeriesEpisode(
|
||||
val id: Int? = null,
|
||||
val tid: Int? = null,
|
||||
val mb_id: Int? = null,
|
||||
val imdb_id: String? = null,
|
||||
val imdb_id_status: Int? = null,
|
||||
val srt_status: Int? = null,
|
||||
val season: Int? = null,
|
||||
val episode: Int? = null,
|
||||
val state: Int? = null,
|
||||
val title: String? = null,
|
||||
val thumbs: String? = null,
|
||||
val thumbs_bak: String? = null,
|
||||
val thumbs_original: String? = null,
|
||||
val poster_imdb: Int? = null,
|
||||
val synopsis: String? = null,
|
||||
val runtime: Int? = null,
|
||||
val view: Int? = null,
|
||||
val download: Int? = null,
|
||||
val source_file: Int? = null,
|
||||
val code_file: Int? = null,
|
||||
val add_time: Int? = null,
|
||||
val update_time: Int? = null,
|
||||
val released: String? = null,
|
||||
val released_timestamp: Long? = null,
|
||||
val audio_lang: String? = null,
|
||||
val quality_tag: String? = null,
|
||||
val remark: String? = null,
|
||||
val pending: String? = null,
|
||||
val imdb_rating: String? = null,
|
||||
val display: Int? = null,
|
||||
val sync: Int? = null,
|
||||
val tomato_meter: Int? = null,
|
||||
val imdb_link: String? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SubtitleList(
|
||||
val language: String? = null,
|
||||
val subtitles: ArrayList<Subtitles> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class Subtitles(
|
||||
val sid: Int? = null,
|
||||
val mid: String? = null,
|
||||
val file_path: String? = null,
|
||||
val lang: String? = null,
|
||||
val language: String? = null,
|
||||
val delay: Int? = null,
|
||||
val point: JsonElement? = null,
|
||||
val order: Int? = null,
|
||||
val admin_order: Int? = null,
|
||||
val myselect: Int? = null,
|
||||
val add_time: Long? = null,
|
||||
val count: Int? = null,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class PrivateSubtitleData(
|
||||
val select: ArrayList<String> = arrayListOf(),
|
||||
val list: ArrayList<SubtitleList> = arrayListOf(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class SubtitleDataProp(
|
||||
val code: Int? = null,
|
||||
val msg: String? = null,
|
||||
val data: PrivateSubtitleData? = PrivateSubtitleData(),
|
||||
)
|
|
@ -0,0 +1,239 @@
|
|||
package eu.kanade.tachiyomi.animeextension.en.superstream
|
||||
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import android.widget.Toast
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.Response
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Date
|
||||
|
||||
@ExperimentalSerializationApi
|
||||
class SuperStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
|
||||
override val name = "SuperStream"
|
||||
|
||||
override val lang = "en"
|
||||
|
||||
override val supportsLatest = true
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
private val preferences: SharedPreferences = Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
|
||||
private val hideNsfw = if (preferences.getBoolean(PREF_HIDE_NSFW_KEY, PREF_HIDE_NSFW_DEFAULT)) 1 else 0
|
||||
|
||||
private val superStreamAPI = SuperStreamAPI(json, hideNsfw)
|
||||
|
||||
override val baseUrl = superStreamAPI.apiUrl
|
||||
|
||||
override suspend fun getPopularAnime(page: Int): AnimesPage {
|
||||
val animes = superStreamAPI.getMainPage(page)
|
||||
return animes
|
||||
}
|
||||
|
||||
override fun popularAnimeRequest(page: Int) = throw UnsupportedOperationException()
|
||||
|
||||
override fun popularAnimeParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
override suspend fun getEpisodeList(anime: SAnime): List<SEpisode> {
|
||||
val data = superStreamAPI.load(anime.url)
|
||||
val episodes = mutableListOf<SEpisode>()
|
||||
val (movie, seriesData) = data
|
||||
val (_, series) = seriesData
|
||||
movie?.let { mov ->
|
||||
mov.id?.let {
|
||||
episodes.add(
|
||||
SEpisode.create().apply {
|
||||
url = LinkData(mov.id, mov.box_type ?: 1, 0, 1).toJson()
|
||||
name = "Movie"
|
||||
date_upload = getDateTime(mov.update_time)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
series?.mapNotNull { ser ->
|
||||
ser.id?.let {
|
||||
if (ser.source_file!! == 1) {
|
||||
episodes.add(
|
||||
SEpisode.create().apply {
|
||||
url = LinkData(ser.tid ?: ser.id, 2, ser.season, ser.episode).toJson()
|
||||
episode_number = ser.episode?.toFloat() ?: 0F
|
||||
name = "Season ${ser.season} Ep ${ser.episode}: ${ser.title}"
|
||||
date_upload = getDateTime(ser.update_time)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
return episodes
|
||||
}
|
||||
|
||||
override fun episodeListParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
override suspend fun getLatestUpdates(page: Int): AnimesPage {
|
||||
val animes = superStreamAPI.getLatest(page)
|
||||
return animes
|
||||
}
|
||||
|
||||
override fun latestUpdatesParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException()
|
||||
|
||||
override suspend fun getVideoList(episode: SEpisode): List<Video> {
|
||||
val videos = superStreamAPI.loadLinks(episode.url)
|
||||
val sortedVideos = videos.sort()
|
||||
return sortedVideos
|
||||
}
|
||||
|
||||
override fun videoListParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString("preferred_quality", "1080")
|
||||
|
||||
if (quality != null) {
|
||||
val newList = mutableListOf<Video>()
|
||||
var preferred = 0
|
||||
for (video in this) {
|
||||
if (video.quality.contains(quality)) {
|
||||
newList.add(preferred, video)
|
||||
preferred++
|
||||
} else {
|
||||
newList.add(video)
|
||||
}
|
||||
}
|
||||
return newList
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
override suspend fun getSearchAnime(
|
||||
page: Int,
|
||||
query: String,
|
||||
filters: AnimeFilterList,
|
||||
): AnimesPage {
|
||||
val searchResult = superStreamAPI.search(page, query)
|
||||
return AnimesPage(searchResult, searchResult.size == 20)
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) = throw UnsupportedOperationException()
|
||||
|
||||
override fun searchAnimeParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
override suspend fun getAnimeDetails(anime: SAnime): SAnime {
|
||||
val data = superStreamAPI.load(anime.url)
|
||||
val ani = SAnime.create()
|
||||
val (movie, seriesData) = data
|
||||
val (detail, _) = seriesData
|
||||
if (movie != null) {
|
||||
ani.title = movie.title ?: "Movie"
|
||||
ani.genre = movie.cats!!.split(",").let { genArray ->
|
||||
genArray.joinToString { genList -> genList.replaceFirstChar { gen -> gen.uppercase() } }
|
||||
}
|
||||
ani.status = SAnime.COMPLETED
|
||||
ani.author = movie.writer?.substringBefore(",")
|
||||
ani.artist = movie.director?.substringBefore(",")
|
||||
|
||||
ani.description = (if (movie.description.isNullOrBlank()) "" else movie.description + "\n\n") +
|
||||
(if (movie.released.isNullOrBlank().not()) "Released: " + movie.released else "") +
|
||||
(
|
||||
"\n\nWriters: " + (
|
||||
movie.writer?.substringBefore("\n")
|
||||
?.split(",")?.distinct()?.joinToString { it } ?: ""
|
||||
) +
|
||||
"\n\nDirectors: " + (
|
||||
movie.director?.substringBefore("\n")
|
||||
?.split(",")?.distinct()?.joinToString { it } ?: ""
|
||||
)
|
||||
)
|
||||
} else {
|
||||
detail?.let {
|
||||
ani.title = it.title ?: "Series"
|
||||
ani.genre = it.cats!!.split(",").let { genArray ->
|
||||
genArray.joinToString { genList -> genList.replaceFirstChar { gen -> gen.uppercase() } }
|
||||
}
|
||||
ani.description = it.description
|
||||
ani.status = SAnime.COMPLETED
|
||||
ani.author = it.writer?.substringBefore("\n")?.substringBefore(",")
|
||||
ani.artist = it.director?.substringBefore("\n")?.substringBefore(",")
|
||||
|
||||
ani.description = (if (it.description.isNullOrBlank()) "" else it.description + "\n\n") +
|
||||
(if (it.released.isNullOrBlank().not()) "Released: " + it.released else "") +
|
||||
(
|
||||
"\n\nWriters: " + (
|
||||
it.writer?.substringBefore("\n")
|
||||
?.split(",")?.distinct()?.joinToString { wrt -> wrt } ?: ""
|
||||
) +
|
||||
"\n\nDirectors: " + (
|
||||
it.director?.substringBefore("\n")
|
||||
?.split(",")?.distinct()?.joinToString { dir -> dir } ?: ""
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
return ani
|
||||
}
|
||||
override fun animeDetailsParse(response: Response) = throw UnsupportedOperationException()
|
||||
|
||||
// ============================== Settings ==============================
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
ListPreference(screen.context).apply {
|
||||
key = "preferred_quality"
|
||||
title = "Preferred quality"
|
||||
entries = arrayOf("4k", "1080p", "720p", "480p", "360p", "240p")
|
||||
entryValues = arrayOf("4k", "1080", "720", "480", "360", "240")
|
||||
setDefaultValue("1080")
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}.also(screen::addPreference)
|
||||
|
||||
SwitchPreferenceCompat(screen.context).apply {
|
||||
key = PREF_HIDE_NSFW_KEY
|
||||
title = "Hide NSFW content"
|
||||
setDefaultValue(PREF_HIDE_NSFW_DEFAULT)
|
||||
summary = "requires restart"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val new = newValue as Boolean
|
||||
Toast.makeText(screen.context, "Restart Aniyomi to apply new setting.", Toast.LENGTH_LONG).show()
|
||||
preferences.edit().putBoolean(key, new).commit()
|
||||
}
|
||||
}.also(screen::addPreference)
|
||||
}
|
||||
|
||||
private fun LinkData.toJson(): String {
|
||||
return json.encodeToString(this)
|
||||
}
|
||||
|
||||
private fun getDateTime(s: Int?): Long {
|
||||
return try {
|
||||
Date(s!!.toLong() * 1000).time
|
||||
} catch (e: Exception) {
|
||||
0L
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private const val PREF_HIDE_NSFW_KEY = "pref_hide_nsfw"
|
||||
private const val PREF_HIDE_NSFW_DEFAULT = true
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue