02-ago: [proyecto] vigilancia - YouTube en la tele: youtube <URL> reproduce video y apaga al terminar. Comando en el bot.

This commit is contained in:
minguezsanzjuanjose
2026-08-02 21:43:47 +02:00
parent 4584fdb4a6
commit e33d4c1369
3 changed files with 78 additions and 2 deletions

View File

@@ -9,12 +9,24 @@ import sys
sys.path.insert(0, sys_dir)
import config
from voz import anuncio_en_teles, anuncio_simple
from voz import anuncio_en_teles, anuncio_simple, youtube_en_teles
class Handler(BaseHTTPRequestHandler):
def do_GET(self):
q = parse_qs(urlparse(self.path).query)
path = urlparse(self.path).path
if path == "/tv/youtube":
url = (q.get("url") or [""])[0]
if not url:
self._resp(400, {"error": "falta parametro url"})
return
threading.Thread(target=youtube_en_teles, args=(url,), daemon=True).start()
print(f"[TV-API] YouTube lanzado: {url[:80]}")
self._resp(200, {"ok": True, "url": url, "modo": "youtube"})
return
texto = (q.get("texto") or q.get("msg") or [""])[0]
if not texto:
self._resp(400, {"error": "falta parametro texto"})