code formatting
This commit is contained in:
parent
5fab3e3d36
commit
73102053dc
4
csdr.py
4
csdr.py
@ -559,7 +559,9 @@ class dsp(object):
|
|||||||
|
|
||||||
def try_create_configs(self, command):
|
def try_create_configs(self, command):
|
||||||
if "{direwolf_config}" in command:
|
if "{direwolf_config}" in command:
|
||||||
self.direwolf_config = "{tmp_dir}/openwebrx_direwolf_{myid}.conf".format(tmp_dir=self.temporary_directory, myid=id(self))
|
self.direwolf_config = "{tmp_dir}/openwebrx_direwolf_{myid}.conf".format(
|
||||||
|
tmp_dir=self.temporary_directory, myid=id(self)
|
||||||
|
)
|
||||||
self.direwolf_port = KissClient.getFreePort()
|
self.direwolf_port = KissClient.getFreePort()
|
||||||
file = open(self.direwolf_config, "w")
|
file = open(self.direwolf_config, "w")
|
||||||
file.write(DirewolfConfig().getConfig(self.direwolf_port))
|
file.write(DirewolfConfig().getConfig(self.direwolf_port))
|
||||||
|
@ -195,10 +195,7 @@ class AprsParser(object):
|
|||||||
comment = information[19:]
|
comment = information[19:]
|
||||||
|
|
||||||
def decodeHeightGainDirectivity(comment):
|
def decodeHeightGainDirectivity(comment):
|
||||||
res = {
|
res = {"height": 2 ** int(comment[4]) * 10 * feetToMeters, "gain": int(comment[5])}
|
||||||
"height": 2 ** int(comment[4]) * 10 * feetToMeters,
|
|
||||||
"gain": int(comment[5]),
|
|
||||||
}
|
|
||||||
directivity = int(comment[6])
|
directivity = int(comment[6])
|
||||||
if directivity == 0:
|
if directivity == 0:
|
||||||
res["directivity"] = "omni"
|
res["directivity"] = "omni"
|
||||||
@ -353,7 +350,7 @@ class MicEParser(object):
|
|||||||
altitude = next((a for a in [altitude, insideAltitude] if a is not None), None)
|
altitude = next((a for a in [altitude, insideAltitude] if a is not None), None)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"fix": information[0] == ord("`") or information[0] == 0x1c,
|
"fix": information[0] == ord("`") or information[0] == 0x1C,
|
||||||
"lat": lat,
|
"lat": lat,
|
||||||
"lon": lon,
|
"lon": lon,
|
||||||
"comment": comment,
|
"comment": comment,
|
||||||
|
13
owrx/kiss.py
13
owrx/kiss.py
@ -22,8 +22,7 @@ MODEM 1200
|
|||||||
KISSPORT {port}
|
KISSPORT {port}
|
||||||
AGWPORT off
|
AGWPORT off
|
||||||
""".format(
|
""".format(
|
||||||
port=port,
|
port=port, callsign=pm["aprs_callsign"]
|
||||||
callsign=pm["aprs_callsign"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if pm["aprs_igate_enabled"]:
|
if pm["aprs_igate_enabled"]:
|
||||||
@ -31,9 +30,7 @@ AGWPORT off
|
|||||||
IGSERVER {server}
|
IGSERVER {server}
|
||||||
IGLOGIN {callsign} {password}
|
IGLOGIN {callsign} {password}
|
||||||
""".format(
|
""".format(
|
||||||
server=pm["aprs_igate_server"],
|
server=pm["aprs_igate_server"], callsign=pm["aprs_callsign"], password=pm["aprs_igate_password"]
|
||||||
callsign=pm["aprs_callsign"],
|
|
||||||
password=pm["aprs_igate_password"],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if pm["aprs_igate_beacon"]:
|
if pm["aprs_igate_beacon"]:
|
||||||
@ -43,7 +40,9 @@ IGLOGIN {callsign} {password}
|
|||||||
|
|
||||||
config += """
|
config += """
|
||||||
PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat={lat} long={lon} comment="OpenWebRX APRS gateway"
|
PBEACON sendto=IG delay=0:30 every=60:00 symbol="igate" overlay=R lat={lat} long={lon} comment="OpenWebRX APRS gateway"
|
||||||
""".format(lat=lat, lon=lon)
|
""".format(
|
||||||
|
lat=lat, lon=lon
|
||||||
|
)
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class KissClient(object):
|
|||||||
port = random.randrange(1024, 49151)
|
port = random.randrange(1024, 49151)
|
||||||
# test if port is available for use
|
# test if port is available for use
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
s.bind(('localhost', port))
|
s.bind(("localhost", port))
|
||||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
s.close()
|
s.close()
|
||||||
return port
|
return port
|
||||||
|
Loading…
x
Reference in New Issue
Block a user