add a rerun field to diffusion; fix minor bug that can happen on new year's eve

This commit is contained in:
bkfox
2015-11-17 15:45:29 +01:00
parent 64c59f22ab
commit 44fc4dae31
5 changed files with 90 additions and 19 deletions

View File

@ -117,6 +117,11 @@
{% include 'aircox_liquidsoap/base_source.html' %}
{% endfor %}
</div>
<div class="next">
{% for diffusion in controller.next_diffusions %}
{{ diffusion }}
{% endfor %}
</div>
</div>
{% endwith %}
{% endfor %}

View File

@ -38,7 +38,7 @@ class Connector:
self.__socket.connect(self.address)
self.__available = True
except:
print('can not connect to liquidsoap socket {}'.format(address))
print('can not connect to liquidsoap socket {}'.format(self.address))
self.__available = False
return -1
@ -218,7 +218,12 @@ class Dealer (Source):
pass
def get_next_diffusion (self):
pass
diffusions = models.Diffusion.get_next(self.station)
if not diffusions.count():
return
diffusion = diffusions[0]
return diffusion
def on_air (self, value = True):
pass
@ -286,6 +291,12 @@ class Controller:
return self.dealer
return self.streams.get(source_id)
def next_diffusions (self, count = 5):
"""
Return a list of the count next diffusions
"""
return models.Diffusion.get_next(self.station)[:count]
def update_all (self):
"""
Fetch and update all sources metadata.
@ -316,4 +327,3 @@ class Monitor:
controller.update_all()