File size: 3,066 Bytes
f7ee9c9
 
 
 
 
 
 
 
 
 
 
7ef9ff9
2441df1
77bd312
 
2441df1
f7ee9c9
 
 
 
7ef9ff9
 
f7ee9c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b1a072a
 
 
 
 
f7ee9c9
 
 
 
b1a072a
 
 
 
 
 
 
f7ee9c9
7ef9ff9
f7ee9c9
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
import re
import sys
import time
import subprocess
import threading

print("======================================================================")
print(" ⚙️ [1/3] Preparando servidor de alta velocidad (1.000 Mbps) en Google...")
print("======================================================================")

subprocess.run("pkill -f panel_app.py || true; pkill -f cloudflared || true", shell=True)
subprocess.run("(apt-get update -qq && apt-get install -y -qq unrar p7zip-full ffmpeg) > /dev/null 2>&1", shell=True)
subprocess.run([sys.executable, "-m", "pip", "install", "-q", "flask", "beautifulsoup4", "curl_cffi", "yt-dlp", "playwright"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
subprocess.run([sys.executable, "-m", "playwright", "install", "--with-deps", "chromium"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)
subprocess.run([sys.executable, "-m", "pip", "install", "-q", "-U", "--no-deps", "yt-dlp"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=False)

if not os.path.exists("/tmp/cloudflared"):
    subprocess.run("wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /tmp/cloudflared && chmod +x /tmp/cloudflared", shell=True)

print(" ⚙️ [2/3] Descargando motor actualizado (MediaFire + PelixPlay HD)...")
subprocess.run("curl -sL 'https://huggingface.co/datasets/visionhdstream/data-vision-01/resolve/main/_panel_app.py?t=" + str(int(time.time())) + "' -o /tmp/panel_app.py", shell=True)

proc_app = subprocess.Popen(
    [sys.executable, "/tmp/panel_app.py"],
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
    text=True
)

def _drain_app_logs():
    for line in proc_app.stdout:
        pass

threading.Thread(target=_drain_app_logs, daemon=True).start()
time.sleep(2)

print(" ⚙️ [3/3] Generando enlace web directo al Panel...")
proc_cf = subprocess.Popen(
    ["/tmp/cloudflared", "tunnel", "--url", "http://127.0.0.1:5050"],
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT,
    text=True
)

public_url = None
start_wait = time.time()
for line in proc_cf.stdout:
    if not public_url:
        m = re.search(r"https://[a-zA-Z0-9-]+\.trycloudflare\.com", line)
        if m:
            public_url = m.group(0)
    if public_url and ("Registered tunnel connection" in line or "Connection" in line):
        break
    if time.time() - start_wait > 25:
        break

def _drain_cf_logs():
    for line in proc_cf.stdout:
        pass

threading.Thread(target=_drain_cf_logs, daemon=True).start()
time.sleep(4)

print("\n" + "=" * 72)
print(" 🚀 ¡PANEL MEDIA SERVER PRO + PELIXPLAY HD ACTIVO EN GOOGLE CLOUD!")
print(" 👉 HACÉ CLIC EN ESTE LINK AZUL PARA ABRIR TU PANEL:")
print(f"\n      {public_url}\n")
print(" (Dejá esta pestaña de Google Colab abierta mientras uses el panel)")
print("=" * 72 + "\n")

try:
    while True:
        time.sleep(10)
except KeyboardInterrupt:
    print("Panel detenido.")