Added more stuff
This commit is contained in:
30
push_csirip.py
Normal file
30
push_csirip.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
import requests
|
||||
import os
|
||||
import os.path
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
def main():
|
||||
for root, _, files in os.walk("big_chop_output/"):
|
||||
for file in files:
|
||||
full_filename = os.path.join(root,file)
|
||||
print(".", end='', flush=True)
|
||||
description = {"device_id": int(os.path.splitext(file)[0]), "date": datetime.now().isoformat()}
|
||||
files = {
|
||||
"file": (
|
||||
os.path.basename(file),
|
||||
open(full_filename, 'rb').read(),
|
||||
'audio/wave',
|
||||
{'Content-length': os.path.getsize(full_filename)}
|
||||
),
|
||||
"description": (None, json.dumps(description), "application/json")
|
||||
}
|
||||
|
||||
r = requests.post("http://127.0.0.1:8000/filter", files=files)
|
||||
r.raise_for_status()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user