Example #1
0
 def __init__(self, q):
     Thread.__init__(self)
     logger = logging.getLogger('fetch')
     self.api_client = api_client.api_client_factory(config)
     self.set_export_source('scheduler')
     self.queue = q
     logger.info("PypoFetch: init complete")
Example #2
0
    def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.fetch_queue = pypoFetch_q
        self.push_queue = pypoPush_q
        self.media_prepare_queue = media_q
        
        self.telnet_lock = telnet_lock
        
        self.logger = logging.getLogger();
        
        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, e:
            pass
Example #3
0
 def __init__(self, q):
     Thread.__init__(self)
     logger = logging.getLogger('fetch')
     self.api_client = api_client.api_client_factory(config)
     self.set_export_source('scheduler')
     self.queue = q
     logger.info("PypoFetch: init complete")
Example #4
0
    def __init__(self, pypoFetch_q, pypoPush_q, media_q, telnet_lock):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.fetch_queue = pypoFetch_q
        self.push_queue = pypoPush_q
        self.media_prepare_queue = media_q

        self.telnet_lock = telnet_lock

        self.logger = logging.getLogger()

        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, e:
            pass
Example #5
0
 def __init__(self, show_instance, show_name, filelength, start_time):
     Thread.__init__(self)
     self.logger = logging.getLogger('recorder')
     self.api_client = api_client.api_client_factory(config, self.logger)
     self.filelength = filelength
     self.start_time = start_time
     self.show_instance = show_instance
     self.show_name = show_name
     self.p = None
Example #6
0
    def __init__(self, q, telnet_lock):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.queue = q

        self.telnet_lock = telnet_lock

        self.pushed_objects = {}
        self.logger = logging.getLogger('push')
Example #7
0
 def __init__ (self, show_instance, show_name, filelength, start_time):
     Thread.__init__(self)
     self.logger = logging.getLogger('recorder')
     self.api_client = api_client.api_client_factory(config, self.logger)
     self.filelength = filelength
     self.start_time = start_time
     self.show_instance = show_instance
     self.show_name = show_name
     self.p = None
Example #8
0
    def __init__(self, q, telnet_lock):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.queue = q

        self.telnet_lock = telnet_lock

        self.pushed_objects = {}
        self.logger = logging.getLogger('push')
Example #9
0
 def __init__(self, q):
     Thread.__init__(self)
     self.logger = logging.getLogger('recorder')
     self.api_client = api_client.api_client_factory(config, self.logger)
     self.api_client.register_component("show-recorder")
     self.sr = None
     self.shows_to_record = {}
     self.server_timezone = ''
     self.queue = q
     self.logger.info("RecorderFetch: init complete")
     self.loops = 0
Example #10
0
 def __init__(self, q):
     Thread.__init__(self)
     self.logger = logging.getLogger('recorder')
     self.api_client = api_client.api_client_factory(config, self.logger)
     self.api_client.register_component("show-recorder")
     self.sr = None
     self.shows_to_record = {}
     self.server_timezone = ''
     self.queue = q
     self.logger.info("RecorderFetch: init complete")
     self.loops = 0
    def __init__(self):
        config = ConfigObj("/etc/airtime/airtime.conf")
        self.api_client = apc.api_client_factory(config)
        """
        try:
            logging.config.fileConfig("logging.cfg")
        except Exception, e:
            print 'Error configuring logging: ', e
            sys.exit(1)
        """

        self.logger = logging.getLogger()
        self.logger.info("Adding %s on watch list...", "xxx")

        self.scan()
Example #12
0
    def __init__(self):
        config = ConfigObj('/etc/airtime/airtime.conf')
        self.api_client = apc.api_client_factory(config)

        """        
        try:
            logging.config.fileConfig("logging.cfg")
        except Exception, e:
            print 'Error configuring logging: ', e
            sys.exit(1)
        """
        
        self.logger = logging.getLogger()
        self.logger.info("Adding %s on watch list...", "xxx")
        
        self.scan()
Example #13
0
    def __init__(self, q):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.set_export_source('scheduler')
        self.queue = q

        self.schedule = dict()
        self.playlists = dict()
        self.stream_metadata = dict()
        """
        push_ahead2 MUST be < push_ahead. The difference in these two values
        gives the number of seconds of the window of opportunity for the scheduler
        to catch when a playlist is to be played.
        """
        self.push_ahead = 10
        self.push_ahead2 = self.push_ahead - 5

        #toggle between "stop" and "play". Keeps track of the state of
        #liquidsoap
        self.liquidsoap_state_play = True
Example #14
0
    def __init__(self, q):
        Thread.__init__(self)
        self.api_client = api_client.api_client_factory(config)
        self.set_export_source('scheduler')
        self.queue = q

        self.schedule = dict()
        self.playlists = dict()
        self.stream_metadata = dict()

        """
        push_ahead2 MUST be < push_ahead. The difference in these two values
        gives the number of seconds of the window of opportunity for the scheduler
        to catch when a playlist is to be played.
        """
        self.push_ahead = 10
        self.push_ahead2 = self.push_ahead -5

        #toggle between "stop" and "play". Keeps track of the state of
        #liquidsoap
        self.liquidsoap_state_play = True
Example #15
0
    
    logger = logging.getLogger()
    LogWriter.override_std_err(logger)
    
except Exception, e:
    print 'Error configuring logging: ', e
    sys.exit(1)

logger.info("\n\n*** Media Monitor bootup ***\n\n")


