EliasOenal / multimon-ng

GNU General Public License v2.0
947 stars 210 forks source link

P2000 Reciving #122

Open paulvanderheijden90 opened 5 years ago

paulvanderheijden90 commented 5 years ago

Hallo. I copy and edit a program for a P2000 pager. it looks like this: `[code] import time import sys import subprocess import os import re from datetime import datetime from dateutil import tz from termcolor import colored

capcode_Steenbergen= "001200768" capcodeToFind_List= ["001200768","001220499","001420999"] meldingToFind_List= ["A4","N275"] Uitruk_Steenbergen =0

def curtime(): return time.strftime("%H:%M:%S %Y-%m-%d")

with open('error.txt','a') as file: file.write(('#' * 20) + '\n' + curtime() + '\n')

multimon_ng = subprocess.Popen("rtl_fm -f 169.65M -M fm -s 22050 | multimon-ng -a FLEX -t raw -", stdout=subprocess.PIPE, stderr=open('error.txt','a'), shell=True)

try: while True: line=multimon_ng.stdout.readline() multimon_ng.poll() if line.contains("ALN"): if line.startswith('FLEX'): flex = line[0:5] timestamp = line[6:25] melding = line[58:] groupid = line[35:41] capcode = line[45:54] print ("Alarm! " + curtime() + melding + capcode)

sys.stdout.write("testen testen enz")

        #Find Capcode in Capcode lijst
            if (str(capcode))in capcodeToFind_List:
                print ("Code: "+(str(capcode))+" gevonden in de lijst")
        #Find Post steenbergen In de Capcode
            if capcode_Steenbergen in (str(capcode)):
                Uitruk_Steenbergen =1

except KeyboardInterrupt: os.kill(multimon_ng.pid, 9) [/code]` Can anyone make me a code like this without the try function. I noticed that this gives some problems by some pipe functions in other python projects.

ScanCaster commented 5 years ago

I copy and edit a program for a P2000 pager. Can anyone make me a code like this without the try function. I noticed that this gives some >problems by some pipe functions in other python projects.

What is the issue with try: ???

I know the code this is based on, its the same code I used to base my POCSAG verifier on, and it runs in a screen for months and months and months with out issue.. logs, alerts on data etc.. probably been a good 6 months or so...

The only reason it fails/stops is if I stop it for some reason...It actually runs better in the screen than it did in a foreground shell... having random untraceable events cause it to stop. Those quit after I put it into a background screen shell environment...

I will need to stop the production version here soon, to do the next code update...

bierviltje commented 5 years ago

Could you explain what you exactly want to do? meldingToFind_List isn't used in your code. I think you want to add some additional filtering on the words it contains? For what reason your want to make Uitruk_Steenbergen True or False?