KBlixt / subcleaner

removes ads from subtitle files cleanly.
288 stars 13 forks source link

IndexError: list index out of range #13

Closed ChristianMalazarte closed 2 years ago

ChristianMalazarte commented 2 years ago

This works great! But I'm getting some errors (maybe around 2% of the time):

Traceback (most recent call last):
  File "/opt/subcleaner/subcleaner.py", line 8, in <module>
    main.main(Path(__file__).absolute().parent)
  File "/opt/subcleaner/libs/subcleaner/main.py", line 34, in main
    clean_file(file)
  File "/opt/subcleaner/libs/subcleaner/main.py", line 69, in clean_file
    cleaner.run_regex(subtitle)
  File "/opt/subcleaner/libs/subcleaner/cleaner.py", line 22, in run_regex
    if subtitle.blocks[0].start_time < timedelta(seconds=2):
IndexError: list index out of range
ChristianMalazarte commented 2 years ago

I think I may have figured it out. On the file where it was giving an error. The file was empty.

ChristianMalazarte commented 2 years ago

Yes it's the empty file!

KBlixt commented 2 years ago

Well, you sorted out that on your own 👍

Regardless, I don't want the script to throw exceptions so I'm going to handle empty subtitles better, thank you for reporting this. 🙂

ChristianMalazarte commented 2 years ago

Awesome! Also if we could see what file this error is referring to? I suspect maybe the only thing in the subtitle are ads, so if that's the case, I might as well delete the entire file, but of course, per user discretion.

image

I'm pretty sure this is a tv show with lots of episodes with the same subs.

KBlixt commented 2 years ago

Ah, yeah, good point. Take a look in the log and see if you spot something there. I'll take a look at improving info about the file that caused this issue.

Did you add any custom regex?

Also, this tool have seen quite a spike in traffic today. You wouldn't happen to know why?

ChristianMalazarte commented 2 years ago

Someone posted it on reddit https://www.reddit.com/r/PleX/comments/yxwutm/if_you_download_subtitles_you_need_this_cleaner/

I was so happy this was working so well. I've been looking for a link to donate or buy you a cup of coffee! It's a nice tool that simply just worked for me right out of the box.

KBlixt commented 2 years ago

Thank you I'm humbled 😁 but I'm going to have to decline. Taking donations would make me feel pressured, even though it's completely voluntary. But I'm very glad you find it helpful and that's more important to me.

ChristianMalazarte commented 2 years ago

Haha I understand! Thanks you helped a lot of people.