Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion broadcast-ai/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ echo " [OK] Python packages installed"
python3 -c "import TTS; print(' [OK] TTS', TTS.__version__)" 2>/dev/null || echo " [!!] TTS import failed"
python3 -c "import torch; print(' [OK] PyTorch', torch.__version__)" 2>/dev/null || echo " [!!] PyTorch import failed"
python3 -c "import flask; print(' [OK] Flask', flask.__version__)" 2>/dev/null || echo " [!!] Flask import failed"
python3 -c "import feedparser; print(' [OK] feedparser')" 2>/dev/null || echo " [!!] feedparser import failed"
python3 -c "import atoma; print(' [OK] atoma')" 2>/dev/null || echo " [!!] atoma import failed"

# --- Directory structure -----------------------------------------------------
echo ""
Expand Down
39 changes: 31 additions & 8 deletions broadcast-ai/tv_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,36 @@ def podcasts_page():
el.innerHTML='<p class="status">لا توجد حلقات بعد. شغّل podcast_generator.py لإنشاء حلقات.</p>';
return;
}
let html='';
el.replaceChildren();
data.episodes.forEach((ep,i)=>{
html+=`<div style="margin-bottom:1rem;padding-bottom:1rem;border-bottom:1px solid #222">
<strong>حلقة ${i+1}</strong> — <span class="status">${ep.name}</span>
<audio controls style="width:100%;margin-top:0.5rem"><source src="/api/episode/${ep.name}" type="audio/wav"></audio>
</div>`;
const item=document.createElement('div');
item.style.marginBottom='1rem';
item.style.paddingBottom='1rem';
item.style.borderBottom='1px solid #222';

const title=document.createElement('strong');
title.textContent=`حلقة ${i+1}`;
item.appendChild(title);
item.appendChild(document.createTextNode(' — '));

const name=document.createElement('span');
name.className='status';
name.textContent=ep.name;
item.appendChild(name);

const audio=document.createElement('audio');
audio.controls=true;
audio.style.width='100%';
audio.style.marginTop='0.5rem';

const source=document.createElement('source');
source.src=`/api/episode/${encodeURIComponent(ep.name)}`;
source.type='audio/wav';
audio.appendChild(source);

item.appendChild(audio);
el.appendChild(item);
});
el.innerHTML=html;
}).catch(()=>{document.getElementById('episodes').innerHTML='<p class="status">خطأ في التحميل</p>';});
</script>
""")
Expand Down Expand Up @@ -410,8 +432,9 @@ def api_generate():
path = generate_voice(text, style=style, output_name=output_name)
duration = round(time.time() - t0, 1)
return jsonify({"path": path, "duration": duration, "style": style})
except Exception as exc:
return jsonify({"error": str(exc)}), 500
except Exception:
log.exception("Unhandled error during /api/generate request")
return jsonify({"error": "Internal server error"}), 500
Comment thread
digitalstore2025 marked this conversation as resolved.


# ---------------------------------------------------------------------------
Expand Down
Loading