fix(crunchy): use relative episode numbers for filename generation#1219
Open
xNabil wants to merge 1 commit intoanidl:masterfrom
Open
fix(crunchy): use relative episode numbers for filename generation#1219xNabil wants to merge 1 commit intoanidl:masterfrom
xNabil wants to merge 1 commit intoanidl:masterfrom
Conversation
When downloading from Crunchyroll using season-specific arguments (e.g., `-s`), the CLI correctly displayed the relative episode number (e.g., E9), but the actual downloaded file used Crunchyroll's absolute API numbering (e.g., E56).
This commit updates the `itemSelectMultiDub` payload mapping to use the calculated `epNum` variable instead of the raw `item.episode` data.
* Fixes an issue where multi-season shows had continuous absolute numbering in output filenames.
* Ensures the `{episode}` template variable correctly matches the relative episode number shown in the CLI terminal output.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
PR Description
When fetching a specific season of a show that uses continuous/absolute numbering on Crunchyroll's backend (such as Jujutsu Kaisen), the
aniDLCLI correctly calculates and displays the relative episode numbers (E1, E2, E3...) in the terminal.However, when the download is initiated, the
{episode}variable in the filename template pulls directly fromitem.episode(the raw API absolute number). This causes a mismatch where the user selects episode 9 from the CLI list, but the resulting file is saved as episode 56, breaking local media library management (like Plex or Jellyfin).The Solution
In the
itemSelectMultiDubfunction, theepisodeNumberproperty mapped into theepMetapayload was hardcoded toitem.episode.This PR updates that mapping to use the pre-calculated
epNumvariable instead. SinceepNumalready handles the--absoluteflag logic right above it, this ensures the filename strictly respects the user's configuration and matches the terminal output.Example / Before & After
Testing with Jujutsu Kaisen Season 3:
aniDL --service crunchy -srz GRDV0019R -s GS00365546JAJP --episode 09Output:
JUJUTSU KAISEN - S03E56 [1080p].mkvJUJUTSU KAISEN - S03E09 [1080p].mkvChecklist:
--absoluteflag still functions correctly if a user wants the continuous numbering.