No description
  • Python 37.4%
  • CSS 26.9%
  • JavaScript 18.3%
  • HTML 16.1%
  • Dockerfile 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mr Lima db70d9960f feat: redesign dashboard and device player
- new responsive dark layout for dashboard and device pages
- render current track title, cover thumbnail, progress and seek
- show playlists, notes, tasks and downloads tabs
- expose friendly device name and add back link to dashboard
- accept UUID device_id with per-user ownership and cache downloads
- trim list payload for the dashboard and validate command args
2026-11-13 18:23:00 -03:00
relay feat: redesign dashboard and device player 2026-11-13 18:23:00 -03:00
web feat: redesign dashboard and device player 2026-11-13 18:23:00 -03:00
.dockerignore feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
.env.example feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
.gitignore feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
docker-compose.yml feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
Dockerfile feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
README.md feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
requirements.txt feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00
run.py feat: relay TCP (10141) + site Flask do hub MIDPlay 2026-11-13 14:20:19 -03:00

MIDPlay Web

Hub online para os aparelhos J2ME que rodam o MIDPlay. Um relay TCP recebe os devices na porta 10141 e um site Flask (porta 8080) permite controlar a música, ver playlists, notas e tarefas, e abrir faixas da web no navegador.

Arquitetura

MIDPlay (J2ME)  ──TCP/JSON newline──►  relay asyncio :10141  ──►  Hub (in-process)  ──►  Flask :8080

Um único container roda as duas coisas: o relay em uma thread asyncio e o Flask (waitress) em outra. A ponte é o relay.hub.Hub, que mantém as sessões ativas de device e resolve comandos pendentes com futures.

Protocolo (newline-delimited JSON)

Cada mensagem é uma linha JSON terminada em \n.

Primeira mensagem: auth

{"t":"auth","user":"alice","pass":"segredo","device":"nokia-e71","banner":{"app":"MIDPlay","ver":"26.11","model":"Nokia E71"}}

Resposta OK:

{"t":"auth_ok","device":"nokia-e71","user":"alice","heartbeat":45}

Resposta de erro: {"t":"auth_err","reason":"invalid credentials"} — o server fecha a conexão.

Do device para o relay

  • {"t":"state","state":{...}} — estado atual (playing, track, volume, position, duration).
  • {"t":"data","id":N,"what":"notes|tasks|playlists","data":[...]} — resposta a um want ou push.
  • {"t":"ack","id":N,"ok":true} — confirmação de comando.
  • {"t":"pong","ts":N} — resposta a ping.
  • {"t":"bye"} — encerra.

Do relay para o device

  • {"t":"cmd","id":N,"action":"play|pause|toggle|next|previous|seek|volume_up|volume_down|set_volume","args":{...}}
  • {"t":"want","id":N,"what":"playlists|notes|tasks"}
  • {"t":"ping","ts":N} a cada 45s.

Rodando

docker compose up --build

Defina SECRET_KEY no docker-compose.yml antes de expor.

Healthcheck

GET /healthz responde {"ok":true,"devices":N}. O Dockerfile já tem HEALTHCHECK apontando para ele.

Endpoints do site

  • POST /api/devices/<id>/command — {"action":"next"} etc.
  • GET /api/devices/<id>/data/playlists|notes|tasks[?refresh=1]
  • GET /api/proxy?url=... — stream da faixa para o navegador.