dmitryelj / RPi-P2000Receiver

P2000 paging autonomous receiver with LCD and browser access
16 stars 7 forks source link

Line contains ALN or NUM #20

Closed M1K3-NL closed 4 years ago

M1K3-NL commented 4 years ago

Hi, I have one more little question for you. Maybe you can help. It's the last "issue" I have, so I won't bother you after this haha.

Most of the FLEX messages is: FLEX|2020-10-17 18:40:22|1600/2/K/A|10.021|001523161|ALN|A2 Zadelmaker ALPHRN Directe inzet 16161 or FLEX: 2018-07-29 11:43:27 1600/2/K/A 10.120 [001523172] ALN A1 Boerhaavelaan HAARLM : 16172

But now I have a capcode with a different sort of line: FLEX: 2020-10-17 18:40:19 1600/2/A 10.020 [001530615] NUM 3301 Where 3301 is the message and NUM is the ALN.

Now the script is filtering on ALN by doing: message = line[line.find("ALN")+4:].strip() How can I add NUM to the line.find of the old FLEX code. ShareX_EAQOQhuj4p

M1K3-NL commented 4 years ago

For now I have this running, but I only can test it if the 3301 NUM coming in and that's 0-10 times a day.

sublime_text_ZERGBDKeGZ

dmitryelj commented 4 years ago

First you can switch back to the last multimon-ng version, then you do not need line[line.find("ALN")+4:] substring more. Only thing to add, will be if line.__contains__("ALN") or line.__contains__("NUM"), it should be enough. Or if you want, you can use something like message = line[line.find("ALN")+4:].strip() if "ALN" in line else line[line.find("NUM")+4:].strip() or any another check, you want. In general, switching to the last multimon-ng looks more easy.

I did not see this message before so cannot confirm that it works, but in theory it should be.

M1K3-NL commented 4 years ago

Hi, yes it's only in region 15 Haaglanden for some police code like narcotics, weapons and explosives service and the arrest team negotiator.

M1K3-NL commented 4 years ago

I'll look at your ideas tomorrow 🙂

M1K3-NL commented 4 years ago

Hello, both are working as you said. So you can add them to your own script if you like. 🙂

I'll close the issue now.

dmitryelj commented 4 years ago

Thanks. Added to the main project.