escape python hell
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
**/__pycache__
|
||||||
|
build/
|
||||||
|
*.egg-info/
|
||||||
6
Makefile
Normal file
6
Makefile
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
all:
|
||||||
|
pyproject-build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf skitter.egg-info/
|
||||||
|
rm -rf dist/
|
||||||
15
project.toml
15
project.toml
@@ -1,15 +0,0 @@
|
|||||||
[project]
|
|
||||||
readme = "README.md"
|
|
||||||
dependencies = [
|
|
||||||
"PyQt5>0.0",
|
|
||||||
"gnuradio>0.0",
|
|
||||||
"sys>0.0",
|
|
||||||
"signal>0.0",
|
|
||||||
"argparse>0.0",
|
|
||||||
"threading>0.0",
|
|
||||||
"time"
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Repository = "https://git.therats.win/jazz/skitter"
|
|
||||||
|
|
||||||
14
pyproject.toml
Normal file
14
pyproject.toml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools", "wheel"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "skitter"
|
||||||
|
version = "0.0.0"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Repository = "https://git.therats.win/jazz/skitter"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
skitter = "skitter.__main__:main"
|
||||||
1
skitter/__init__.py
Normal file
1
skitter/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
38
skitter/__main__.py
Normal file
38
skitter/__main__.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
yap yap yap
|
||||||
|
"""
|
||||||
|
import getopt
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from skitter.usage import print_help
|
||||||
|
|
||||||
|
def main():
|
||||||
|
'''main'''
|
||||||
|
try:
|
||||||
|
opts, args = getopt.getopt(sys.argv[1:],
|
||||||
|
"hb:o:s:r:",
|
||||||
|
["help", "band=", "out-directory=", "squelch=", "rate="])
|
||||||
|
except getopt.GetoptError:
|
||||||
|
print_help()
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
for o, a in opts:
|
||||||
|
if o in ('-h', '--help'):
|
||||||
|
print_help()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if o in ('-b', '--band'):
|
||||||
|
print(f"band {a}") # debug
|
||||||
|
|
||||||
|
if o in ('-o', '--out-directory'):
|
||||||
|
print(f"dir {a}") # debug
|
||||||
|
|
||||||
|
if o in ('-s', '--squelch'):
|
||||||
|
print(f"squelch {a}") # debug
|
||||||
|
|
||||||
|
if o in ('-r', '--rate'):
|
||||||
|
print(f"rate {a}") # debug
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
62
skitter/usage.py
Normal file
62
skitter/usage.py
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"help page"
|
||||||
|
|
||||||
|
from os import getenv
|
||||||
|
|
||||||
|
def print_help():
|
||||||
|
"""print help"""
|
||||||
|
NAME = "skitter.py"
|
||||||
|
VERSION = "0.0.0"
|
||||||
|
|
||||||
|
BANNER = '''\x1b[34m
|
||||||
|
▗▖ █ ▄
|
||||||
|
▐▌ ▀ ▐▌ ▐▌ █
|
||||||
|
▗▟██▖▐▌▟▛ ██ ▐███ ▐███ ▟█▙ █▟█▌ █
|
||||||
|
▐▙▄▖▘▐▙█ █ ▐▌ ▐▌ ▐▙▄▟▌ █▘ █
|
||||||
|
▀▀█▖▐▛█▖ █ ▐▌ ▐▌ ▐▛▀▀▘ █ ▀
|
||||||
|
▐▄▄▟▌▐▌▝▙ ▗▄█▄▖ ▐▙▄ ▐▙▄ ▝█▄▄▌ █ ▄
|
||||||
|
▀▀▀ ▝▘ ▀▘▝▀▀▀▘ ▀▀ ▀▀ ▝▀▀ ▀ ▀
|
||||||
|
\x1b[0m'''
|
||||||
|
USAGE = f'''
|
||||||
|
SYNOPSIS
|
||||||
|
{NAME} [--band=|-b FREQ] [--out-directory=|-o DIR] [--squelch=|-s LEVEL] [--rate=|-r SPEED]
|
||||||
|
{NAME} [--help|-h]
|
||||||
|
|
||||||
|
--band
|
||||||
|
-b
|
||||||
|
Desired frequencies (list) to scan.
|
||||||
|
Skitter will sweep through these frequencies at a set rate.
|
||||||
|
|
||||||
|
--out-directory
|
||||||
|
-o
|
||||||
|
Output directory. Default: ./
|
||||||
|
Skitter will save its recordings in a single directory.
|
||||||
|
You might want to create a new directory for recordings.
|
||||||
|
|
||||||
|
--squelch
|
||||||
|
-s
|
||||||
|
Level at which to start listening, in decibels (dB).
|
||||||
|
Anything below this level will be ignored.
|
||||||
|
|
||||||
|
--rate
|
||||||
|
-r
|
||||||
|
Delay (in milliseconds) between changing channels.
|
||||||
|
Increase if your receiver cannot switch frequencies
|
||||||
|
quickly enough.
|
||||||
|
Default: UNSET
|
||||||
|
|
||||||
|
|
||||||
|
--help
|
||||||
|
-h
|
||||||
|
Print this message and exit.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
{NAME} -r 300
|
||||||
|
Sweep through default range and change channels every 300 milliseconds.
|
||||||
|
|
||||||
|
{NAME} -o ~/Music/
|
||||||
|
Run with all default settings and send files to {getenv("HOME")}/Music
|
||||||
|
'''
|
||||||
|
print(BANNER)
|
||||||
|
print(f"skitter v\x1b[33m{VERSION}\x1b[0m")
|
||||||
|
print(USAGE)
|
||||||
44
src/help.py
44
src/help.py
@@ -1,44 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
VERSION = "0.0.0"
|
|
||||||
BANNER = '''\x1b[34m
|
|
||||||
▗▖ █
|
|
||||||
▐▌ ▀ ▐▌ ▐▌
|
|
||||||
▗▟██▖▐▌▟▛ ██ ▐███ ▐███ ▟█▙ █▟█▌
|
|
||||||
▐▙▄▖▘▐▙█ █ ▐▌ ▐▌ ▐▙▄▟▌ █▘
|
|
||||||
▀▀█▖▐▛█▖ █ ▐▌ ▐▌ ▐▛▀▀▘ █
|
|
||||||
▐▄▄▟▌▐▌▝▙ ▗▄█▄▖ ▐▙▄ ▐▙▄ ▝█▄▄▌ █
|
|
||||||
▀▀▀ ▝▘ ▀▘▝▀▀▀▘ ▀▀ ▀▀ ▝▀▀ ▀
|
|
||||||
\x1b[0m'''
|
|
||||||
|
|
||||||
USAGE = '''
|
|
||||||
./skitter.py [--band|-b FREQ] [--squelch|-s LEVEL] [--rate|-r SPEED] [--output|-o DIR]
|
|
||||||
|
|
||||||
--band
|
|
||||||
-b
|
|
||||||
Desired frequencies (list) to scan.
|
|
||||||
Skitter will sweep through these frequencies at a set rate.
|
|
||||||
|
|
||||||
--squelch
|
|
||||||
-s
|
|
||||||
Level at which to start listening, in decibels (dB).
|
|
||||||
Anything below this level will be ignored.
|
|
||||||
|
|
||||||
--rate
|
|
||||||
-s
|
|
||||||
Rate at which to switch channels. Default: UNSET
|
|
||||||
Change this is your device is not able to change channels
|
|
||||||
quickly enough.
|
|
||||||
|
|
||||||
--output
|
|
||||||
-o
|
|
||||||
Output directory. Default: ./
|
|
||||||
Skitter will save its recordings in a single directory.
|
|
||||||
You might want to create a new directory for recordings.
|
|
||||||
'''
|
|
||||||
|
|
||||||
def print_help():
|
|
||||||
print(BANNER)
|
|
||||||
print(f"skitter v\x1b[33m{VERSION}\x1b[0m")
|
|
||||||
print(USAGE)
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user