Compare commits

...

7 Commits

Author SHA1 Message Date
Mend Renovate
f33a6d2520
Update dependency io.coil-kt.coil3:coil-bom to v3.0.0-rc02 (#1401) 2024-10-31 01:53:51 +06:00
Mend Renovate
41ae8505fe
Update actions/dependency-review-action action to v4.4.0 (#1402) 2024-10-31 01:53:12 +06:00
Mend Renovate
2914d166fe
Update dependency androidx.constraintlayout:constraintlayout to v2.2.0 (#1416) 2024-10-30 19:52:51 +00:00
Mend Renovate
328ec8c752
Update lifecycle.version to v2.8.7 (#1415) 2024-10-30 19:52:37 +00:00
MajorTanya
78f9a84b14
Some improvements to Bangumi tracker search (#1396)
In short:
- fetch & show actual summary
- fallback to "name" if "name_cn" is empty
- request larger responseGroup to get & display the summary & rating
- add type filter query param to make Bangumi filter, not us

Previously, we only displayed the "name" in the summary area and used
"name_cn" as the entry name. However, "name_cn" (Chinese name) can be
an empty string at times, resulting in an awkward looking search
result list where some, many, or even all the results have no title
displayed and only show the "name" (Japanese name) in the summary
area. This has been solved by using "name" as a fallback value should
"name_cn" be empty.

If a Chinese name is available, the original name is prepended to the
summary with the addition "作品原名:" (meaning "original series title").

By using the "responseGroup=large" query parameter, we can request
the required data we need to display the actual summary for an entry
and the entry's average rating.
The "name" is prepended to the summary contents, if any exist, so it
is still accessible for series identification if a "name_cn" exists
too and was used for the result title.

Adding the "type=1" filter query parameter means Bangumi will only
return entries of type 1 ("book") instead of all types and Mihon
needing to filter, resulting in potentially missed entry matches.
2024-10-31 01:52:18 +06:00
Mend Renovate
eedece5adf
Update dependency androidx.annotation:annotation to v1.9.1 (#1413) 2024-10-31 01:46:31 +06:00
Mend Renovate
9d6ddb5d91
Update dependency androidx.viewpager:viewpager to v1.1.0-beta01 (#1414) 2024-10-31 01:44:42 +06:00
6 changed files with 19 additions and 10 deletions

View File

@ -29,7 +29,7 @@ jobs:
uses: gradle/actions/wrapper-validation@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0
- name: Dependency Review
uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5
uses: actions/dependency-review-action@4081bf99e2866ebe428fc0477b69eb4fcda7220a # v4.4.0
- name: Set up JDK
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0

View File

@ -14,6 +14,9 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
### Fixed
- Fixed "currentTab was used multiple times"
### Improved
- Bangumi search now shows the score and summary of a search result ([@MajorTanya](https://github.com/MajorTanya)) ([#1396](https://github.com/mihonapp/mihon/pull/1396))
## [v0.17.0] - 2024-10-26
### Added
- Option to disable reader zoom out ([@Splintorien](https://github.com/Splintorien)) ([#302](https://github.com/mihonapp/mihon/pull/302))

View File

@ -71,6 +71,8 @@ class BangumiApi(
val url = "$API_URL/search/subject/${URLEncoder.encode(search, StandardCharsets.UTF_8.name())}"
.toUri()
.buildUpon()
.appendQueryParameter("type", "1")
.appendQueryParameter("responseGroup", "large")
.appendQueryParameter("max_results", "20")
.build()
with(json) {
@ -81,7 +83,6 @@ class BangumiApi(
if (result.code == 404) emptyList<TrackSearch>()
result.list
?.filter { it.type == 1 }
?.map { it.toTrackSearch(trackId) }
.orEmpty()
}

View File

@ -17,6 +17,7 @@ data class BGMSearchItem(
val nameCn: String,
val name: String,
val type: Int,
val summary: String?,
val images: BGMSearchItemCovers?,
@SerialName("eps_count")
val epsCount: Long?,
@ -25,9 +26,13 @@ data class BGMSearchItem(
) {
fun toTrackSearch(trackId: Long): TrackSearch = TrackSearch.create(trackId).apply {
remote_id = this@BGMSearchItem.id
title = nameCn
cover_url = images?.common ?: ""
summary = this@BGMSearchItem.name
title = nameCn.ifBlank { name }
cover_url = images?.common.orEmpty()
summary = if (nameCn.isNotBlank()) {
"作品原名:$name" + this@BGMSearchItem.summary?.let { "\n$it" }.orEmpty()
} else {
this@BGMSearchItem.summary.orEmpty()
}
score = rating?.score ?: -1.0
tracking_url = url
total_chapters = epsCount ?: 0

View File

@ -1,20 +1,20 @@
[versions]
agp_version = "8.7.1"
lifecycle_version = "2.8.6"
lifecycle_version = "2.8.7"
paging_version = "3.3.2"
interpolator_version = "1.0.0"
[libraries]
gradle = { module = "com.android.tools.build:gradle", version.ref = "agp_version" }
annotation = "androidx.annotation:annotation:1.9.0"
annotation = "androidx.annotation:annotation:1.9.1"
appcompat = "androidx.appcompat:appcompat:1.7.0"
biometricktx = "androidx.biometric:biometric-ktx:1.2.0-alpha05"
constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.4"
constraintlayout = "androidx.constraintlayout:constraintlayout:2.2.0"
corektx = "androidx.core:core-ktx:1.13.1"
splashscreen = "androidx.core:core-splashscreen:1.0.1"
recyclerview = "androidx.recyclerview:recyclerview:1.3.2"
viewpager = "androidx.viewpager:viewpager:1.1.0-alpha01"
viewpager = "androidx.viewpager:viewpager:1.1.0-beta01"
profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.1"
lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "lifecycle_version" }

View File

@ -42,7 +42,7 @@ preferencektx = "androidx.preference:preference-ktx:1.2.1"
injekt = "com.github.mihonapp:injekt:91edab2317"
coil-bom = { module = "io.coil-kt.coil3:coil-bom", version = "3.0.0-rc01" }
coil-bom = { module = "io.coil-kt.coil3:coil-bom", version = "3.0.0-rc02" }
coil-core = { module = "io.coil-kt.coil3:coil" }
coil-gif = { module = "io.coil-kt.coil3:coil-gif" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose" }