Altername and open out for [RU] source (#6896)

* Add Altername

* OpenOut

* RenameActivity
This commit is contained in:
Eugene 2021-05-08 15:25:49 +05:00 committed by GitHub
parent 492df280e7
commit 077b90b80e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 288 additions and 12 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaLib' extName = 'MangaLib'
pkgNameSuffix = 'ru.libmanga' pkgNameSuffix = 'ru.libmanga'
extClass = '.LibManga' extClass = '.LibManga'
extVersionCode = 41 extVersionCode = 42
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -171,6 +171,7 @@ class LibManga : ConfigurableSource, HttpSource() {
} }
val genres = document.select(".media-tags > a").map { it.text() } val genres = document.select(".media-tags > a").map { it.text() }
manga.title = document.select(".media-name__alt").text()
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src") manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text() manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text() manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
@ -184,7 +185,7 @@ class LibManga : ConfigurableSource, HttpSource() {
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
manga.genre = genres.plusElement(category).joinToString { it.trim() } manga.genre = genres.plusElement(category).joinToString { it.trim() }
manga.description = "Русское название: " + document.select(".media-name__main").text() + "\n\n" + document.select(".media-description__text").text() manga.description = document.select(".media-name__main").text() + "\nАльтернативные названия:\n" + document.select(".media-info-list__item_alt-names .media-info-list__value div").map { it.text() }.joinToString(" / ") + "\n\n" + document.select(".media-description__text").text()
return manga return manga
} }

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaPoisk' extName = 'MangaPoisk'
pkgNameSuffix = 'ru.mangapoisk' pkgNameSuffix = 'ru.mangapoisk'
extClass = '.MangaPoisk' extClass = '.MangaPoisk'
extVersionCode = 1 extVersionCode = 2
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -115,6 +115,7 @@ class MangaPoisk : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga { override fun mangaDetailsParse(document: Document): SManga {
val infoElement = document.select("article div.card-body").first() val infoElement = document.select("article div.card-body").first()
val manga = SManga.create() val manga = SManga.create()
manga.title = document.select(".post-name").text()
manga.genre = infoElement.select(".post-info > span:eq(10) > a").joinToString { it.text() } manga.genre = infoElement.select(".post-info > span:eq(10) > a").joinToString { it.text() }
manga.description = infoElement.select(".post-info > div .manga-description.entry").text() manga.description = infoElement.select(".post-info > div .manga-description.entry").text()
manga.status = parseStatus(infoElement.select(".post-info > span:eq(7)").text()) manga.status = parseStatus(infoElement.select(".post-info > span:eq(7)").text())

View File

@ -1,2 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" /> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.extension">
<application>
<activity
android:name=".ru.mintmanga.MintmangaActivity"
android:excludeFromRecents="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" />
<!-- ReadmangaActivity sites can be added here. -->
<data
android:host="mintmanga.live"
android:pathPattern="/..*/vol..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mintmanga' extName = 'Mintmanga'
pkgNameSuffix = 'ru.mintmanga' pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga' extClass = '.Mintmanga'
extVersionCode = 26 extVersionCode = 27
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList 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.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
@ -137,7 +138,11 @@ class Mintmanga : ParsedHttpSource() {
manga.author = authorElement manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text() manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() } manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() }
manga.description = infoElement.select("div.manga-description").text() var altName = ""
if (infoElement.select(".another-names").isNotEmpty()) {
altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n"
}
manga.description = altName + infoElement.select("div.manga-description").text()
manga.status = parseStatus(infoElement.html()) manga.status = parseStatus(infoElement.html())
manga.thumbnail_url = infoElement.select("img").attr("data-full") manga.thumbnail_url = infoElement.select("img").attr("data-full")
return manga return manga
@ -271,6 +276,32 @@ class Mintmanga : ParsedHttpSource() {
}.build() }.build()
return GET(page.imageUrl!!, imgHeader) return GET(page.imageUrl!!, imgHeader)
} }
private fun searchMangaByIdRequest(id: String): Request {
return GET("$baseUrl/$id", headers)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SLUG_SEARCH)) {
val realQuery = query.removePrefix(PREFIX_SLUG_SEARCH)
client.newCall(searchMangaByIdRequest(realQuery))
.asObservableSuccess()
.map { response ->
val details = mangaDetailsParse(response)
details.url = "/$realQuery"
MangasPage(listOf(details), false)
}
} else {
client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccess()
.map { response ->
searchMangaParse(response)
}
}
}
companion object {
const val PREFIX_SLUG_SEARCH = "slug:"
}
private class OrderBy : Filter.Select<String>( private class OrderBy : Filter.Select<String>(
"Сортировать\n(отдельно от фильтров)", "Сортировать\n(отдельно от фильтров)",

View File

@ -0,0 +1,40 @@
package eu.kanade.tachiyomi.extension.ru.mintmanga
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://mintmanga.live/xxx intents and redirects them to
* the main tachiyomi process. The idea is to not install the intent filter unless
* you have this extension installed, but still let the main tachiyomi app control
* things.
*/
class MintmangaActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 0) {
val titleid = pathSegments[0]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${Mintmanga.PREFIX_SLUG_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("MintmangaActivity", e.toString())
}
} else {
Log.e("MintmangaaActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -1,2 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" /> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.extension">
<application>
<activity
android:name=".ru.readmanga.ReadmangaActivity"
android:excludeFromRecents="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" />
<!-- ReadmangaActivity sites can be added here. -->
<data
android:host="readmanga.live"
android:pathPattern="/..*/vol..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Readmanga' extName = 'Readmanga'
pkgNameSuffix = 'ru.readmanga' pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga' extClass = '.Readmanga'
extVersionCode = 25 extVersionCode = 26
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -5,6 +5,7 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.asObservableSuccess import eu.kanade.tachiyomi.network.asObservableSuccess
import eu.kanade.tachiyomi.source.model.Filter import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList 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.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
@ -137,7 +138,11 @@ class Readmanga : ParsedHttpSource() {
manga.author = authorElement manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text() manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() } manga.genre = infoElement.select("span.elem_genre").text().split(",").plusElement(category).joinToString { it.trim() }
manga.description = infoElement.select("div.manga-description").text() var altName = ""
if (infoElement.select(".another-names").isNotEmpty()) {
altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n"
}
manga.description = altName + infoElement.select("div.manga-description").text()
manga.status = parseStatus(infoElement.html()) manga.status = parseStatus(infoElement.html())
manga.thumbnail_url = infoElement.select("img").attr("data-full") manga.thumbnail_url = infoElement.select("img").attr("data-full")
return manga return manga
@ -272,6 +277,33 @@ class Readmanga : ParsedHttpSource() {
return GET(page.imageUrl!!, imgHeader) return GET(page.imageUrl!!, imgHeader)
} }
private fun searchMangaByIdRequest(id: String): Request {
return GET("$baseUrl/$id", headers)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SLUG_SEARCH)) {
val realQuery = query.removePrefix(PREFIX_SLUG_SEARCH)
client.newCall(searchMangaByIdRequest(realQuery))
.asObservableSuccess()
.map { response ->
val details = mangaDetailsParse(response)
details.url = "/$realQuery"
MangasPage(listOf(details), false)
}
} else {
client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccess()
.map { response ->
searchMangaParse(response)
}
}
}
companion object {
const val PREFIX_SLUG_SEARCH = "slug:"
}
private class OrderBy : Filter.Select<String>( private class OrderBy : Filter.Select<String>(
"Сортировать\n(отдельно от фильтров)", "Сортировать\n(отдельно от фильтров)",
arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")

View File

@ -0,0 +1,40 @@
package eu.kanade.tachiyomi.extension.ru.readmanga
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://readmanga.live/xxx intents and redirects them to
* the main tachiyomi process. The idea is to not install the intent filter unless
* you have this extension installed, but still let the main tachiyomi app control
* things.
*/
class ReadmangaActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 0) {
val titleid = pathSegments[0]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${Readmanga.PREFIX_SLUG_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("ReadmangaActivity", e.toString())
}
} else {
Log.e("ReadmangaActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -1,2 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest package="eu.kanade.tachiyomi.extension" /> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="eu.kanade.tachiyomi.extension">
<application>
<activity
android:name=".ru.remanga.RemangaActivity"
android:excludeFromRecents="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" />
<!-- RemangaActivity sites can be added here. -->
<data
android:host="remanga.org"
android:pathPattern="/manga/..*"
android:scheme="https" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Remanga' extName = 'Remanga'
pkgNameSuffix = 'ru.remanga' pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga' extClass = '.Remanga'
extVersionCode = 20 extVersionCode = 21
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -213,7 +213,7 @@ class Remanga : ConfigurableSource, HttpSource() {
title = en_name title = en_name
url = "/api/titles/$dir/" url = "/api/titles/$dir/"
thumbnail_url = "$baseUrl/${img.high}" thumbnail_url = "$baseUrl/${img.high}"
this.description = "Русское название: " + rus_name + "\n" + Jsoup.parse(o.description).text() this.description = rus_name + "\nАльтернативные названия:\n" + another_name + "\n\n" + Jsoup.parse(o.description).text()
genre = (genres + parseType(type)).joinToString { it.name } genre = (genres + parseType(type)).joinToString { it.name }
status = parseStatus(o.status.id) status = parseStatus(o.status.id)
} }
@ -339,6 +339,29 @@ class Remanga : ConfigurableSource, HttpSource() {
override fun imageUrlParse(response: Response): String = throw NotImplementedError("Unused") override fun imageUrlParse(response: Response): String = throw NotImplementedError("Unused")
private fun searchMangaByIdRequest(id: String): Request {
return GET("$baseUrl/api/titles/$id", headers)
}
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> {
return if (query.startsWith(PREFIX_SLUG_SEARCH)) {
val realQuery = query.removePrefix(PREFIX_SLUG_SEARCH)
client.newCall(searchMangaByIdRequest(realQuery))
.asObservableSuccess()
.map { response ->
val details = mangaDetailsParse(response)
details.url = "/$realQuery"
MangasPage(listOf(details), false)
}
} else {
client.newCall(searchMangaRequest(page, query, filters))
.asObservableSuccess()
.map { response ->
searchMangaParse(response)
}
}
}
override fun imageRequest(page: Page): Request { override fun imageRequest(page: Page): Request {
val refererHeaders = headersBuilder().build() val refererHeaders = headersBuilder().build()
return GET(page.imageUrl!!, refererHeaders) return GET(page.imageUrl!!, refererHeaders)
@ -577,5 +600,6 @@ class Remanga : ConfigurableSource, HttpSource() {
private const val USERNAME_DEFAULT = "" private const val USERNAME_DEFAULT = ""
private const val PASSWORD_TITLE = "Password" private const val PASSWORD_TITLE = "Password"
private const val PASSWORD_DEFAULT = "" private const val PASSWORD_DEFAULT = ""
const val PREFIX_SLUG_SEARCH = "slug:"
} }
} }

View File

@ -0,0 +1,40 @@
package eu.kanade.tachiyomi.extension.ru.remanga
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://remanga.org/manga/xxx intents and redirects them to
* the main tachiyomi process. The idea is to not install the intent filter unless
* you have this extension installed, but still let the main tachiyomi app control
* things.
*/
class RemangaActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val pathSegments = intent?.data?.pathSegments
if (pathSegments != null && pathSegments.size > 1) {
val titleid = pathSegments[1]
val mainIntent = Intent().apply {
action = "eu.kanade.tachiyomi.SEARCH"
putExtra("query", "${Remanga.PREFIX_SLUG_SEARCH}$titleid")
putExtra("filter", packageName)
}
try {
startActivity(mainIntent)
} catch (e: ActivityNotFoundException) {
Log.e("RemangaActivity", e.toString())
}
} else {
Log.e("RemangaActivity", "could not parse uri from intent $intent")
}
finish()
exitProcess(0)
}
}

View File

@ -33,6 +33,7 @@ data class MangaDetDto(
val id: Long, val id: Long,
val en_name: String, val en_name: String,
val rus_name: String, val rus_name: String,
val another_name: String,
val dir: String, val dir: String,
val description: String, val description: String,
val issue_year: Int, val issue_year: Int,