コード例 #1
0
ファイル: mm1.py プロジェクト: AtomLaw/Airtime
    #logging.captureWarnings(True)

    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.AirtimeApiClient()
    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'))
コード例 #2
0
import pwd
import grp
import subprocess
import re

import os.path

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

logger = logging.getLogger()
mmconfig = AirtimeMediaConfig(logger)

# get stor folder location from /etc/airtime/airtime.conf
config = ConfigParser.RawConfigParser()
config.read("/etc/airtime/airtime.conf")
stor_dir = config.get("general", "base_files_dir") + "/stor"
organize_dir = stor_dir + "/organize"

mmconfig.storage_directory = os.path.normpath(stor_dir)
mmconfig.imported_directory = os.path.normpath(stor_dir + "/imported")
mmconfig.organize_directory = os.path.normpath(organize_dir)

mmc = MediaMonitorCommon(mmconfig)

try:
    os.makedirs(organize_dir)
コード例 #3
0
from airtimefilemonitor.workerprocess import MediaMonitorWorkerProcess
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')
    
コード例 #4
0
import pwd
import grp
import subprocess
import re

import os.path

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

logger = logging.getLogger()
mmconfig = AirtimeMediaConfig(logger)

#get stor folder location from /etc/airtime/airtime.conf
config = ConfigParser.RawConfigParser()
config.read('/etc/airtime/airtime.conf')
stor_dir = config.get('general', 'base_files_dir') + "/stor"
organize_dir = stor_dir + '/organize'

mmconfig.storage_directory = os.path.normpath(stor_dir)
mmconfig.imported_directory = os.path.normpath(stor_dir + '/imported')
mmconfig.organize_directory = os.path.normpath(organize_dir)

mmc = MediaMonitorCommon(mmconfig)

try:
    os.makedirs(organize_dir)
コード例 #5
0
ファイル: mm1.py プロジェクト: xabispacebiker/airtime-2.5.2.1
    #logging.captureWarnings(True)

    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.AirtimeApiClient()
    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'))