weannounce / arrnounced

Notify Sonarr/Radarr/Lidarr of tracker IRC announcements.
22 stars 3 forks source link

Multiline announce parser does not work for BTN #14

Closed pisserman420 closed 4 years ago

pisserman420 commented 4 years ago

Hey, I've had no problems using this program on AHD and PTP, but on BTN it throws an error when trying to parse the announces. BTN works fine in autodl-irssi. There's some examples of BTN's announce format over here.


2020-05-22 13:58:30,145 - DEBUG:ANNOUNCE_PARSER              - BTN: Parsing multiline annoucement 'NOW BROADCASTING! [ <ommited> ] '
2020-05-22 13:58:30,145 - WARNING:ANNOUNCE_PARSER              - Announcement is too old, discarding: ['<ommited>', 'Season 1', 'One More Time']
2020-05-22 13:58:30,145 - DEBUG:ANNOUNCE_PARSER              - BTN: Messages in announcement still remaining
2020-05-22 13:58:30,146 - DEBUG:IRC:broadcasthe              - << :Barney!4505@Barney.Bot.BroadcasThe.Net PRIVMSG #btn-announce :10[ 07Title: S05E08 10] [ 07Series: <ommited> 10] 
2020-05-22 13:58:30,146 - DEBUG:ANNOUNCE_PARSER              - BTN: Parsing multiline annoucement '[ Title: S05E08 ] [ Series: <ommited> ] '
2020-05-22 13:58:30,146 - DEBUG:ANNOUNCE_PARSER              - BTN: Messages in announcement still remaining
2020-05-22 13:58:30,466 - DEBUG:IRC:broadcasthe              - << :Barney!4505@Barney.Bot.BroadcasThe.Net PRIVMSG #btn-announce :10[ 052020 10] [ Episode 10] [ 09MKV 13| 09H.264 13| 09WEB-DL13 |9 1080p13 | 9Internal13 | 9FastTorrent 10] [ 07Uploader: <ommited> 10] 
2020-05-22 13:58:30,466 - DEBUG:ANNOUNCE_PARSER              - BTN: Parsing multiline annoucement '[ 2020 ] [ Episode ] [ MKV | H.264 | WEB-DL | 1080p | Internal | FastTorrent ] [ Uploader: <ommited> ] '
2020-05-22 13:58:30,466 - ERROR:IRC:broadcasthe              - Failed to execute on_raw_privmsg handler.
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/pydle/client.py", line 422, in on_raw
    await handler(message)
  File "/usr/local/lib/python3.8/site-packages/pydle/features/rfc1459/client.py", line 712, in on_raw_privmsg
    await self.on_message(target, nick, message)
  File "/arrnounced/irc.py", line 62, in on_message
    await message_handler.on_message(
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 606, in new_gen_func
    output = wrapped_interact(iterator)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 592, in wrapped_interact
    rollback_and_reraise(sys.exc_info())
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 370, in rollback_and_reraise
    reraise(*exc_info)
  File "/usr/local/lib/python3.8/site-packages/pony/utils/utils.py", line 95, in reraise
    try: raise exc.with_traceback(tb)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 581, in wrapped_interact
    output = interact(iterator, input, exc_info)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 554, in interact
    return next(iterator) if input is None else iterator.send(input)
  File "/arrnounced/message_handler.py", line 34, in on_message
    announcement = announce_parser.parse(tracker_config, message)
  File "/arrnounced/announce_parser.py", line 21, in parse
    pattern_groups = _parse_multiline_patterns(tracker_config, message)
  File "/arrnounced/announce_parser.py", line 118, in _parse_multiline_patterns
    match_index, match_groups = _find_matching_pattern(tracker_config, message)
  File "/arrnounced/announce_parser.py", line 153, in _find_matching_pattern
    match_groups[group_name] = match.group(j).strip()
AttributeError: 'NoneType' object has no attribute 'strip'
2020-05-22 13:58:30,467 - DEBUG:IRC:broadcasthe              - << :Barney!4505@Barney.Bot.BroadcasThe.Net PRIVMSG #btn-announce :10[ https://broadcasthe.net/<ommited> 13/ https://broadcasthe.net/<ommited> 10]
2020-05-22 13:58:30,467 - DEBUG:ANNOUNCE_PARSER              - BTN: Parsing multiline annoucement '[ https://broadcasthe.net/<ommited> / https://broadcasthe.net/<ommited> ]'
2020-05-22 13:58:30,468 - WARNING:ANNOUNCE_PARSER              - BTN: No match found for '[ https://broadcasthe.net/<ommited> / https://broadcasthe.net/<ommited> ]'
2020-05-22 13:58:30,468 - DEBUG:IRC:broadcasthe              - << :Barney!4505@Barney.Bot.BroadcasThe.Net PRIVMSG #BTN-WhatAuto :<ommited> | S05E08 | Episode | 2020 | MKV | H.264 | WEB-DL | 1080p | No | Yes | 1314800 | <ommited> | English | <ommited>
2020-05-22 13:58:30,468 - DEBUG:MESSAGE_HANDLER              - Message is no announcement
2020-05-22 13:58:30,468 - DEBUG:IRC:broadcasthe              - << PING :Killua.irc.broadcasthe.net
2020-05-22 13:58:30,469 - DEBUG:IRC:broadcasthe              - >> PONG Killua.irc.broadcasthe.net```
weannounce commented 4 years ago

Yes, that is certainly a case I have totally missed. I will look into it. Thanks for the feedback.

weannounce commented 4 years ago

I pushed a fix for the most immediate concern to master https://github.com/weannounce/arrnounced/commit/bfc13c270bbec870b01a6a79950e3115e997c9a6

I also see the BTN configuration is doing some other stuff which is not support at the moment, like creating the release name using other fields. I will look into that as well.

weannounce commented 4 years ago

As of commit 7458c6c73eb4b51d13d53abdb93cfe8f0fddbc72 BTN should have full support.