You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from datetime import datetime, timedelta
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from config import Config
|
|
|
|
|
|
|
|
|
|
|
|
def generate_test_file(fn, delta):
|
|
|
|
subprocess.call(['ffmpeg',
|
|
|
|
'-f', 'lavfi',
|
|
|
|
'-i', 'sine=frequency=1000:duration=%d' % delta.total_seconds(),
|
|
|
|
'-b:a', '%dk' % Config.KBITS,
|
|
|
|
fn])
|
|
|
|
|
|
|
|
|
|
|
|
start = datetime.now().replace(minute=0, second=0) - timedelta(hours=3)
|
|
|
|
end = start + timedelta(hours=6)
|
|
|
|
delta = timedelta(hours=1)
|
|
|
|
|
|
|
|
t = start
|
|
|
|
while t < end:
|
|
|
|
fn = 'tmp/qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format(
|
|
|
|
t.year, t.month, t.day, t.hour, t.minute)
|
|
|
|
print(fn)
|
|
|
|
generate_test_file(fn, delta)
|
|
|
|
|
|
|
|
t += delta
|