more pypo fixes
This commit is contained in:
parent
44a0cb50e1
commit
6ebb1fd555
14 changed files with 132 additions and 131 deletions
|
@ -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')
|
||||
|
|
|
@ -28,21 +28,21 @@ def generate_liquidsoap_config(ss):
|
|||
except: #Everything else is a string
|
||||
str_buffer = "%s = \"%s\"\n" % (key, value)
|
||||
|
||||
fh.write(str_buffer.encode('utf-8'))
|
||||
fh.write(str_buffer)
|
||||
# ignore squashes unused variable errors from Liquidsoap
|
||||
fh.write(("ignore(%s)\n" % key).encode('utf-8'))
|
||||
fh.write("ignore(%s)\n" % key)
|
||||
|
||||
auth_path = os.path.dirname(os.path.realpath(__file__))
|
||||
fh.write('log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"\n')
|
||||
fh.write('auth_path = "%s/liquidsoap_auth.py"\n' % auth_path)
|
||||
fh.close()
|
||||
|
||||
|
||||
def run():
|
||||
logging.basicConfig(format='%(message)s')
|
||||
attempts = 0
|
||||
max_attempts = 10
|
||||
successful = False
|
||||
|
||||
|
||||
while not successful:
|
||||
try:
|
||||
ac = AirtimeApiClient(logging.getLogger())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue