more pypo fixes

This commit is contained in:
Kyle Robbertze 2020-01-23 12:37:49 +02:00
parent 44a0cb50e1
commit 6ebb1fd555
14 changed files with 132 additions and 131 deletions

View file

@ -1,12 +1,11 @@
""" Runs Airtime liquidsoap
"""
import argparse
import os
from . import generate_liquidsoap_cfg
import logging
import subprocess
from pypo import pure
PYPO_HOME = '/var/tmp/airtime/pypo/'
@ -16,16 +15,16 @@ def run():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", help="run in debug mode", action="store_true")
args = parser.parse_args()
os.environ["HOME"] = PYPO_HOME
if args.debug:
logging.basicConfig(level=getattr(logging, 'DEBUG', None))
generate_liquidsoap_cfg.run()
''' check liquidsoap version if less than 1.3 use legacy liquidsoap script '''
liquidsoap_version=subprocess.check_output("liquidsoap --version", shell=True)
if "1.1.1" not in liquidsoap_version:
liquidsoap_version = subprocess.check_output("liquidsoap --version", shell=True, text=True)
if pure.version_cmp(liquidsoap_version, "1.3") < 0:
script_path = os.path.join(os.path.dirname(__file__), 'ls_script.liq')
else:
script_path = os.path.join(os.path.dirname(__file__), 'ls_script_legacy.liq')