2015-01-28 00:43:36 +01:00
|
|
|
""" Runs Airtime liquidsoap
|
|
|
|
"""
|
|
|
|
import argparse
|
|
|
|
import os
|
2020-01-16 15:32:51 +01:00
|
|
|
from . import generate_liquidsoap_cfg
|
2017-04-15 23:27:04 +02:00
|
|
|
import logging
|
2019-12-31 04:07:48 +01:00
|
|
|
import subprocess
|
2020-01-23 11:37:49 +01:00
|
|
|
from pypo import pure
|
2015-01-28 00:43:36 +01:00
|
|
|
|
|
|
|
PYPO_HOME = '/var/tmp/airtime/pypo/'
|
|
|
|
|
|
|
|
def run():
|
|
|
|
'''Entry-point for this application'''
|
2020-01-16 14:33:44 +01:00
|
|
|
print("Airtime Liquidsoap")
|
2015-01-28 00:43:36 +01:00
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument("-d", "--debug", help="run in debug mode", action="store_true")
|
|
|
|
args = parser.parse_args()
|
2020-01-23 11:37:49 +01:00
|
|
|
|
2015-01-28 00:43:36 +01:00
|
|
|
os.environ["HOME"] = PYPO_HOME
|
2017-04-15 23:27:04 +02:00
|
|
|
|
|
|
|
if args.debug:
|
|
|
|
logging.basicConfig(level=getattr(logging, 'DEBUG', None))
|
2020-01-23 11:37:49 +01:00
|
|
|
|
2015-01-28 00:43:36 +01:00
|
|
|
generate_liquidsoap_cfg.run()
|
2020-12-24 23:18:15 +01:00
|
|
|
''' check liquidsoap version so we can run a scripts matching the liquidsoap minor version '''
|
|
|
|
liquidsoap_version = subprocess.check_output("liquidsoap --version", shell=True, universal_newlines=True)[0:3]
|
|
|
|
script_path = os.path.join(os.path.dirname(__file__), liquidsoap_version, 'ls_script.py')
|
2015-01-28 00:43:36 +01:00
|
|
|
if args.debug:
|
|
|
|
os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f', '--debug')
|
|
|
|
else:
|
|
|
|
os.execl('/usr/bin/liquidsoap', 'airtime-liquidsoap', script_path, '--verbose', '-f')
|
|
|
|
|
2019-12-31 04:07:48 +01:00
|
|
|
run()
|