From 1c11dfe630fe7897a54df7bae48c045b02700a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastjan=20Arti=C4=8D?= Date: Thu, 30 Apr 2026 14:38:45 +0000 Subject: [PATCH] TV station tabs + per-station Nextcloud upload target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User feedback: 'Sarah Connor in Abracadabra grejo v ONE DE, ne v FOLX SLO. Naredi zavihke za vsako TV postajo (FOLX SLO, FOLX DE, ONE DE, ZWEI MUSIC, ADRIA) in upload gre v ustrezno Nextcloud podmapo.' Backend changes: - StartJobIn + YouTubeJobIn: nov field 'tv_station' (default 'FOLX SLOVENIJA') - update_job: shrani tv_station v job JSON - POST /api/jobs/{id}/upload-nextcloud: bere tv_station iz job, target_subdir = folxspeed/REELS/{station} Frontend changes: - 5 TV station tabs: FOLX SLOVENIJA (active), FOLX DE, ONE DE, ZWEI MUSIC, ADRIA - Hidden input #tv-station-input drži current selection - Klik na tab ga aktivira (accent color) - collectSettings() vključuje tv_station Manual fix: Sarah Connor in Abracadabra job.json popravljena → tv_station=ONE DE Reset njihovih nextcloud_* polj da bo upload v pravo mapo. --- app/main.py | 18 +++++++++++++----- templates/index.html | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) 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 @@ + + +
+ + + + + +
+ +