Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

A third episode option for accuracy #246

Closed
ghost opened this issue Sep 13, 2023 · 24 comments · Fixed by #257
Closed

A third episode option for accuracy #246

ghost opened this issue Sep 13, 2023 · 24 comments · Fixed by #257
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Sep 13, 2023

Is your feature request related to a problem? Please describe.
As was stated by me in #206 and ohitstom in #241, having the numbers grow with {episode_number} and only having relative numbers with {relative_episode_number} has major issues with media servers like plex or jellyfin, because they don't check for numbers relative to the show or the season, so a season 2 with an episode 0 or a .5 episode is gonna be named entirely wrong to a point where I would have to go and rename 12+ episodes a season.

Describe the solution you'd like
The first solution that comes to mind would just be a accurate relative episode option that would set the episode number to exactly what it would be in the seasons. another option would be to be have a setting to ignore 0 and .5 episodes.

Additional context
For right now i'm probably gonna right a little script that just takes the episodes and subtracts it from the total of episodes from the previous seasons minus any 0 or .5 episodes. i understand this is an issue with how crunchy roll numbers their episodes (some with resets between seasons and some not) but rather than requiring a separate script it would be amazing to have this baked right in.

@ghost ghost added the enhancement New feature or request label Sep 13, 2023
@alazare619
Copy link

alazare619 commented Sep 15, 2023

This is not possible currently.

I'll elaborate on a better solution expanding on your issue. And how to fix this the correct way.

Sonarr/Plex and many other services depend on thexem.info

thexem.info has mappings of anidb to tvdb and to scene/p2pscene releases. This is what sonarr/plex use for metadata mapping.

Notice in that list anidb.

Well anidb also happens to have a public api, said API also has the ability to list a shows and match titles to the title in crunchyroll. This is because anidb has the url of hte japanesse version of each episode in its DB.

If crunchy-cli just allowed us to connect to anidb. It can pass the url of the japanesse audio stream of the current episode your downloading to anidb and get the correct episode/season number of said and return it. This would 100% correct all issues with numbering when doing entire series archiving

@alazare619
Copy link

@bytedream

@ghost
Copy link
Author

ghost commented Sep 15, 2023

an option to have relative episode number with out episode 0s or .5s would also be a fix to the main issue, but using that anidb connection would also be amazing.

@bytedream
Copy link
Member

A AniDB integration would be indeed nice.
As far as I can see, anidb has a field in one of their api endpoints which actually resolves to Crunchyroll episode ids.
image
I assume that type="28" means that the resource "provider" is crunchyroll and the id in identifier tag matches the internal crunchyroll id of the (japanese) first episode of darling in the franxx.

I'm only concerned about the endpoints anidb provides to access the api. They publicly provide a SOAP or raw UDP endpoint which both are not ideal for modern development (imo).

@bytedream
Copy link
Member

A AniDB integration would be indeed nice.

After a bit of searching multiple problems occurred. It is not guaranteed that the Crunchyroll title is the same as the title in AniDB. For example if you're located in Germany, only the german dub of sword art online is available and every season of it has a (DE) prefix or (German Dub) suffix (depending if your display language is set to german or english). The AniDB entries doesn't have this prefix/suffix.
Sure, crunchy-cli can try to remove any suspicious prefix/suffix, but I'm sure that this will lead to other problems where something gets removed which actually belongs to the correct title.
Another thing are special characters. In some cases titles have special characters like apostrophes. On Crunchyroll the title has ' as apostrophe, whereas AniDB has `. And here it's the same problem as described above, sure the character can be removed from the title but this may brake other things.

@bytedream
Copy link
Member

image
image

Okay I have a question. For example, the first Re:Zero episode has E1A in it's title and the sequence number 0.5. With a option which handles such cases, should it return E1A or E0.5?

@ghost
Copy link
Author

ghost commented Oct 15, 2023

Well in this case I think it should just be dropped, Episode 1 here is a single episode that includes both episode 1a and 1b, But overall I think cause how letters are used by crunchyroll they should come out as be spit out as 1a and 1b

@bytedream
Copy link
Member

I've added a option which should handle the most cases. You can test it by cloning the repo and checking out the feature/relative_sequence_number branch or using one of the pre-built binaries.
The new format option is called {relative_sequence_number} as it is based of the sequence_number api field but it might get renamed when I merge it, to state more clearly what it does.
It would be great if you guys could test this and give feedback @BlastBolt5 @alazare619 @ohitstom

@ohitstom
Copy link

I've added a option which should handle the most cases. You can test it by cloning the repo and checking out the feature/relative_sequence_number branch or using one of the pre-built binaries.
The new format option is called {relative_sequence_number} as it is based of the sequence_number api field but it might get renamed when I merge it, to state more clearly what it does.
It would be great if you guys could test this and give feedback @BlastBolt5 @alazare619 @ohitstom

I'll try and find some time to test it sounds awesome tysm!

@ghost
Copy link
Author

ghost commented Oct 15, 2023

