from os import getenv as e

from kombu import Queue


CELERY_APP_NAME = 'video_transcoding'


VIDEO_TRANSCODING_CELERY_CONF = {
    'broker_url': e('VIDEO_TRANSCODING_CELERY_BROKER_URL',
                    'amqp://guest:guest@rabbitmq:5672/'),
    'result_backend': e('VIDEO_TRANSCODING_CELERY_RESULT_BACKEND', None),
    'task_default_exchange': CELERY_APP_NAME,
    'task_default_exchange_type': 'topic',
    'task_default_queue': CELERY_APP_NAME,
    'worker_prefetch_multiplier': 1,
    'worker_concurrency': e('VIDEO_TRANSCODING_CELERY_CONCURRENCY'),
    'task_acks_late': True,
    'task_reject_on_worker_lost': True,
    'task_queues': [
        Queue(CELERY_APP_NAME, routing_key=CELERY_APP_NAME),
    ]
}

# Directory for large output files
VIDEO_TEMP_DIR = '/tmp'

# Download source before processing
VIDEO_DOWNLOAD_SOURCE = bool(int(e('VIDEO_DOWNLOAD_SOURCE', 0)))

# A list of WebDAV endpoints for storing video results
VIDEO_ORIGINS = e('VIDEO_ORIGINS',
                  'http://storage.localhost:8080/videos/').split(',')

# Video streamer public urls (comma-separated)
VIDEO_EDGES = e('VIDEO_EDGES', 'http://storage.localhost:8080/').split(',')

# Edge video manifest url template
VIDEO_URL = '{edge}/hls/{filename}1080p.mp4/index.m3u8'

# Output source files checksum
CHECKSUM_SOURCE = bool(int(e('CHECKSUM_SOURCE', 0)))

[((10, 18, 11, 56), 'os.getenv', 'e', ({(10, 20, 10, 57): '"""VIDEO_TRANSCODING_CELERY_BROKER_URL"""', (11, 20, 11, 55): '"""amqp://guest:guest@rabbitmq:5672/"""'}, {}), "('VIDEO_TRANSCODING_CELERY_BROKER_URL', 'amqp://guest:guest@rabbitmq:5672/')", True, 'from os import getenv as e\n'), ((12, 22, 12, 72), 'os.getenv', 'e', ({(12, 24, 12, 65): '"""VIDEO_TRANSCODING_CELERY_RESULT_BACKEND"""', (12, 67, 12, 71): 'None'}, {}), "('VIDEO_TRANSCODING_CELERY_RESULT_BACKEND', None)", True, 'from os import getenv as e\n'), ((17, 26, 17, 67), 'os.getenv', 'e', ({(17, 28, 17, 66): '"""VIDEO_TRANSCODING_CELERY_CONCURRENCY"""'}, {}), "('VIDEO_TRANSCODING_CELERY_CONCURRENCY')", True, 'from os import getenv as e\n'), ((21, 8, 21, 59), 'kombu.Queue', 'Queue', (), '', False, 'from kombu import Queue\n'), ((29, 33, 29, 62), 'os.getenv', 'e', ({(29, 35, 29, 58): '"""VIDEO_DOWNLOAD_SOURCE"""', (29, 60, 29, 61): '0'}, {}), "('VIDEO_DOWNLOAD_SOURCE', 0)", True, 'from os import getenv as e\n'), ((32, 16, 33, 58), 'os.getenv', 'e', ({(32, 18, 32, 33): '"""VIDEO_ORIGINS"""', (33, 18, 33, 57): '"""http://storage.localhost:8080/videos/"""'}, {}), "('VIDEO_ORIGINS', 'http://storage.localhost:8080/videos/')", True, 'from os import getenv as e\n'), ((36, 14, 36, 64), 'os.getenv', 'e', ({(36, 16, 36, 29): '"""VIDEO_EDGES"""', (36, 31, 36, 63): '"""http://storage.localhost:8080/"""'}, {}), "('VIDEO_EDGES', 'http://storage.localhost:8080/')", True, 'from os import getenv as e\n'), ((42, 27, 42, 50), 'os.getenv', 'e', ({(42, 29, 42, 46): '"""CHECKSUM_SOURCE"""', (42, 48, 42, 49): '0'}, {}), "('CHECKSUM_SOURCE', 0)", True, 'from os import getenv as e\n')]