diff --git a/app/main.py b/app/main.py index c8bd621..ea6e6b7 100644 --- a/app/main.py +++ b/app/main.py @@ -1008,6 +1008,7 @@ class YouTubeJobIn(BaseModel): subtitle_style: str = "reels" whisper_model: str = "large-v3" quality: str = "medium" + tv_station: str = "FOLX SLOVENIJA" # za Nextcloud target mapo class StartJobIn(BaseModel): @@ -1031,6 +1032,8 @@ class StartJobIn(BaseModel): whisper_provider: str = "auto" # auto / elevenlabs / local # Batch tracking za multi-upload (Telegram summary) batch_id: Optional[str] = None + # TV postaja — določa Nextcloud target mapo + tv_station: str = "FOLX SLOVENIJA" # ──────────────────────────────────────────────────────────────── @@ -1160,6 +1163,7 @@ async def start_processing( llm_model=payload.llm_model, whisper_provider=payload.whisper_provider, batch_id=payload.batch_id, + tv_station=payload.tv_station, current_step="V vrsti za obdelavo", # Počisti pretekle napake (retry-friendly) chorus_error=None, @@ -1592,7 +1596,7 @@ def _nextcloud_upload(local_path: str, remote_filename: str, target_subdir: str @app.post("/api/jobs/{job_id}/upload-nextcloud") async def upload_nextcloud(job_id: str, user: str = Depends(check_auth)): - """Naloži dokončan reel na Nextcloud /folxspeed/REELS/FOLX SLOVENIJA/.""" + """Naloži dokončan reel na Nextcloud /folxspeed/REELS/{TV STATION}/.""" if not _nextcloud_configured(): raise HTTPException(500, "Nextcloud ni konfiguriran (manjka env vars)") @@ -1613,13 +1617,17 @@ async def upload_nextcloud(job_id: str, user: str = Depends(check_auth)): # Lepo ime datoteke download_name = build_download_filename(job) - print(f"☁️ Uploading {output_path} → Nextcloud as {download_name}", flush=True) - success, result = _nextcloud_upload(output_path, download_name) + # TV postaja določa target mapo + tv_station = job.get("tv_station", "FOLX SLOVENIJA") + target_subdir = f"folxspeed/REELS/{tv_station}" + + print(f"☁️ Uploading {output_path} → Nextcloud /{target_subdir}/{download_name}", flush=True) + success, result = _nextcloud_upload(output_path, download_name, target_subdir=target_subdir) if success: update_job(job_id, nextcloud_status="uploaded", nextcloud_url=result, nextcloud_error=None) - print(f"☁️ Upload OK: {download_name}", flush=True) - return {"ok": True, "url": result, "filename": download_name} + print(f"☁️ Upload OK: /{target_subdir}/{download_name}", flush=True) + return {"ok": True, "url": result, "filename": download_name, "tv_station": tv_station} else: update_job(job_id, nextcloud_status="error", nextcloud_error=result) raise HTTPException(500, f"Upload failed: {result}") diff --git a/templates/index.html b/templates/index.html index 13b98f1..deb3b35 100644 --- a/templates/index.html +++ b/templates/index.html @@ -344,6 +344,17 @@ + + +