try:
    configure_locale()
    
    config = AirtimeMediaConfig(logger)
    api_client = apc.api_client_factory(config.cfg)
    api_client.register_component("media-monitor")
    
    logger.info("Setting up monitor")
    response = None
    while response is None:
        response = api_client.setup_media_monitor()
        time.sleep(5)
        
    storage_directory = response["stor"]
    watched_dirs = response["watched_dirs"]
    logger.info("Storage Directory is: %s", storage_directory)
    config.storage_directory = os.path.normpath(storage_directory)
    config.imported_directory = os.path.normpath(os.path.join(storage_directory, 'imported'))
    config.organize_directory = os.path.normpath(os.path.join(storage_directory, 'organize'))
    config.recorded_directory = os.path.normpath(os.path.join(storage_directory, 'recorded'))
Example #16
0
 def __init__(self):
     self.api_client = api_client.api_client_factory(config)
Example #17
0
 def selfcheck(self):
     self.api_client = api_client.api_client_factory(config)
     return self.api_client.is_server_compatible()
Example #18
0
    logger.info('###########################################')

    signal.signal(signal.SIGINT, keyboardInterruptHandler)

    # initialize
    g = Global()

    while not g.selfcheck(): time.sleep(5)
    
    logger = logging.getLogger()

    if options.test:
        g.test_api()
        sys.exit()

    api_client = api_client.api_client_factory(config)
    api_client.register_component("pypo")

    pypoFetch_q = Queue()
    recorder_q = Queue()
    pypoPush_q = Queue()
    
    telnet_lock = Lock()
    
    """
    This queue is shared between pypo-fetch and pypo-file, where pypo-file
    is the receiver. Pypo-fetch will send every schedule it gets to pypo-file
    and pypo will parse this schedule to determine which file has the highest
    priority, and will retrieve it.
    """
    media_q = Queue()
Example #19
0
    signal.signal(signal.SIGINT, keyboardInterruptHandler)

    # initialize
    g = Global()

    while not g.selfcheck():
        time.sleep(5)

    logger = logging.getLogger()

    if options.test:
        g.test_api()
        sys.exit()

    api_client = api_client.api_client_factory(config)
    api_client.register_component("pypo")

    pypoFetch_q = Queue()
    recorder_q = Queue()
    pypoPush_q = Queue()

    telnet_lock = Lock()
    """
    This queue is shared between pypo-fetch and pypo-file, where pypo-file
    is the receiver. Pypo-fetch will send every schedule it gets to pypo-file
    and pypo will parse this schedule to determine which file has the highest
    priority, and will retrieve it.
    """
    media_q = Queue()
Example #20
0
 def __init__(self):
     self.api_client = api_client.api_client_factory(config)
Example #21
0
 def selfcheck(self):
     self.api_client = api_client.api_client_factory(config)
     return self.api_client.is_server_compatible()
Example #22
0
 def __init__(self):
     self.api_client = api_client.api_client_factory(config)
     self.set_export_source('scheduler')
Example #23
0
from airtimefilemonitor.airtimemediamonitorbootstrap import AirtimeMediaMonitorBootstrap

# configure logging
try:
    logging.config.fileConfig("logging.cfg")
except Exception, e:
    print 'Error configuring logging: ', e
    sys.exit(1)

logger = logging.getLogger()

logger.info("\n\n*** Media Monitor bootup ***\n\n")

try:
    config = AirtimeMediaConfig(logger)
    api_client = apc.api_client_factory(config.cfg)
    
    logger.info("Setting up monitor")
    response = None
    while response is None:
        response = api_client.setup_media_monitor()
        time.sleep(5)
        
    storage_directory = apc.encode_to(response["stor"], 'utf-8')
    logger.info("Storage Directory is: %s", storage_directory)
    config.storage_directory = os.path.normpath(storage_directory)
    config.imported_directory = os.path.normpath(storage_directory + '/imported')
    config.organize_directory = os.path.normpath(storage_directory + '/organize')
    config.recorded_directory = os.path.normpath(storage_directory + '/recorded')
    
    multi_queue = mpQueue()
Example #24
0
 def __init__(self):
     self.api_client = api_client.api_client_factory(config)
     self.set_export_source('scheduler')
Example #25
0
        else:
            temp = d[u'value']
            if(temp == ""):
                temp = "0"
            buffer += temp
        buffer += "\n"
        fh.write(api_client.encode_to(buffer))
    fh.write('log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"\n')
    fh.close()

PATH_INI_FILE = '/etc/airtime/pypo.cfg'
    
try:
    config = ConfigObj(PATH_INI_FILE)
except Exception, e:
    print 'Error loading config file: ', e
    sys.exit(1)

logging.basicConfig(format='%(message)s')
ac = api_client.api_client_factory(config, logging.getLogger())
ss = ac.get_stream_setting()

if ss is not None:
    try:
        generate_liquidsoap_config(ss)
    except Exception, e:
        logging.error(e)
else:
    print "Unable to connect to the Airtime server."
    sys.exit(1)
Example #26
0
            temp = d[u'value']
            if (temp == ""):
                temp = "0"
            buffer += temp
        buffer += "\n"
        fh.write(api_client.encode_to(buffer))
    fh.write('log_file = "/var/log/airtime/pypo-liquidsoap/<script>.log"\n')
    fh.close()


PATH_INI_FILE = '/etc/airtime/pypo.cfg'

try:
    config = ConfigObj(PATH_INI_FILE)
except Exception, e:
    print 'Error loading config file: ', e
    sys.exit(1)

logging.basicConfig(format='%(message)s')
ac = api_client.api_client_factory(config, logging.getLogger())
ss = ac.get_stream_setting()

if ss is not None:
    try:
        generate_liquidsoap_config(ss)
    except Exception, e:
        logging.error(e)
else:
    print "Unable to connect to the Airtime server."
    sys.exit(1)