|
|
@ -1,9 +1,16 @@
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
KBITS = 128
|
|
|
|
KBITS = 128
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bytes_per_second = KBITS * 1000 // 8
|
|
|
|
def generate_test_file(fn, delta):
|
|
|
|
|
|
|
|
subprocess.call(['ffmpeg',
|
|
|
|
|
|
|
|
'-f', 'lavfi',
|
|
|
|
|
|
|
|
'-i', 'sine=frequency=1000:duration=%d' % delta.total_seconds(),
|
|
|
|
|
|
|
|
'-b:a', '%dk' % KBITS,
|
|
|
|
|
|
|
|
fn])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
start = datetime.now().replace(minute=0, second=0) - timedelta(hours=3)
|
|
|
|
start = datetime.now().replace(minute=0, second=0) - timedelta(hours=3)
|
|
|
|
end = start + timedelta(hours=6)
|
|
|
|
end = start + timedelta(hours=6)
|
|
|
@ -14,8 +21,6 @@ while t < end:
|
|
|
|
fn = 'tmp/qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format(
|
|
|
|
fn = 'tmp/qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format(
|
|
|
|
t.year, t.month, t.day, t.hour, t.minute)
|
|
|
|
t.year, t.month, t.day, t.hour, t.minute)
|
|
|
|
print(fn)
|
|
|
|
print(fn)
|
|
|
|
f = open(fn, 'w')
|
|
|
|
generate_test_file(fn, delta)
|
|
|
|
f.write('\0' * (int(delta.total_seconds()) * bytes_per_second))
|
|
|
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
t += delta
|
|
|
|
t += delta
|
|
|
|