From 1fc757c6fb98ee2aa9f53138a0f1d85173e1ff3f Mon Sep 17 00:00:00 2001 From: neingeist Date: Sun, 11 Nov 2018 17:13:33 +0100 Subject: [PATCH] add a script to generate test data --- generate-test-data.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 generate-test-data.py diff --git a/generate-test-data.py b/generate-test-data.py new file mode 100644 index 0000000..a9be763 --- /dev/null +++ b/generate-test-data.py @@ -0,0 +1,21 @@ +from datetime import datetime, timedelta + +KBITS = 128 + + +bytes_per_second = KBITS * 1024 // 8 + +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) + f = open(fn, 'w') + f.write('\0' * (int(delta.total_seconds()) * bytes_per_second)) + f.close() + + t += delta