feat:
--Wroking !
This commit is contained in:
commit
a4c770217e
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
venv/
|
||||||
|
|
||||||
|
# docker-compose.yml
|
||||||
|
|
||||||
|
# Python cache
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
|
||||||
|
# IDE files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
0
experimental.py
Normal file
0
experimental.py
Normal file
32
nas_schedular_service.py
Normal file
32
nas_schedular_service.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
from fastapi import FastAPI
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
from pydantic import BaseModel
|
||||||
|
from typing import Optional
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"],
|
||||||
|
allow_methods=["*"],
|
||||||
|
allow_headers=["*"],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class AudioExportConfig(BaseModel):
|
||||||
|
audio_format: Optional[str] = None
|
||||||
|
nas_push_timing: Optional[str] = None
|
||||||
|
|
||||||
|
@app.post("/audio-export-settings")
|
||||||
|
def audio_export_settings(config: AudioExportConfig):
|
||||||
|
print(f"\n[+] Audio export settings received:")
|
||||||
|
print(f" audio_format : {config.audio_format}")
|
||||||
|
print(f" nas_push_timing : {config.nas_push_timing}")
|
||||||
|
return {
|
||||||
|
"status": "success",
|
||||||
|
"message": "Audio export settings received.",
|
||||||
|
"settings": {
|
||||||
|
"audio_format": config.audio_format,
|
||||||
|
"nas_push_timing": config.nas_push_timing
|
||||||
|
}
|
||||||
|
}
|
||||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
fastapi==0.137.2
|
||||||
|
uvicorn==0.49.0
|
||||||
31
samba.py
Normal file
31
samba.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
SAMBA_SERVER = "172.16.10.144"
|
||||||
|
# SAMBA_SHARE = "wav_files"
|
||||||
|
SAMBA_SHARE = "desktop"
|
||||||
|
LOCAL_FILE = "test.wav"
|
||||||
|
DOCKER_VOLUME_PATH = "/var/lib/docker/volumes/pymumble_data/_data"
|
||||||
|
def push(LOCAL_FILE):
|
||||||
|
cmd = [
|
||||||
|
"smbclient",
|
||||||
|
f"//{SAMBA_SERVER}/{SAMBA_SHARE}",
|
||||||
|
"-N", # no password
|
||||||
|
"-c", f"put {LOCAL_FILE}"
|
||||||
|
]
|
||||||
|
result = subprocess.run(cmd, capture_output=True, text=True)
|
||||||
|
|
||||||
|
print(result.stdout)
|
||||||
|
print(result.stderr)
|
||||||
|
if result.returncode == 0:
|
||||||
|
print("[✓] Pushed successfully")
|
||||||
|
os.remove(LOCAL_FILE)
|
||||||
|
print(f"[✓] Deleted local file: {LOCAL_FILE}")
|
||||||
|
else:
|
||||||
|
print("[!] Push failed")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
push(LOCAL_FILE)
|
||||||
Loading…
Reference in New Issue
Block a user