-
Notifications
You must be signed in to change notification settings - Fork 1
/
oami-converter-test.py
40 lines (34 loc) · 979 Bytes
/
oami-converter-test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from helpers import media
from sys import argv, stderr
from urllib2 import urlopen, Request
url = argv[1]
input_filename = 'oami-gstreamer-test-input'
output_filename = 'oami-gstreamer-test-output'
print("Getting file from <%s>, writing to “%s” … " % \
(
url,
input_filename
)
)
with open(input_filename, 'w') as input_file:
request = Request(url, None, {'User-Agent' : 'oami-gstreamer-converter-check/2012-12-03'})
input_file.write(
urlopen(request).read()
)
print("done.\n")
print("Setting up Media helper for “%s”… " % input_filename)
m = media.Media(input_filename)
print("done.\n")
print("Attempting finding streams of “%s” … " % input_filename)
m.find_streams()
print("done.\n")
print("Attempting conversion of “%s”, writing into “%s” … " % \
(
input_filename,
output_filename
)
)
m.convert(output_filename)
print("done.\n")