Spaces:
Paused
Paused
AndrianBalanescu commited on
Commit ·
6e3c35f
1
Parent(s): e8bddb0
fix(cron): cap Albina album at 6 tracks (subset rotatie)
Browse files_build_album_tracks('ALBINA_BONDAR') intoarnea toate cele 24 de concepte
din catalog -> album planificat ~4h care arde toata cota ZeroGPU zilnica
(observat live: 9 piese pana la epuizare). Acum foloseste
build_albina_tracks(count=6): subset rotit, fara repetare.
Test de regresie adaugat (cap + fara duplicate).
moldovan-qwen/scripts/daily_album_cron.py
CHANGED
|
@@ -43,6 +43,7 @@ from typing import Any, Dict, List, Optional
|
|
| 43 |
from engine.albina_bondar import (
|
| 44 |
ALBINA_GENRE_DISTRIBUTION,
|
| 45 |
ALBINA_BONDAR_TRACKS,
|
|
|
|
| 46 |
pick_albina_weighted_genre,
|
| 47 |
)
|
| 48 |
|
|
@@ -115,9 +116,9 @@ RANDOM_TRACKS = [
|
|
| 115 |
def _build_album_tracks(genre_key: str) -> List[Dict[str, Any]]:
|
| 116 |
"""Select tracks for the given genre key (shuffled so albums vary)."""
|
| 117 |
if genre_key == "ALBINA_BONDAR":
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
return
|
| 121 |
elif genre_key == "MOLDOVAN_QWEN":
|
| 122 |
pool = [dict(t) for t in MOLDOVAN_QWEN_TRACKS]
|
| 123 |
random.shuffle(pool)
|
|
|
|
| 43 |
from engine.albina_bondar import (
|
| 44 |
ALBINA_GENRE_DISTRIBUTION,
|
| 45 |
ALBINA_BONDAR_TRACKS,
|
| 46 |
+
build_albina_tracks,
|
| 47 |
pick_albina_weighted_genre,
|
| 48 |
)
|
| 49 |
|
|
|
|
| 116 |
def _build_album_tracks(genre_key: str) -> List[Dict[str, Any]]:
|
| 117 |
"""Select tracks for the given genre key (shuffled so albums vary)."""
|
| 118 |
if genre_key == "ALBINA_BONDAR":
|
| 119 |
+
# Catalogul are 24 concepte; un album Albina ia un subset rotit de 6
|
| 120 |
+
# (fara repetare) ca sa incapa in fereastra de cota ZeroGPU zilnica.
|
| 121 |
+
return build_albina_tracks(count=6)
|
| 122 |
elif genre_key == "MOLDOVAN_QWEN":
|
| 123 |
pool = [dict(t) for t in MOLDOVAN_QWEN_TRACKS]
|
| 124 |
random.shuffle(pool)
|
tests/unit/test_daily_album_cron.py
CHANGED
|
@@ -173,3 +173,15 @@ def test_audio_segment_chaining_duration(tmp_path):
|
|
| 173 |
assert duration_sec >= 115.0, f"Expected chained duration >= 115s, got {duration_sec}s"
|
| 174 |
assert out_mp3.exists()
|
| 175 |
assert out_mp3.stat().st_size > 500000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
assert duration_sec >= 115.0, f"Expected chained duration >= 115s, got {duration_sec}s"
|
| 174 |
assert out_mp3.exists()
|
| 175 |
assert out_mp3.stat().st_size > 500000
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
def test_albina_album_tracks_capped_at_six():
|
| 179 |
+
"""Regression: _build_album_tracks('ALBINA_BONDAR') intoarnea toate 24
|
| 180 |
+
de concepte -> album de ~4h care ardea toata cota ZeroGPU. Un album
|
| 181 |
+
Albina trebuie sa ia un subset rotit de 6, fara repetare."""
|
| 182 |
+
from daily_album_cron import _build_album_tracks
|
| 183 |
+
|
| 184 |
+
tracks = _build_album_tracks("ALBINA_BONDAR")
|
| 185 |
+
assert len(tracks) == 6, f"expected 6 tracks, got {len(tracks)}"
|
| 186 |
+
titles = [t["title"] for t in tracks]
|
| 187 |
+
assert len(set(titles)) == len(titles), "no repeats inside one album"
|