我用刚开始博托前一天,但以前的答案不适合我 - 不知道如果API更改或什么(似乎有点奇怪,如果它是二d,但无论如何)。这是我做到的。
#!/usr/bin/env python
# Boto
import boto
# Debug
boto.set_stream_logger('boto')
# Pipeline Id
pipeline_id = 'lotsofcharacters-393824'
# The input object
input_object = {
'Key': 'foo.webm',
'Container': 'webm',
'AspectRatio': 'auto',
'FrameRate': 'auto',
'Resolution': 'auto',
'Interlaced': 'auto'
}
# The object (or objects) that will be created by the transcoding job;
# note that this is a list of dictionaries.
output_objects = [
{
'Key': 'bar.mp4',
'PresetId': '1351620000001-000010',
'Rotate': 'auto',
'ThumbnailPattern': '',
}
]
# Phone home
# - Har har.
et = boto.connect_elastictranscoder()
# Create the job
# - If successful, this will execute immediately.
et.create_job(pipeline_id, input_name=input_object, outputs=output_objects)
很明显,这是一个人为的例子,只是从一个独立的python脚本运行;它假定你有一个.boto文件在你的证书中。
另一件需要注意的是PresetId;您可以在Presets下的Elastic Transcoder的AWS管理控制台中找到它们。最后,可以填入字典中的值逐字地从以下链接中提取 - 据我所知,它们只是插入到REST调用中(很明显,区分大小写)。
AWS Create Job API
请你给我的,你做了什么样本?我正在创建一个项目,让博托自动化我的工作,但我甚至找不到一个简单的例子! –
对不起,这是相当晚...这段代码很旧,但也许它会帮助别人https://github.com/eddiem3/automated-uploader/blob/master/main.py –
我不需要它们不管怎么说,但是非常感谢;) –