TV station tabs + per-station Nextcloud upload target

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.
This commit is contained in:
2026-04-30 14:38:45 +00:00
parent 8284181fb3
commit 1c11dfe630
2 changed files with 42 additions and 5 deletions
+13 -5
View File
@@ -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}")