KBlixt / subcleaner

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

AttributeError: 'NoneType' object has no attribute 'replace' #5

Closed ddund closed 2 years ago

ddund commented 2 years ago

Hey, I get an error when trying to run your script on my library. Not sure if the fault is on my end or if it's something in the script. I'm running python 3.9.5.

Traceback (most recent call last):
  File "/config/subcleaner/subcleaner.py", line 8, in <module>
    main.main(Path(__file__).absolute().parent)
  File "/config/subcleaner/libs/subcleaner/main.py", line 29, in main
    parse_config()
  File "/config/subcleaner/libs/subcleaner/main.py", line 217, in parse_config
    cleaner = Cleaner(package_dir.joinpath("regex"), regex_defaults)
  File "/config/subcleaner/libs/subcleaner/cleaner.py", line 17, in __init__
    self._build_regex(regex_dir, use_default_regex)
  File "/config/subcleaner/libs/subcleaner/cleaner.py", line 156, in _build_regex
    self._add_exclusive_configs()
  File "/config/subcleaner/libs/subcleaner/cleaner.py", line 187, in _add_exclusive_configs
    excluded_languages = parser["META"].get("excluded_language_codes").replace(" ", "").split(",")
AttributeError: 'NoneType' object has no attribute 'replace'
KBlixt commented 2 years ago

whoops, my bad, this should be fixed now, thank you for letting me know about this issue!

Please update and verify that it works :)

ddund commented 2 years ago

whoops, my bad, this should be fixed now, thank you for letting me know about this issue!

Please update and verify that it works :)

Yes, it works now.

Here are some of the false positives and some interesting warnings I got if you want to use them to possible improve the regex.

False positives: ``` [INFO]: Removed 3 subtitle blocks: [---------Removed Blocks----------] 1 00:00:01,375 --> 00:00:03,837 December 31, 1999 [---------------------------------------------------------------------------------] [INFO]: Removed 3 subtitle blocks: [---------Removed Blocks----------] 3 00:00:33,825 --> 00:00:36,161 UNDERREDSBEHANDLING [---------------------------------------------------------------------------------] [INFO]: Removed 4 subtitle blocks: [---------Removed Blocks----------] 1 00:00:01,752 --> 00:00:03,837 Glada nyheter! 17 00:01:31,716 --> 00:01:33,802 UPPFINNAR- AKADEMIN [---------------------------------------------------------------------------------] [INFO]: Removed 3 subtitle blocks: [---------Removed Blocks----------] 7 00:00:45,177 --> 00:00:47,479 Mars University [---------------------------------------------------------------------------------] [INFO]: Removed 4 subtitle blocks: [---------Removed Blocks----------] 1 00:00:03,850 --> 00:00:06,730 Baserad på en sann historia 2 00:00:06,939 --> 00:00:09,192 Xmas Story [---------------------------------------------------------------------------------] [INFO]: Removed 4 subtitle blocks: [---------Removed Blocks----------] 1 00:00:03,980 --> 00:00:07,732 Nominerad för tre Glemmys 2 00:00:07,942 --> 00:00:10,109 Raging Bender [---------------------------------------------------------------------------------] [INFO]: Removed 4 subtitle blocks: [---------Removed Blocks----------] 1 00:00:04,416 --> 00:00:07,461 Allvarlig varning om kommande händelser 2 00:00:07,503 --> 00:00:09,672 Deep South [---------------------------------------------------------------------------------] [INFO]: Removed 3 subtitle blocks: [---------Removed Blocks----------] 1 00:00:01,895 --> 00:00:06,485 Futurama presenteras av Smält Bor! [INFO]: Removed 4 subtitle blocks: [---------Removed Blocks----------] 1 00:00:03,480 --> 00:00:07,000 LARV-TESTAD, PUPPA-GODKÄND 2 00:00:07,200 --> 00:00:09,279 Mother's Day [---------------------------------------------------------------------------------] ```
Warnings: ``` [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 2 subtitle blocks, please verify: [---------Warning Blocks----------] 6 00:01:06,525 --> 00:01:12,781 Gosskören 9 00:03:03,307 --> 00:03:04,977 Pepinot [---------------------------------] [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 1 subtitle blocks, please verify: [---------Warning Blocks----------] 1 00:00:05,996 --> 00:00:10,877 Drömmar är meddelanden från djupet. [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 1 subtitle blocks, please verify: [---------Warning Blocks----------] 7 00:00:57,941 --> 00:01:03,780 HÄRSKARRINGEN [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 1 subtitle blocks, please verify: [---------Warning Blocks----------] 201 00:21:10,645 --> 00:21:13,397 Rymdgetingens maginnehåll [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 1 subtitle blocks, please verify: [---------Warning Blocks----------] 1 00:00:16,099 --> 00:00:19,894 Åker genom robot-tvätten! [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 1 subtitle blocks, please verify: [---------Warning Blocks----------] 18 00:02:01,513 --> 00:02:02,873 Förlorare [---------------------------------------------------------------------------------] [WARNING]: Potential ads in 2 subtitle blocks, please verify: [---------Warning Blocks----------] 13 00:01:43,504 --> 00:01:45,626 APPLÅDER 14 00:01:46,709 --> 00:01:49,332 MINDRE APPLÅDER [---------------------------------------------------------------------------------] ```

Tack för ett väldigt trevligt skript :)