Compare commits
2 Commits
ce7bcb81a7
...
c837f29930
| Author | SHA1 | Date | |
|---|---|---|---|
|
c837f29930
|
|||
|
9b40430fbe
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
**/__pycache__
|
||||
build/
|
||||
*.egg-info/
|
||||
grc/
|
||||
build/
|
||||
|
||||
@@ -5,7 +5,25 @@ yap yap yap
|
||||
import getopt
|
||||
import sys
|
||||
|
||||
from typing import Final
|
||||
|
||||
from skitter.usage import print_help
|
||||
from skitter import rtl
|
||||
|
||||
def proc_list(raw: str) -> list:
|
||||
"""
|
||||
Quality of life for the user.
|
||||
"""
|
||||
ret: list
|
||||
delims: list = [',', '+', '/']
|
||||
|
||||
for ch in delims:
|
||||
if ch in raw:
|
||||
ret = raw.split(ch)
|
||||
else:
|
||||
ret = [raw]
|
||||
|
||||
return ret
|
||||
|
||||
def main():
|
||||
'''main'''
|
||||
@@ -17,22 +35,76 @@ def main():
|
||||
print_help()
|
||||
sys.exit(2)
|
||||
|
||||
BAND_DEFAULT: Final[list] = [87700000, 92500000, 98300000]
|
||||
OUTDIR_DEFAULT: Final[str] = "Snoops"
|
||||
SQUELCH_DEFAULT: Final[float] = -29.0
|
||||
RATE_DEFAULT: Final[int] = 1500
|
||||
|
||||
rate_ms: int
|
||||
squelch_db: float
|
||||
out_dir: str
|
||||
band_hz: list
|
||||
|
||||
bflag: bool = False
|
||||
oflag: bool = False
|
||||
sflag: bool = False
|
||||
rflag: bool = False
|
||||
|
||||
barg: str
|
||||
oarg: str
|
||||
sarg: float
|
||||
rarg: int
|
||||
|
||||
for o, a in opts:
|
||||
if o in ('-h', '--help'):
|
||||
print_help()
|
||||
sys.exit()
|
||||
|
||||
if o in ('-b', '--band'):
|
||||
print(f"band {a}") # debug
|
||||
bflag = True
|
||||
barg = str(a)
|
||||
#print(f"band {a}") # debug
|
||||
|
||||
if o in ('-o', '--out-directory'):
|
||||
print(f"dir {a}") # debug
|
||||
oflag = True
|
||||
oarg = str(a)
|
||||
#print(f"dir {a}") # debug
|
||||
|
||||
if o in ('-s', '--squelch'):
|
||||
print(f"squelch {a}") # debug
|
||||
sflag = True
|
||||
sarg = float(a)
|
||||
#print(f"squelch {a}") # debug
|
||||
|
||||
if o in ('-r', '--rate'):
|
||||
print(f"rate {a}") # debug
|
||||
#print(f"rate {a}") # debug
|
||||
rflag = True
|
||||
rarg = int(a)
|
||||
|
||||
# end for o, a in opts
|
||||
|
||||
# Set defaults or user values
|
||||
if bflag is False:
|
||||
band_hz = BAND_DEFAULT
|
||||
else:
|
||||
band_hz = barg.split(',')
|
||||
|
||||
if oflag is False:
|
||||
out_dir = OUTDIR_DEFAULT
|
||||
else:
|
||||
out_dir = oarg
|
||||
|
||||
if sflag is False:
|
||||
squelch_db = SQUELCH_DEFAULT
|
||||
else:
|
||||
squelch_db = sarg
|
||||
|
||||
if rflag is False:
|
||||
rate_ms = RATE_DEFAULT
|
||||
else:
|
||||
rate_ms = rarg
|
||||
|
||||
rtl.lock(band_hz, rate_ms, squelch_db)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
12
skitter/rtl.py
Normal file
12
skitter/rtl.py
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"interactions with rtlsdr"
|
||||
|
||||
def lock(band_hz: list, rate_ms: int, squelch_db: float):
|
||||
"""
|
||||
Locking into a set of frequencies.
|
||||
- band_hz: array of desired frequencies i.e. channels in HERTZ ONLY
|
||||
- rate_ms: time to wait between changing channels if no activity
|
||||
- squelch_db: noise ceiling before a channel is considered active
|
||||
"""
|
||||
print(f"Band: {band_hz}\nSquelch: {squelch_db}\nRate: {rate_ms}")
|
||||
|
||||
@@ -59,5 +59,5 @@ def print_help():
|
||||
Run with all default settings and send files to {getenv("HOME")}/Music
|
||||
'''
|
||||
print(BANNER)
|
||||
print(f"skitter v\x1b[33m{VERSION}\x1b[0m")
|
||||
print(f"{NAME} v\x1b[33m{VERSION}\x1b[0m")
|
||||
print(USAGE)
|
||||
|
||||
Reference in New Issue
Block a user