Feat: packaging (#127)

- Add configuration files for packaging
- Precommit now uses ruff

Co-authored-by: bkfox <thomas bkfox net>
Reviewed-on: rc/aircox#127
This commit is contained in:
Thomas Kairos
2023-10-11 10:58:34 +02:00
parent 5ea092dba6
commit f7a61fe6c0
82 changed files with 332 additions and 935 deletions

View File

@ -62,42 +62,24 @@ class Command(BaseCommand):
"--station",
type=str,
action="append",
help="name of the station to monitor instead of monitoring "
"all stations",
help="name of the station to monitor instead of monitoring " "all stations",
)
group.add_argument(
"-t",
"--timeout",
type=float,
default=Monitor.cancel_timeout.total_seconds() / 60,
help="time to wait in MINUTES before canceling a diffusion that "
"should have ran but did not. ",
help="time to wait in MINUTES before canceling a diffusion that " "should have ran but did not. ",
)
# TODO: sync-timeout, cancel-timeout
def handle(
self,
*args,
config=None,
run=None,
monitor=None,
station=[],
delay=1000,
timeout=600,
**options
):
stations = (
Station.objects.filter(name__in=station)
if station
else Station.objects.all()
)
def handle(self, *args, config=None, run=None, monitor=None, station=[], delay=1000, timeout=600, **options):
stations = Station.objects.filter(name__in=station) if station else Station.objects.all()
streamers = [Streamer(station) for station in stations]
for streamer in streamers:
if not streamer.outputs:
raise RuntimeError(
"Streamer {} has no outputs".format(streamer.id)
)
raise RuntimeError("Streamer {} has no outputs".format(streamer.id))
if config:
streamer.make_config()
if run:
@ -106,10 +88,7 @@ class Command(BaseCommand):
if monitor:
delay = tz.timedelta(milliseconds=delay)
timeout = tz.timedelta(minutes=timeout)
monitors = [
Monitor(streamer, delay, cancel_timeout=timeout)
for streamer in streamers
]
monitors = [Monitor(streamer, delay, cancel_timeout=timeout) for streamer in streamers]
while not run or streamer.is_running:
for monitor in monitors: