forked from rc/aircox
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:
@ -62,9 +62,7 @@ class Monitor:
|
||||
|
||||
def get_logs_queryset(self):
|
||||
"""Return queryset to assign as `self.logs`"""
|
||||
return self.station.log_set.select_related(
|
||||
"diffusion", "sound", "track"
|
||||
).order_by("-pk")
|
||||
return self.station.log_set.select_related("diffusion", "sound", "track").order_by("-pk")
|
||||
|
||||
def init_last_sound_logs(self):
|
||||
"""Retrieve last logs and initialize `last_sound_logs`"""
|
||||
@ -136,12 +134,7 @@ class Monitor:
|
||||
diff = None
|
||||
sound = Sound.objects.path(air_uri).first()
|
||||
if sound and sound.episode_id is not None:
|
||||
diff = (
|
||||
Diffusion.objects.episode(id=sound.episode_id)
|
||||
.on_air()
|
||||
.now(air_time)
|
||||
.first()
|
||||
)
|
||||
diff = Diffusion.objects.episode(id=sound.episode_id).on_air().now(air_time).first()
|
||||
|
||||
# log sound on air
|
||||
return self.log(
|
||||
@ -158,9 +151,7 @@ class Monitor:
|
||||
if log.diffusion:
|
||||
return
|
||||
|
||||
tracks = Track.objects.filter(
|
||||
sound_id=log.sound_id, timestamp__isnull=False
|
||||
).order_by("timestamp")
|
||||
tracks = Track.objects.filter(sound_id=log.sound_id, timestamp__isnull=False).order_by("timestamp")
|
||||
if not tracks.exists():
|
||||
return
|
||||
|
||||
@ -217,11 +208,7 @@ class Monitor:
|
||||
|
||||
dealer = self.streamer.dealer
|
||||
# start
|
||||
if (
|
||||
not dealer.queue
|
||||
and dealer.rid is None
|
||||
or dealer.remaining < self.delay.total_seconds()
|
||||
):
|
||||
if not dealer.queue and dealer.rid is None or dealer.remaining < self.delay.total_seconds():
|
||||
self.start_diff(dealer, diff)
|
||||
# cancel
|
||||
elif diff.start < now - self.cancel_timeout:
|
||||
|
Reference in New Issue
Block a user