-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add Pawchive #17612
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
Merged
Merged
Add Pawchive #17612
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b496959
Save current work before sparse update
towermom9 172d3e6
Save current work before sparse update
towermom9 523e51e
Revert "MangaGeko, RageScans, Mangago, FlameComics: Split/add alt tit…
towermom9 32037b9
Reapply "MangaGeko, RageScans, Mangago, FlameComics: Split/add alt ti…
towermom9 2d43878
Delete gradle/gradle-daemon-jvm.properties
towermom9 56c5273
Merge branch 'main' into main
towermom9 716cd88
Update lib-multisrc/pawchive/build.gradle.kts
towermom9 710e95a
Update lib-multisrc/pawchive/build.gradle.kts
towermom9 c1c9620
Update lib-multisrc/pawchive/src/eu/kanade/tachiyomi/multisrc/pawchiv…
towermom9 3a79bf8
Update lib-multisrc/pawchive/src/eu/kanade/tachiyomi/multisrc/pawchiv…
towermom9 1f32995
Merge branch 'main' into main
towermom9 8364f2f
Delete lib-multisrc/pawchive directory
towermom9 fba8334
Moved multisrc to src and stripped some code
towermom9 c64cb94
Merge branch 'main' of https://github.com/towermom9/extensions-source
towermom9 0eb4f6f
Merge branch 'main' into main
towermom9 45a2484
Merge branch 'main' into main
towermom9 5a4560d
Merge branch 'main' into main
towermom9 8c334aa
Merge branch 'main' into main
towermom9 81e547e
Merge branch 'main' into main
towermom9 aaae469
1.6
towermom9 ac881f0
Merge branch 'main' of https://github.com/towermom9/extensions-source…
towermom9 7dc3de5
Update src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchiv…
towermom9 49e1193
Update src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchiv…
towermom9 be6fa16
Update src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchiv…
towermom9 155e483
Update src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchiv…
towermom9 a9a5c61
Merge branch 'keiyoushi:main' into main
towermom9 9178b45
hopefully final
towermom9 a58d1bd
hopefully final
towermom9 066d3ff
Merge branch 'main' into main
towermom9 4408059
hopefully final 2
towermom9 5e47a8e
fixed apiUrl to url
towermom9 7bf825a
Remove redundant '.use {}' wrapper since 'parseAs()' automatically cl…
towermom9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import io.github.keiyoushi.gradle.api.ContentWarning | ||
|
|
||
| plugins { | ||
| alias(kei.plugins.extension) | ||
| } | ||
|
|
||
| keiyoushi { | ||
| name = "Pawchive" | ||
| versionCode = 1 | ||
| contentWarning = ContentWarning.NSFW | ||
| libVersion = "1.6" | ||
|
|
||
| source { | ||
| lang = "all" | ||
| baseUrl = "https://pawchive.pw" | ||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
107 changes: 107 additions & 0 deletions
107
src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchive/Dto.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| package eu.kanade.tachiyomi.extension.all.pawchive | ||
|
|
||
| import eu.kanade.tachiyomi.source.model.SChapter | ||
| import eu.kanade.tachiyomi.source.model.SManga | ||
| import kotlinx.serialization.Serializable | ||
| import kotlinx.serialization.Transient | ||
| import kotlinx.serialization.json.JsonPrimitive | ||
| import kotlinx.serialization.json.double | ||
| import kotlin.time.Instant | ||
|
|
||
| @Serializable | ||
| class PawchiveFavoritesDto( | ||
| val id: String, | ||
| val faved_seq: Long, | ||
| ) | ||
|
|
||
| @Serializable | ||
| class PawchiveCreatorDto( | ||
| val id: String, | ||
| val name: String, | ||
| val service: String, | ||
| private val updated: JsonPrimitive, | ||
| val favorited: Int = -1, | ||
| ) { | ||
| @Transient | ||
| var fav: Long = 0L | ||
|
|
||
| val updatedDate get() = when { | ||
| updated.isString -> Instant.parseOrNull(updated.content)?.toEpochMilliseconds() ?: 0L | ||
| else -> (updated.double * 1000).toLong() | ||
| } | ||
|
|
||
| fun toSManga(baseUrl: String) = SManga.create().apply { | ||
| url = "/$service/user/$id" | ||
|
AwkwardPeak7 marked this conversation as resolved.
|
||
| title = name | ||
| author = service.serviceName() | ||
| thumbnail_url = "$baseUrl/icons/$service/$id" | ||
| description = Pawchive.PROMPT | ||
| initialized = true | ||
| } | ||
|
|
||
| companion object { | ||
| fun String.serviceName() = when (this) { | ||
| "fanbox" -> "Pixiv Fanbox" | ||
| else -> replaceFirstChar { it.uppercase() } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @Serializable | ||
| class PawchivePostDto( | ||
| private val id: String, | ||
| private val service: String, | ||
| private val user: String, | ||
| private val title: String, | ||
| private val added: String? = null, | ||
| private val published: String? = null, | ||
| private val edited: String? = null, | ||
| private val file: PawchiveFileDto? = null, | ||
| private val attachments: List<PawchiveFileDto> = emptyList(), | ||
| ) { | ||
| val images: List<String> | ||
| get() = (listOfNotNull(file) + attachments) | ||
| .filter { it.path != null && it.path.substringAfterLast('.').lowercase() in validImageExtensions } | ||
| .distinctBy { it.path } | ||
| .map { it.toString() } | ||
|
|
||
| fun toSChapter(serviceName: String?, datePref: String) = SChapter.create().apply { | ||
| val dateStr = when (datePref) { | ||
| "added" -> added ?: published ?: edited | ||
| "edited" -> edited ?: published ?: added | ||
| else -> published ?: added ?: edited // Default to published | ||
| } | ||
|
|
||
| val postDate = dateStr?.let { | ||
| val dateWithTz = if (it.endsWith("Z") || it.contains("+")) { | ||
| it | ||
| } else { | ||
| it + if (serviceName == "Pixiv Fanbox") "+09:00" else "Z" | ||
| } | ||
| Instant.parseOrNull(dateWithTz)?.toEpochMilliseconds() | ||
| } ?: 0L | ||
|
|
||
| url = "/$service/user/$user/post/$id" | ||
| date_upload = postDate | ||
|
|
||
| name = title.ifBlank { | ||
| val postDateString = if (postDate != 0L && dateStr != null) { | ||
| // Strips any unexpected timezone markers and recreates "yyyy-MM-dd 'at' HH:mm:ss" natively | ||
| dateStr.substringBefore("+").substringBefore("Z").replace("T", " at ") | ||
| } else { | ||
| "unknown date" | ||
| } | ||
| "Post from $postDateString" | ||
| } | ||
| chapter_number = -2f | ||
| } | ||
|
|
||
| companion object { | ||
| private val validImageExtensions = setOf("png", "jpg", "gif", "jpeg", "webp") | ||
| } | ||
| } | ||
|
|
||
| @Serializable | ||
| class PawchiveFileDto(val name: String? = null, val path: String? = null) { | ||
| override fun toString() = path + if (name != null) "?f=$name" else "" | ||
| } | ||
36 changes: 36 additions & 0 deletions
36
src/all/pawchive/src/eu/kanade/tachiyomi/extension/all/pawchive/Filters.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package eu.kanade.tachiyomi.extension.all.pawchive | ||
|
|
||
| import eu.kanade.tachiyomi.source.model.Filter | ||
| import eu.kanade.tachiyomi.source.model.FilterList | ||
| val getTypes = listOf("Patreon", "Pixiv Fanbox") | ||
|
|
||
| val getSortsList: List<Pair<String, String>> = listOf( | ||
| Pair("Popularity", "pop"), | ||
| Pair("Date Indexed", "new"), | ||
| Pair("Date Updated", "lat"), | ||
| Pair("Alphabetical Order", "tit"), | ||
| Pair("Service", "serv"), | ||
| Pair("Date Favorited", "fav"), | ||
| ) | ||
|
|
||
| class TypeFilter(name: String, vals: List<String>) : Filter.Group<TriFilter>(name, vals.map { TriFilter(it, it.lowercase()) }) | ||
|
|
||
| class FavoritesFilter : Filter.Group<TriFilter>("Favorites", listOf(TriFilter("Favorites Only", "fav"))) | ||
|
|
||
| class TriFilter(name: String, val value: String) : Filter.TriState(name) | ||
|
|
||
| class SortFilter(name: String, selection: Selection, private val vals: List<Pair<String, String>>) : Filter.Sort(name, vals.map { it.first }.toTypedArray(), selection) { | ||
| fun getValue() = vals[state!!.index].second | ||
| } | ||
|
|
||
| fun getLatestUpdatesFilterList(): FilterList = FilterList( | ||
| SortFilter("Sort by", Filter.Sort.Selection(2, false), getSortsList), | ||
| TypeFilter("Types", getTypes), | ||
| FavoritesFilter(), | ||
| ) | ||
|
|
||
| fun getDefaultFilterList(): FilterList = FilterList( | ||
| SortFilter("Sort by", Filter.Sort.Selection(0, false), getSortsList), | ||
| TypeFilter("Types", getTypes), | ||
| FavoritesFilter(), | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.