#!/usr/bin/env python3  
# -*- coding: utf-8 -*-  
"""
@Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved.
@AUTHOR: ASJRD018
@NAME: Ansjer
@software: PyCharm
@DATE: 2018/5/17 10:09
@Version: python3.6
@MODIFY DECORD:ansjer dev
@file: ElasticTranscoderClassObject.py
@Contact: chanjunkai@163.com
"""
from boto3.session import Session
from Ansjer.config import *

class ElasticTranscoder:
    def __init__(self, *args, **kwargs):
        self.access_id = AWS_ACCESS_ID,
        self.access_secret = AWS_ACCESS_SECRET,
        session = Session(
            aws_access_key_id=AWS_ACCESS_ID,
            aws_secret_access_key=AWS_ACCESS_SECRET,
            region_name=AWS_ACCESS_REGION,
        )
        self.conn = session.client('elastictranscoder')

    def create_job(self, InputKey='', OutputKey=''):
        response = self.conn.create_job(
            PipelineId='1526962004445-bmasp8',
            Input={
                'Key': InputKey
            },
            Outputs=[
                {
                    'Key': OutputKey,
                    'PresetId': '1351620000001-200010',
                    'SegmentDuration': '2',
                }
            ]
        )
        print(response)
        if response['ResponseMetadata']['HTTPStatusCode'] == 201:
            return True
        else:
            return False
