Skip to content

Fix Bangumi rescrape proxy and keyword search#39

Merged
ModerRAS merged 1 commit into
masterfrom
fix/rescrape-bangumi-proxy
Jul 10, 2026
Merged

Fix Bangumi rescrape proxy and keyword search#39
ModerRAS merged 1 commit into
masterfrom
fix/rescrape-bangumi-proxy

Conversation

@ModerRAS

@ModerRAS ModerRAS commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • wire desktop Bangumi scraper requests through the shared proxy config used by Cloud/RSS settings
  • make manual Bangumi rescrape search only the explicit UI-selected keywords
  • expose seasonless keyword variants directly in the selectable keyword list instead of generating them invisibly
  • keep automatic seasonless expansion and alias fallback for non-manual metadata flows

Tests

  • ./gradlew :scraper-desktop:test --tests "com.miruplay.tv.scraper.desktop.DesktopBangumiScraperTest"
  • ./gradlew :desktop-app:compileKotlin
  • ./gradlew :scraper:testDebugUnitTest --tests "com.miruplay.tv.scraper.MetadataSearchAggregatorsTest" :core:model:test --tests "com.miruplay.tv.model.DetailUiConventionsTest" :repository-api:test --tests "com.miruplay.tv.repository.MetadataSearchAggregationTest"
  • ./gradlew :ui-tv:testDebugUnitTest --tests "com.miruplay.tv.ui.detail.AnimeDetailViewModelTest"
  • git diff --check

Version

Patch-level fix. Latest stable release is v0.10.560, local baseAppVersionName is already 0.10.0, so no base version bump is needed.

Summary by CodeRabbit

  • New Features

    • Added seasonless title variants to improve anime metadata matching.
    • Manual matching now searches only the explicitly provided keywords.
    • Added HTTP proxy support for desktop Bangumi searches.
  • Bug Fixes

    • Proxy settings now stay synchronized with RSS and cloud configuration changes.
    • Prevented automatic alias and seasonless expansions during manual searches.
  • Tests

    • Added coverage for seasonless matching, manual search behavior, and proxied requests.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Manual metadata matching

Layer / File(s) Summary
Seasonless manual candidate terms
core/model/src/main/kotlin/.../DetailUiConventions.kt, core/model/src/test/.../DetailUiConventionsTest.kt
Manual candidate generation adds validated seasonless variants and updates the expected candidate list.
Intent-aware query planning and provider search
repository-api/src/main/.../MetadataSearchAggregation.kt, scraper/src/main/.../MetadataSearchAggregators.kt, */src/test/...
Manual matches use explicit query terms without seasonless expansion or alias fallback; tests verify both planner and provider behavior.

Bangumi proxy configuration

Layer / File(s) Summary
Proxy configuration wiring and validation
desktop-app/src/main/.../MiruPlayDesktopComposeApp.kt, scraper-desktop/src/main/.../DesktopBangumiScraper.kt, scraper-desktop/src/test/.../DesktopBangumiScraperTest.kt
Cloud RSS proxy settings are applied during load and save flows, normalized by the desktop scraper, and validated through a proxied search request.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

Manual metadata search

sequenceDiagram
  participant MetadataSearchContext
  participant MetadataQueryPlanner
  participant BangumiAnimeMetadataSearchProvider
  participant MetadataScraper
  MetadataSearchContext->>MetadataQueryPlanner: provide MANUAL_MATCH intent
  MetadataQueryPlanner->>BangumiAnimeMetadataSearchProvider: return explicit query texts
  BangumiAnimeMetadataSearchProvider->>MetadataScraper: search without alias fallback
  MetadataScraper-->>BangumiAnimeMetadataSearchProvider: return scraper results
Loading

Bangumi proxy configuration

sequenceDiagram
  participant MiruPlayDesktopComposeApp
  participant DesktopBangumiScraper
  participant BangumiApiClient
  MiruPlayDesktopComposeApp->>DesktopBangumiScraper: configureProxy(...)
  DesktopBangumiScraper->>BangumiApiClient: apply normalized proxy settings
  BangumiApiClient-->>DesktopBangumiScraper: use proxy for search requests
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two main changes: Bangumi proxy handling and keyword search behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/rescrape-bangumi-proxy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
desktop-app/src/main/kotlin/com/miruplay/tv/desktop/MiruPlayDesktopComposeApp.kt (1)

891-895: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider extracting the repeated proxy-configuration pattern.

All four call sites follow the same sequence: update UI state → bangumiScraper.configureProxy(...)cloudRssScheduler.syncPeriodicWork(...). Since a CloudDriveAutomationConfig.toBangumiHttpProxyConfig() extension already exists, adding a configureProxy(config: CloudDriveAutomationConfig) overload (or accepting BangumiHttpProxyConfig directly) would eliminate the repeated three-argument extraction and reduce the risk of future drift.

♻️ Optional: add an overload to reduce repetition
 // In DesktopBangumiScraper.kt
+fun configureProxy(config: BangumiHttpProxyConfig) {
+    api.configureProxy(config)
+}
+
 fun configureProxy(enabled: Boolean, host: String, port: Int) {
     api.configureProxy(BangumiHttpProxyConfig.normalize(enabled, host, port))
 }

Then call sites become:

-                bangumiScraper.configureProxy(
-                    config.data.rssProxyEnabled,
-                    config.data.rssProxyHost,
-                    config.data.rssProxyPort,
-                )
+                bangumiScraper.configureProxy(config.data.toBangumiHttpProxyConfig())

Also applies to: 948-952, 1372-1376, 1497-1501

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@desktop-app/src/main/kotlin/com/miruplay/tv/desktop/MiruPlayDesktopComposeApp.kt`
around lines 891 - 895, Extract the repeated proxy setup into a shared helper or
overload near the existing proxy configuration code. Use the existing
CloudDriveAutomationConfig.toBangumiHttpProxyConfig() conversion, then update
all four call sites to invoke the helper with the config while preserving the
existing UI state update and cloudRssScheduler.syncPeriodicWork(...) behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@desktop-app/src/main/kotlin/com/miruplay/tv/desktop/MiruPlayDesktopComposeApp.kt`:
- Around line 891-895: Extract the repeated proxy setup into a shared helper or
overload near the existing proxy configuration code. Use the existing
CloudDriveAutomationConfig.toBangumiHttpProxyConfig() conversion, then update
all four call sites to invoke the helper with the config while preserving the
existing UI state update and cloudRssScheduler.syncPeriodicWork(...) behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f583d1ed-3d8e-4a1f-a06b-cc30ee6dd2a4

📥 Commits

Reviewing files that changed from the base of the PR and between 1b86430 and 8ba02eb.

📒 Files selected for processing (9)
  • core/model/src/main/kotlin/com/miruplay/tv/model/DetailUiConventions.kt
  • core/model/src/test/kotlin/com/miruplay/tv/model/DetailUiConventionsTest.kt
  • desktop-app/src/main/kotlin/com/miruplay/tv/desktop/MiruPlayDesktopComposeApp.kt
  • repository-api/src/main/kotlin/com/miruplay/tv/repository/MetadataSearchAggregation.kt
  • repository-api/src/test/kotlin/com/miruplay/tv/repository/MetadataSearchAggregationTest.kt
  • scraper-desktop/src/main/kotlin/com/miruplay/tv/scraper/desktop/DesktopBangumiScraper.kt
  • scraper-desktop/src/test/kotlin/com/miruplay/tv/scraper/desktop/DesktopBangumiScraperTest.kt
  • scraper/src/main/kotlin/com/miruplay/tv/scraper/MetadataSearchAggregators.kt
  • scraper/src/test/kotlin/com/miruplay/tv/scraper/MetadataSearchAggregatorsTest.kt

@ModerRAS ModerRAS merged commit 6ee6da9 into master Jul 10, 2026
10 checks passed
@ModerRAS ModerRAS deleted the fix/rescrape-bangumi-proxy branch July 10, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant