* BigSolo: Revert changes of #11156 * BigSolo: Fix for recent backend changes (Closes #11226) + Open link in app * BigSolo: Change name to "BigSolo" -> override id * BigSolo: Use enpoint "/data/series/{slug}" + optimization * BigSolo: Add www subdomain to Manifest * BigSolo: data class to class + remove unused variables in serializable * BigSolo: Remove unused variable * BigSolo: Changes asked by vetleledaal * BigSolo: Changes asked by AwkwardPeak7
This commit is contained in:
parent
eab806d5b1
commit
6071f598f4
27
src/fr/bigsolo/AndroidManifest.xml
Normal file
27
src/fr/bigsolo/AndroidManifest.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
<activity
|
||||||
|
android:name=".fr.bigsolo.BigSoloUrlActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:exported="true"
|
||||||
|
android:theme="@android:style/Theme.NoDisplay">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data
|
||||||
|
android:host="bigsolo.org"
|
||||||
|
android:pathPattern="/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
<data
|
||||||
|
android:host="www.bigsolo.org"
|
||||||
|
android:pathPattern="/..*"
|
||||||
|
android:scheme="https" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
||||||
@ -1,9 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'BigSolo'
|
extName = 'BigSolo'
|
||||||
extClass = '.BigSolo'
|
extClass = '.BigSolo'
|
||||||
themePkg = 'scanr'
|
extVersionCode = 3
|
||||||
baseUrl = 'https://www.bigsolo.org'
|
|
||||||
overrideVersionCode = 1
|
|
||||||
isNsfw = false
|
isNsfw = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,164 @@
|
|||||||
package eu.kanade.tachiyomi.extension.fr.bigsolo
|
package eu.kanade.tachiyomi.extension.fr.bigsolo
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.scanr.ScanR
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
|
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||||
|
import eu.kanade.tachiyomi.source.model.Page
|
||||||
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
|
import keiyoushi.utils.parseAs
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
class BigSolo : ScanR(
|
class BigSolo : HttpSource() {
|
||||||
name = "Big Solo",
|
|
||||||
baseUrl = "https://bigsolo.org",
|
override val name = "BigSolo"
|
||||||
lang = "fr",
|
override val baseUrl = "https://bigsolo.org"
|
||||||
useHighLowQualityCover = true,
|
override val lang = "fr"
|
||||||
)
|
override val supportsLatest = true
|
||||||
|
override val id = 4410528266393104437
|
||||||
|
|
||||||
|
// Popular
|
||||||
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
|
return GET("$baseUrl/data/series", headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun popularMangaParse(response: Response): MangasPage {
|
||||||
|
val series = response.parseAs<SeriesResponse>()
|
||||||
|
val mangaList = mutableListOf<SManga>()
|
||||||
|
|
||||||
|
for (serie in series.reco) {
|
||||||
|
mangaList.add(serie.toDetailedSManga())
|
||||||
|
}
|
||||||
|
|
||||||
|
return MangasPage(mangaList, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Latest
|
||||||
|
override fun latestUpdatesRequest(page: Int): Request {
|
||||||
|
return GET("$baseUrl/data/series", headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun latestUpdatesParse(response: Response): MangasPage = searchMangaParse(response)
|
||||||
|
|
||||||
|
// Search
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
|
val url = if (query.isNotBlank()) {
|
||||||
|
"$baseUrl/data/series#$query"
|
||||||
|
} else {
|
||||||
|
"$baseUrl/data/series"
|
||||||
|
}
|
||||||
|
return GET(url, headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
|
val series = response.parseAs<SeriesResponse>()
|
||||||
|
val allSeries = (series.series + series.os).sortedByDescending { it.lastChapter?.timestamp }
|
||||||
|
val mangaList = mutableListOf<SManga>()
|
||||||
|
|
||||||
|
val fragment = response.request.url.fragment
|
||||||
|
val searchQuery = fragment ?: ""
|
||||||
|
|
||||||
|
if (searchQuery.startsWith("SLUG:")) {
|
||||||
|
val serie = allSeries.find { it.slug == searchQuery.removePrefix("SLUG:") }
|
||||||
|
if (serie != null) {
|
||||||
|
mangaList.add(serie.toDetailedSManga())
|
||||||
|
}
|
||||||
|
return MangasPage(mangaList, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (serie in allSeries) {
|
||||||
|
if (searchQuery.isBlank() ||
|
||||||
|
serie.title.contains(searchQuery, ignoreCase = true) ||
|
||||||
|
serie.alternativeTitles.any { it.contains(searchQuery, ignoreCase = true) } ||
|
||||||
|
serie.jaTitle.contains(searchQuery, ignoreCase = true)
|
||||||
|
) {
|
||||||
|
mangaList.add(serie.toDetailedSManga())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MangasPage(mangaList, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Details
|
||||||
|
override fun mangaDetailsRequest(manga: SManga): Request {
|
||||||
|
val splitedPath = URI(manga.url).path.split("/")
|
||||||
|
val slug = splitedPath[1]
|
||||||
|
return GET("$baseUrl/data/series/$slug", headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getMangaUrl(manga: SManga): String {
|
||||||
|
return "$baseUrl${manga.url}"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
|
val serie = response.parseAs<Serie>()
|
||||||
|
return serie.toDetailedSManga()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pages
|
||||||
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
|
val splitedPath = URI(chapter.url).path.split("/")
|
||||||
|
val slug = splitedPath[1]
|
||||||
|
val chapterId = splitedPath[2]
|
||||||
|
return GET("$baseUrl/data/series/$slug/$chapterId", headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
|
val chapterDetails = response.parseAs<ChapterDetails>()
|
||||||
|
return chapterDetails.images.mapIndexed { index, pageData ->
|
||||||
|
Page(index, imageUrl = pageData)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Chapters
|
||||||
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
|
val slug = URI(manga.url).path.split("/")[1]
|
||||||
|
return GET("$baseUrl/data/series/$slug", headers)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
|
val seriesData = response.parseAs<Serie>()
|
||||||
|
return buildChapterList(seriesData)
|
||||||
|
}
|
||||||
|
private fun buildChapterList(serie: Serie): List<SChapter> {
|
||||||
|
val chapters = serie.chapters
|
||||||
|
val chapterList = mutableListOf<SChapter>()
|
||||||
|
val multipleChapters = chapters.size > 1
|
||||||
|
|
||||||
|
for ((chapterNumber, chapterData) in chapters) {
|
||||||
|
if (chapterData.licencied) continue
|
||||||
|
|
||||||
|
val title = chapterData.title
|
||||||
|
val volumeNumber = chapterData.volume
|
||||||
|
|
||||||
|
val baseName = if (multipleChapters) {
|
||||||
|
buildString {
|
||||||
|
if (volumeNumber.isNotBlank()) append("Vol. $volumeNumber ")
|
||||||
|
append("Ch. $chapterNumber")
|
||||||
|
if (title.isNotBlank()) append(" – $title")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (title.isNotBlank()) "One Shot – $title" else "One Shot"
|
||||||
|
}
|
||||||
|
|
||||||
|
val chapter = SChapter.create().apply {
|
||||||
|
name = baseName
|
||||||
|
setUrlWithoutDomain("$baseUrl/${serie.slug}/$chapterNumber")
|
||||||
|
chapter_number = chapterNumber.toFloatOrNull() ?: -1f
|
||||||
|
scanlator = chapterData.teams.joinToString(" & ")
|
||||||
|
date_upload = chapterData.timestamp * 1000L
|
||||||
|
}
|
||||||
|
chapterList.add(chapter)
|
||||||
|
}
|
||||||
|
|
||||||
|
return chapterList.sortedByDescending { it.chapter_number }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unsupported Stuff
|
||||||
|
override fun imageUrlParse(response: Response): String {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.fr.bigsolo
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Data Transfer Objects for BigSolo extension
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class SeriesResponse(
|
||||||
|
val series: List<Serie>,
|
||||||
|
val os: List<Serie>,
|
||||||
|
val reco: List<Serie>,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Serie(
|
||||||
|
val slug: String = "",
|
||||||
|
val title: String,
|
||||||
|
val description: String,
|
||||||
|
val artist: String,
|
||||||
|
val author: String,
|
||||||
|
val tags: List<String>,
|
||||||
|
@SerialName("ja_title")
|
||||||
|
val jaTitle: String,
|
||||||
|
@SerialName("alternative_titles")
|
||||||
|
val alternativeTitles: List<String>,
|
||||||
|
val status: String,
|
||||||
|
val cover: Cover? = null,
|
||||||
|
val chapters: Map<String, Chapter>,
|
||||||
|
@SerialName("last_chapter")
|
||||||
|
val lastChapter: lastChapter? = null,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class lastChapter(
|
||||||
|
val timestamp: Int,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Chapter(
|
||||||
|
val title: String,
|
||||||
|
val volume: String = "",
|
||||||
|
val timestamp: Int,
|
||||||
|
val teams: List<String>,
|
||||||
|
@SerialName("licensed")
|
||||||
|
val licencied: Boolean = false,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class ChapterDetails(
|
||||||
|
val images: List<String>,
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
class Cover(
|
||||||
|
@SerialName("url_hq")
|
||||||
|
val urlHq: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
// DTO to SManga extension functions
|
||||||
|
fun Serie.toDetailedSManga(): SManga = SManga.create().apply {
|
||||||
|
title = this@toDetailedSManga.title
|
||||||
|
description = this@toDetailedSManga.description
|
||||||
|
artist = this@toDetailedSManga.artist
|
||||||
|
author = this@toDetailedSManga.author
|
||||||
|
genre = this@toDetailedSManga.tags.joinToString()
|
||||||
|
status = when (this@toDetailedSManga.status) {
|
||||||
|
"En cours" -> SManga.ONGOING
|
||||||
|
"Finis", "Fini" -> SManga.COMPLETED
|
||||||
|
else -> SManga.UNKNOWN
|
||||||
|
}
|
||||||
|
thumbnail_url = this@toDetailedSManga.cover?.urlHq
|
||||||
|
url = "/${this@toDetailedSManga.slug}"
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
package eu.kanade.tachiyomi.extension.fr.bigsolo
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ActivityNotFoundException
|
||||||
|
import android.content.Intent
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Springboard that accepts https://bigsolo.org/xxxxxx intents and redirects them to
|
||||||
|
* the main Tachiyomi process.
|
||||||
|
*/
|
||||||
|
class BigSoloUrlActivity : Activity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
if (pathSegments != null && pathSegments.size >= 1) {
|
||||||
|
val slug = pathSegments[0]
|
||||||
|
val mainIntent = Intent().apply {
|
||||||
|
action = "eu.kanade.tachiyomi.SEARCH"
|
||||||
|
putExtra("query", "SLUG:$slug")
|
||||||
|
putExtra("filter", packageName)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
startActivity(mainIntent)
|
||||||
|
} catch (e: ActivityNotFoundException) {
|
||||||
|
Log.e("BigSoloUrlActivity", e.toString())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e("BigSoloUrlActivity", "could not parse uri from intent $intent")
|
||||||
|
}
|
||||||
|
|
||||||
|
finish()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user