Fix AnimePahe episode sorting and numbering logic #881

Merged
GraveEaterMadison merged 5 commits from main into main 2025-04-09 12:27:31 -05:00
GraveEaterMadison commented 2025-04-06 00:31:12 -05:00 (Migrated from github.com)

Checklist:

  • Updated extVersionCode value in build.gradle for individual extensions
  • Updated overrideVersionCode or baseVersionCode as needed for all multisrc extensions
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Added the isNsfw = true flag in build.gradle when appropriate
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • Have removed web_hi_res_512.png when adding a new extension
  • Have made sure all the icons are in png format

Problem:
Previously, the app directly relied on the episode numbers returned by AnimePahe's backend. This caused issues in cases where series had multiple seasons or non-standard episode numbering (e.g., a second season starting at episode 25). As a result, the app would incorrectly match new episodes (like episode 25 of season 2) with existing entries, leading to inaccurate updates and metadata.

Fix:
Modified the episodeListParse logic to:

  • Extract all episodes via the recursivePages function.
  • Sort episodes chronologically using the date_upload timestamp to ensure correct order.
  • Reassign episode numbers locally using the list index, so episode 1 of any series is labeled as Episode 1, regardless of its original number in AnimePahe's API.
  • Generate consistent episode names like Episode 1, Episode 2, etc., improving user experience and synchronization reliability.

This ensures that episode tracking within the app is consistent and season-agnostic, preventing mismatches across multi-season series or irregular numbering schemes.

Checklist: - [x] Updated `extVersionCode` value in `build.gradle` for individual extensions - [x] Updated `overrideVersionCode` or `baseVersionCode` as needed for all multisrc extensions - [x] Referenced all related issues in the PR body (e.g. "Closes #xyz") - [ ] Added the `isNsfw = true` flag in `build.gradle` when appropriate - [x] Have not changed source names - [ ] Have explicitly kept the `id` if a source's name or language were changed - [x] Have tested the modifications by compiling and running the extension through Android Studio - [ ] Have removed `web_hi_res_512.png` when adding a new extension - [x] Have made sure all the icons are in png format **Problem:** Previously, the app directly relied on the episode numbers returned by AnimePahe's backend. This caused issues in cases where series had multiple seasons or non-standard episode numbering (e.g., a second season starting at episode 25). As a result, the app would incorrectly match new episodes (like episode 25 of season 2) with existing entries, leading to inaccurate updates and metadata. **Fix:** Modified the `episodeListParse` logic to: - Extract all episodes via the `recursivePages` function. - Sort episodes chronologically using the `date_upload` timestamp to ensure correct order. - Reassign episode numbers locally using the list index, so episode 1 of any series is labeled as Episode 1, regardless of its original number in AnimePahe's API. - Generate consistent episode names like Episode 1, Episode 2, etc., improving user experience and synchronization reliability. This ensures that episode tracking within the app is consistent and season-agnostic, preventing mismatches across multi-season series or irregular numbering schemes.
Sign in to join this conversation.
No description provided.