Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animdl exits with error on non-integer episode number #263

Open
Turtyo opened this issue Apr 20, 2023 · 3 comments
Open

Animdl exits with error on non-integer episode number #263

Turtyo opened this issue Apr 20, 2023 · 3 comments
Labels
bug: site error The site fails at my face.

Comments

@Turtyo
Copy link

Turtyo commented Apr 20, 2023

Describe the bug

I was trying earlier to download some anime (as we do with animdl), and when trying the following : animdl download -d $VID/../../anime/ -q 720 -r 3-24 'animeout:Sword Art Online: Alicization' I got this error :
ValueError: invalid literal for int() with base 10: '18.5'

Did the error occur in between an active task (download / stream / grab)?

This was during the scrapping part

Screenshots [Optional]
Not really screenshots but here is the reason for the bug : animeout labeled one episode as 18.5 (a recap episode if I remember correctly from last time I watched). The error log shows why there is this error :

/home/my_name/.local/lib/python3.10/site-packages/animdl/core/codebase/helpers/__init__.py:54 in  │
│ parse_from_content                                                                               │
│                                                                                                  │
│   51 │   │   if isinstance(episode_number, list):                                                │
│   52 │   │   │   episode_number = episode_number[0]                                              │
│   53 │   │                                                                                       │
│ ❱ 54 │   │   returnee.update({"episode": int(episode_number or 0)})                              │
│   55 │                                                                                           │
│   56if isinstance(video_res, str):                                                          │
│   57 │   │   stripped = video_res.strip("p")                                                     │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │       anitopy_result = {                                                                     │ │
│ │                        │   'file_name': '[AnimeOut] Sword Art Online Alicization - 18.5 -    │ │
│ │                        Recollection[1080pp][KH][RapidB'+7,                                   │ │
│ │                        │   'file_extension': 'mkv',                                          │ │
│ │                        │   'video_resolution': '1080p',                                      │ │
│ │                        │   'episode_number': '18.5',                                         │ │
│ │                        │   'anime_title': 'Sword Art Online Alicization',                    │ │
│ │                        │   'release_group': 'AnimeOut',                                      │ │
│ │                        │   'episode_title': 'Recollection'                                   │ │
│ │                        }                                                                     │ │
│ │              content = URL('http://nimbus.animeout.com/series/00RAPIDBOT/Sword%20Art%20Onli… │ │
│ │       episode_number = '18.5'                                                                │ │
│ │       episode_parsed = False                                                                 │ │
│ │       name_processor = <function fetcher.<locals>.<genexpr>.<lambda> at 0x7fda157c6830>      │ │
│ │            overrides = {}                                                                    │ │
│ │             returnee = {                                                                     │ │
│ │                        │   'stream_url': 'http://pub9.animeout.com/series/00RAPIDBOT/Sword   │ │
│ │                        Art Online Alicization/[AnimeOu'+79                                   │ │
│ │                        }                                                                     │ │
│ │ stream_url_processor = <function animeout_stream_url at 0x7fda153376d0>                      │ │
│ │            video_res = '1080p'

As we can see, the episode number is 18.5. I think this is a marginal issue, it doesn't happen often, but that's still a bit frustrating.
Maybe putting an option to ignore these "half" episode would solve the problem. The main thing here is that animdl will straight up refuse to download any episode because one of them has an incorrect number.

Additional information

  • animdl, version 1.7.12
  • provider is animeout

I also tried to use animdl download -d $VID/../../anime/ -q 720 -r 3-17,19-24 'animeout:Sword Art Online: Alicization' and animdl download -d $VID/../../anime/ -q 720 -r 3-17 'animeout:Sword Art Online: Alicization' but that didn't work either.

@Turtyo Turtyo added the bug: site error The site fails at my face. label Apr 20, 2023
@Turtyo
Copy link
Author

Turtyo commented Apr 20, 2023

While I'm at it, here is the temporary fix that I did:

    if not episode_parsed:

        episode_number = anitopy_result.get("episode_number", 0)

        if isinstance(episode_number, list):
            episode_number = episode_number[0]
        try: 
            returnee.update({"episode": int(episode_number or 0)})
        except:
            return returnee

I'm not sure if this would work all the time because I'm not familiar enough with the code of the project but at least i was able to download the episode 3. I think this downloaded in 1080 instead of 720 considering the size of the video file, so definitely not a good fix.

@zilqnova
Copy link

Hi, I'm also having this issue. Were you able to find a better fix? Either way, where and in what file did you add this code? Thanks.

@Turtyo
Copy link
Author

Turtyo commented Oct 11, 2023

Sorry, I forgot to mention the file. It's the same file as the one mentioned in the error, ie /home/my_name/.local/lib/python3.10/site-packages/animdl/core/codebase/helpers/__init__.py. This may differ depending on your system. I replaced the lines 51 to 54 by the code above.
It will just ignore recap episodes, and ignoring the problem instead of fixing the root issue is not a good fix, but it works for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: site error The site fails at my face.
Projects
None yet
Development

No branches or pull requests

2 participants