Still doing some testing but this is what i'm seeing so far:

  1. Forward slashes in in the formatting for -o do not appear for outputted file (can't sort into folders)
  2. First episodes of a season with a .5 are formatted to E0 but later season .5 episodes overwrite the episode that should be downloaded, like E24.5 is downloaded as E24 and then the actual E24 just isn't downloaded
  3. {relative_sequence_number} is not formatted to have 2 digits by default
  4. Idk if this is related to this but when doing [S1E24-] for reincarnated as a slime episode 24.5 doesn't show up to be downloaded

Idk which parts of that is related to this specific branch but just thought i'd mention the issues

@ohitstom
Copy link

ohitstom commented Oct 15, 2023

i think it would be nice if this option named anything that is a float as a special instead, that would solve 100% of the issue on my end since most of the time these episodes are classed as specials regardless, same goes for "1a" type episodes, if it returns sequence_number "anything.anything" make it a special

@ghost
Copy link
Author

ghost commented Oct 15, 2023

That also would probably be the best solution for me, and another option for 1a and 1b episodes would be outputting them as e1p1 and e1p2 possibly, but with how rare they are putting them in special is probably a good bet too

@bytedream
Copy link
Member

bytedream commented Oct 15, 2023

Still doing some testing but this is what i'm seeing so far:

  1. Forward slashes in in the formatting for -o do not appear for outputted file (can't sort into folders)

  2. First episodes of a season with a .5 are formatted to E0 but later season .5 episodes overwrite the episode that should be downloaded, like E24.5 is downloaded as E24 and then the actual E24 just isn't downloaded

  3. {relative_sequence_number} is not formatted to have 2 digits by default

  4. Idk if this is related to this but when doing [S1E24-] for reincarnated as a slime episode 24.5 doesn't show up to be downloaded

Idk which parts of that is related to this specific branch but just thought i'd mention the issues

I think everything of the named issues are resolved now. Could you verify my changes?
(over at #257, that's the active PR)

@bytedream
Copy link
Member

i think it would be nice if this option named anything that is a float as a special instead, that would solve 100% of the issue on my end since most of the time these episodes are classed as specials regardless, same goes for "1a" type episodes, if it returns sequence_number "anything.anything" make it a special

How should an episode be marked as special?

@ghost
Copy link
Author

ghost commented Oct 15, 2023

i think it would be nice if this option named anything that is a float as a special instead, that would solve 100% of the issue on my end since most of the time these episodes are classed as specials regardless, same goes for "1a" type episodes, if it returns sequence_number "anything.anything" make it a special

How should an episode be marked as special?

The best way would be if the season for that episode could be set to special or 00

@ghost
Copy link
Author

ghost commented Oct 15, 2023

Still doing some testing but this is what i'm seeing so far:

  1. Forward slashes in in the formatting for -o do not appear for outputted file (can't sort into folders)
  2. First episodes of a season with a .5 are formatted to E0 but later season .5 episodes overwrite the episode that should be downloaded, like E24.5 is downloaded as E24 and then the actual E24 just isn't downloaded
  3. {relative_sequence_number} is not formatted to have 2 digits by default
  4. Idk if this is related to this but when doing [S1E24-] for reincarnated as a slime episode 24.5 doesn't show up to be downloaded

Idk which parts of that is related to this specific branch but just thought i'd mention the issues

I think everything of the named issues are resolved now. Could you verify my changes? (over at #257, that's the active PR)

Yep just tested the new commit and all 4 of those issues are fixed, tysm!

@ohitstom
Copy link

i think it would be nice if this option named anything that is a float as a special instead, that would solve 100% of the issue on my end since most of the time these episodes are classed as specials regardless, same goes for "1a" type episodes, if it returns sequence_number "anything.anything" make it a special

How should an episode be marked as special?

if it is a float number, set its sequence number to just the word "special", since lots of metadata providers dont follow half episodes are more the common "special - title" format, such as adventure time (not applicable of course but just off the top of my head)

though this would likely fit better in its own flag that could work in tandem with relative sequence, maybe something named rename_floats or something

@bytedream
Copy link
Member

bytedream commented Oct 16, 2023

Okay I see. I don't like the idea of an extra flag for this but I can't see another way atm.

To give a good amount of flexibility, the extra flag could be designed exactly like -o with the difference that it only gets used when the sequence number is a float.

E.g. (assuming that the new flag is called -os):

$ crunchy-cli archive -o "S{season_number}E{relative_sequence_number} - {title}.mkv" -os "Special - {title}.mkv" ...
# S1E1 - ep1.mkv
# S1E2 - ep2.mkv
# Special - ep2.5.mkv
# S1E3 - ep3.mkv

How do you thing about this?

@ohitstom
Copy link

yeah that looks great!

@ghost
Copy link
Author

ghost commented Oct 19, 2023

That looks awesome thank you so much

@ghost
Copy link
Author

ghost commented Oct 19, 2023

would there be anyway to make a flag to just ignore those episodes as well? Like how skip existing has one?

@bytedream
Copy link
Member

bytedream commented Nov 4, 2023

I've pushed new code to the PR which adds the --special-output flag to control the output file name of special episodes as well as the --skip-specials flag to ignore special episodes entirely (what @BlastBolt5 suggested)

bytedream added a commit that referenced this issue Nov 6, 2023
…umber

Add flags and option to control special episode behavior (#206, #241, #246)
@bytedream
Copy link
Member

Support for this landed in v3.1.0

@ghost
Copy link
Author

ghost commented Nov 7, 2023

Thank you so much, I have been busy with school so I haven't been able to test this yet but it looks perfect

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants