示例#1
0
 def __init__(self, config, logger=None):
     Thread.__init__(self)
     self.config = config
     self.api_client = api_client.AirtimeApiClient()
     if logger is None:
         self.logger = logging.getLogger()
     else:
         self.logger = logger
示例#2
0
    def __init__(self, q, telnet_lock, pypo_liquidsoap, config):
        Thread.__init__(self)
        self.api_client = api_client.AirtimeApiClient()
        self.queue = q

        self.telnet_lock = telnet_lock
        self.config = config

        self.pushed_objects = {}
        self.logger = logging.getLogger("push")
        self.current_prebuffering_stream_id = None
        self.queue_id = 0

        self.future_scheduled_queue = Queue()
        self.pypo_liquidsoap = pypo_liquidsoap

        self.plq = PypoLiqQueue(self.future_scheduled_queue,
                                self.pypo_liquidsoap, self.logger)
        self.plq.daemon = True
        self.plq.start()
示例#3
0
    def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock,
                 pypo_liquidsoap, config):
        Thread.__init__(self)

        #Hacky...
        PypoFetch.ref = self

        self.v1_api_client = v1_api_client.AirtimeApiClient()
        self.api_client = api_client.AirtimeApiClient()
        self.fetch_queue = pypoFetch_q
        self.push_queue = pypoPush_q
        self.media_prepare_queue = media_q
        self.last_update_schedule_timestamp = time.time()
        self.config = config
        self.listener_timeout = POLL_INTERVAL

        self.telnet_lock = telnet_lock

        self.logger = logging.getLogger()

        self.pypo_liquidsoap = pypo_liquidsoap

        self.cache_dir = os.path.join(config["cache_dir"], "scheduler")
        self.logger.debug("Cache dir %s", self.cache_dir)

        try:
            if not os.path.isdir(dir):
                """
                We get here if path does not exist, or path does exist but
                is a file. We are not handling the second case, but don't
                think we actually care about handling it.
                """
                self.logger.debug("Cache dir does not exist. Creating...")
                os.makedirs(dir)
        except Exception as e:
            pass

        self.schedule_data = []
        self.logger.info("PypoFetch: init complete")
示例#4
0
def api_client(logger):
    """
    api_client returns the correct instance of AirtimeApiClient. Although there is only one
    instance to choose from at the moment.
    """
    return v1_api_client.AirtimeApiClient(logger)
示例#5
0
from api_clients import version1 as api_client
import sys

api_clients = api_client.AirtimeApiClient()

dj_type = sys.argv[1]
username = sys.argv[2]
password = sys.argv[3]

source_type = ''
if dj_type == '--master':
    source_type = 'master'
elif dj_type == '--dj':
    source_type = 'dj'

response = api_clients.check_live_stream_auth(username, password, source_type)

if 'msg' in response and response['msg'] == True:
    print(response['msg'])
    sys.exit(0)
else:
    print(False)
    sys.exit(1)