sdaqo/anipy-cli

Fails downloading all parts and crashes

Closed this issue · 4 comments

Describe the bug

  • some parts (.ts files) fail to download
  • but the program continues to download until it thinks all parts have been downloaded
  • program crashes after trying to combine all parts and running into a file missing

To Reproduce
Steps to reproduce the behavior:

  1. run anipy-cli in download mode
  2. have slow internet or something
  3. parts fail to download and crash during the combining processs

Expected behavior
combine parts successfully

Crash message

Downloading  Part: 329/355
Parts Downloaded                                                                                                                                             
Traceback (most recent call last):                                                                                                                           
  File "./anipy_cli.py", line 14, in <module>                                                                                                                
    main()                                                                                                                                                   
  File "./anipy_cli.py", line 8, in main                                                                                                                     
    cli.main()                                                                                                                                               
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 692, in main                                                                               
    seasonal_cli(args.quality, args.no_kitsu, args.ffmpeg, args.auto_update, player)                                                                         
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 239, in seasonal_cli                                                                       
    s.take_input()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 266, in take_input
    self.download_latest()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/cli.py", line 360, in download_latest
    download(show_entry, self.ffmpeg).download()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/download.py", line 82, in download
    self.multithread_m3u8_dl()
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/download.py", line 297, in multithread_m3u8_dl
    self.ffmpeg_merge(input_file, audio_input_file)
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/download.py", line 134, in ffmpeg_merge
    merged_video_ts = self.merge_ts_files(input_file)
  File "/home/renderinguser/GIT/anipy-cli/anipy_cli/download.py", line 179, in merge_ts_files
    with open(ts_file, "rb") as mergefile:
FileNotFoundError: [Errno 2] No such file or directory: '/home/renderinguser/GIT/anipy-cli/anipy_cli/download/Bocchi the Rock!/11_temp/2ebfa29b-8370-11ed-93b4-a0369ffdb630-000062.ts'

Platform

  • OS: Kubuntu (linux)

Additional context
suggestion

  • restarting the download of the specific episode for some reason downloads only the missing parts and then the recombination becomes successful.
  • so, before combining all .ts files, have a check to see if there is a correct number of parts downloaded
  • re-run the download process if number of parts downloaded do not match the number of parts expected
  • you might have fast enough internet connection that makes it so that this process is not repeatable naturally, so during testing, delete some .ts files during the download process to see if the changes work.

also quick question
which version of python is this program compatible with
i run Python 3.8.10 but downloads are successful if i manually retry enough
but manually retrying is annoying when you're downloading a full seasonal batch of anime

tl;dr: add auto restarting failed downloads

Sounds like an interesting problem. I'll work on it

It was simpler that I thought to fix. Thanks for your suggestions!

nice
lemmie test it

works nicely