forked from rc/aircox
test delay + update template
This commit is contained in:
parent
758bcb30a2
commit
f5b5718231
|
@ -87,9 +87,9 @@ class Command (BaseCommand):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __render_stream_in_radio (stream):
|
def __render_stream_in_radio (stream):
|
||||||
if stream.time_start and stream.time_end:
|
if stream.time_start and stream.time_end:
|
||||||
data = '({{{}h-{}h}}, {})'.format(
|
data = '({{{}-{}}}, {})'.format(
|
||||||
stream.time_start.hour,
|
stream.time_start.strftime('%Hh%M'),
|
||||||
stream.time_end.hour,
|
stream.time_end.strftime('%Hh%M'),
|
||||||
stream.program.get_slug_name()
|
stream.program.get_slug_name()
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
@ -97,7 +97,7 @@ class Command (BaseCommand):
|
||||||
|
|
||||||
if stream.delay:
|
if stream.delay:
|
||||||
data = 'delay({}., {})'.format(
|
data = 'delay({}., {})'.format(
|
||||||
stream.delay.strftime('%s'),
|
3600*stream.delay.hour+60*stream.delay.minute+stream.delay.second,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
|
|
|
@ -6,7 +6,7 @@ def ensure (key, default):
|
||||||
|
|
||||||
|
|
||||||
# dict of values to set (do not forget to escape chars)
|
# dict of values to set (do not forget to escape chars)
|
||||||
ensure('AIRCOX_LIQUIDSOAP_CONFIG', {
|
ensure('AIRCOX_LIQUIDSOAP_SET', {
|
||||||
'log.file.path': '"/tmp/liquidsoap.log"',
|
'log.file.path': '"/tmp/liquidsoap.log"',
|
||||||
'server.socket': 'true',
|
'server.socket': 'true',
|
||||||
'server.socket.path': '"/tmp/liquidsoap.sock"'
|
'server.socket.path': '"/tmp/liquidsoap.sock"'
|
||||||
|
|
|
@ -23,11 +23,15 @@ class ScheduleInline (admin.TabularInline):
|
||||||
model = Schedule
|
model = Schedule
|
||||||
extra = 1
|
extra = 1
|
||||||
|
|
||||||
|
class StreamInline (admin.TabularInline):
|
||||||
|
fields = ['delay', 'time_start', 'time_end']
|
||||||
|
model = Stream
|
||||||
|
extra = 1
|
||||||
|
|
||||||
|
|
||||||
class DiffusionInline (admin.TabularInline):
|
class DiffusionInline (admin.TabularInline):
|
||||||
model = Diffusion
|
model = Diffusion
|
||||||
fields = ('episode', 'type', 'date')
|
fields = ('episode', 'type', 'date')
|
||||||
readonly_fields = ('date',)
|
|
||||||
extra = 1
|
extra = 1
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,8 +70,16 @@ class StreamAdmin (admin.ModelAdmin):
|
||||||
@admin.register(Program)
|
@admin.register(Program)
|
||||||
class ProgramAdmin (NameableAdmin):
|
class ProgramAdmin (NameableAdmin):
|
||||||
fields = NameableAdmin.fields
|
fields = NameableAdmin.fields
|
||||||
inlines = [ ScheduleInline ]
|
inlines = [ ScheduleInline, StreamInline ]
|
||||||
|
|
||||||
|
def get_form (self, request, obj=None, **kwargs):
|
||||||
|
if obj and Stream.objects.filter(program = obj).count() \
|
||||||
|
and ScheduleInline in self.inlines:
|
||||||
|
self.inlines.remove(ScheduleInline)
|
||||||
|
elif obj and Schedule.objects.filter(program = obj).count() \
|
||||||
|
and StreamInline in self.inlines:
|
||||||
|
self.inlines.remove(StreamInline)
|
||||||
|
return super().get_form(request, obj, **kwargs)
|
||||||
|
|
||||||
@admin.register(Episode)
|
@admin.register(Episode)
|
||||||
class EpisodeAdmin (NameableAdmin):
|
class EpisodeAdmin (NameableAdmin):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user