CC-2079: Airtime 1.7 stops playing after a certain amount of time
CC-2080: Turn pypo-fetch and pypo-push into threads of the same process Fixed bug where it wasnt possible to exit the program with Control-C.
This commit is contained in:
parent
b650abcbb8
commit
3e27a3de01
1 changed files with 13 additions and 9 deletions
|
@ -7,14 +7,13 @@ Python part of radio playout (pypo)
|
||||||
The main functions are "fetch" (./pypo_cli.py -f) and "push" (./pypo_cli.py -p)
|
The main functions are "fetch" (./pypo_cli.py -f) and "push" (./pypo_cli.py -p)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# python defaults (debian default)
|
|
||||||
import time
|
import time
|
||||||
#import calendar
|
#import calendar
|
||||||
|
|
||||||
|
|
||||||
#import traceback
|
#import traceback
|
||||||
from optparse import *
|
from optparse import *
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
#import datetime
|
#import datetime
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
|
@ -32,7 +31,6 @@ from Queue import Queue
|
||||||
from pypopush import PypoPush
|
from pypopush import PypoPush
|
||||||
from pypofetch import PypoFetch
|
from pypofetch import PypoFetch
|
||||||
|
|
||||||
# additional modules (should be checked)
|
|
||||||
from configobj import ConfigObj
|
from configobj import ConfigObj
|
||||||
|
|
||||||
# custom imports
|
# custom imports
|
||||||
|
@ -54,7 +52,6 @@ parser.add_option("-v", "--compat", help="Check compatibility with server API ve
|
||||||
parser.add_option("-t", "--test", help="Do a test to make sure everything is working properly.", default=False, action="store_true", dest="test")
|
parser.add_option("-t", "--test", help="Do a test to make sure everything is working properly.", default=False, action="store_true", dest="test")
|
||||||
parser.add_option("-f", "--fetch-scheduler", help="Fetch the schedule from server. This is a polling process that runs forever.", default=False, action="store_true", dest="fetch_scheduler")
|
parser.add_option("-f", "--fetch-scheduler", help="Fetch the schedule from server. This is a polling process that runs forever.", default=False, action="store_true", dest="fetch_scheduler")
|
||||||
parser.add_option("-p", "--push-scheduler", help="Push the schedule to Liquidsoap. This is a polling process that runs forever.", default=False, action="store_true", dest="push_scheduler")
|
parser.add_option("-p", "--push-scheduler", help="Push the schedule to Liquidsoap. This is a polling process that runs forever.", default=False, action="store_true", dest="push_scheduler")
|
||||||
|
|
||||||
parser.add_option("-b", "--cleanup", help="Cleanup", default=False, action="store_true", dest="cleanup")
|
parser.add_option("-b", "--cleanup", help="Cleanup", default=False, action="store_true", dest="cleanup")
|
||||||
parser.add_option("-c", "--check", help="Check the cached schedule and exit", default=False, action="store_true", dest="check")
|
parser.add_option("-c", "--check", help="Check the cached schedule and exit", default=False, action="store_true", dest="check")
|
||||||
|
|
||||||
|
@ -118,15 +115,19 @@ class Global:
|
||||||
for media in playlist['medias']:
|
for media in playlist['medias']:
|
||||||
print media
|
print media
|
||||||
|
|
||||||
|
def keyboardInterruptHandler(signum, frame):
|
||||||
|
print "\nKeyboard Interrupt\n"
|
||||||
|
sys.exit();
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print '###########################################'
|
print '###########################################'
|
||||||
print '# *** pypo *** #'
|
print '# *** pypo *** #'
|
||||||
print '# Liquidsoap + External Scheduler #'
|
print '# Liquidsoap Scheduled Playout System #'
|
||||||
print '# Playout System #'
|
|
||||||
print '###########################################'
|
print '###########################################'
|
||||||
|
|
||||||
|
signal.signal(signal.SIGINT, keyboardInterruptHandler)
|
||||||
|
|
||||||
# initialize
|
# initialize
|
||||||
g = Global()
|
g = Global()
|
||||||
g.selfcheck()
|
g.selfcheck()
|
||||||
|
@ -140,14 +141,17 @@ if __name__ == '__main__':
|
||||||
q = Queue()
|
q = Queue()
|
||||||
|
|
||||||
pp = PypoPush(q)
|
pp = PypoPush(q)
|
||||||
|
pp.daemon = True
|
||||||
pp.start()
|
pp.start()
|
||||||
|
|
||||||
pf = PypoFetch(q)
|
pf = PypoFetch(q)
|
||||||
|
pf.daemon = True
|
||||||
pf.start()
|
pf.start()
|
||||||
|
|
||||||
pp.join()
|
while True: time.sleep(3600)
|
||||||
pf.join()
|
|
||||||
|
|
||||||
|
#pp.join()
|
||||||
|
#pf.join()
|
||||||
"""
|
"""
|
||||||
if options.check:
|
if options.check:
|
||||||
try: g.check_schedule()
|
try: g.check_schedule()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue