Files
obsidian-vault/family/how-to/tv-luna-send.md
T
2026-05-29 09:01:25 +00:00

50 lines
2.0 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# tv-luna-send.sh — враппер для luna-send на LG TV
Скрипт: `~/Automation/tv-luna-send.sh`
## Проблема
`luna-send` на WebOS через SSH **не выводит результат в stdout** без PTY.
- `ssh root@TV "luna-send -n 1 ..."` — молчит
- `ssh -t root@TV "luna-send -n 1 ..."` — тоже молчит
- `script -q -c "luna-send ..." /tmp/out.txt`**работает**
Причина: luna-send детектирует TTY и отказывается писать в pipe.
## Решение
`script(1)` аллоцирует псевдо-TTY и пишет вывод в файл. Враппер запускает luna-send через script, читает tmpfile (уникальный через $$), фильтрует мусор, удаляет файл.
## Использование
```bash
~/Automation/tv-luna-send.sh [luna-send flags] luna://service/method 'json'
```
Примеры:
```bash
# foreground app
~/Automation/tv-luna-send.sh -n 1 -f luna://com.webos.applicationManager/getForegroundAppInfo '{}'
# закрыть app
~/Automation/tv-luna-send.sh -n 1 -f luna://com.webos.service.applicationmanager/closeByAppId '{"id":"me.wouterdek.magic4pc"}'
# запустить app
~/Automation/tv-luna-send.sh -n 1 -f luna://com.webos.applicationManager/launch '{"id":"me.wouterdek.magic4pc"}'
# статус сервиса
~/Automation/tv-luna-send.sh -n 1 -f luna://me.wouterdek.magic4pc.service/query '{}'
```
Переменная `TV_HOST` переопределяет таргет (default: `root@LGwebOSTV`, alias `root@tv`, IP: `root@192.168.1.75`).
DNS резолвится через роутер (192.168.1.1), см. [[router-bishkek-asus]].
## Ограничение
`luna-send -i` (subscribe, бесконечный) не работает через враппер. Для install (`dev/install`) используется прямой ssh+script с polling в deploy.sh.
## Где используется
`~/Developer/magic4pc/webos/deploy.sh` — close, remove, launch.