~heckyel/librevideoconverter

ref: d0f6449d66dcb80f210cc389c7f9861bef7282c6 librevideoconverter/test/testdata/fake_converter.py -rw-r--r-- 687 bytes
d0f6449d — Jesús Remove whitespace in README.md 1 year, 5 months ago
                                                                                
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
import time
import sys
import os
import json

filename, output = sys.argv[1:3]
if 'error' in filename:
    print(json.dumps({'finished': True, 'error': 'test error'}))
    sys.exit(1)

if os.path.exists(output):
    print(json.dumps({
        'finished': True,
        'error': '%r existed when we started' % (output,)}))
    sys.exit(1)

time.sleep(0.5)
RANGE = 5
for i in range(RANGE):
    print(json.dumps({
            'filename': filename,
            'output': output,
            'duration': RANGE,
            'progress': i,
            'eta': RANGE - i
            }))
    time.sleep(0.1)

with file(output, 'w') as f:
    f.write('blank')
print(json.dumps({'finished': True}))