bendavid / aiopylgtv

Library to control webOS based LG Tv devices
MIT License
143 stars 47 forks source link

Add support for dictionary and list types in cmd line params #34

Open chros73 opened 2 years ago

chros73 commented 2 years ago

There's no need to write scripts just because of these anymore, command line examples (note the escaping of quotes):

aiopylgtvcommand 192.168.1.18 set_current_picture_settings "{\"backlight\": 0, \"contrast\": 65}"
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.softwareupdate "{\"mode\": \"user\", \"flagUpdate\": true}"
aiopylgtvcommand 192.168.1.18 get_picture_settings "[\"contrast\", \"backlight\"]"
# Launch In-Start Service Menu (code: 0413) (using JSON)
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin "{\"id\": \"executeFactory\", \"irKey\": \"inStart\"}"
# Launch Ez-Adjust Service Menu (code: 0413) (using JSON)
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin "{\"id\": \"executeFactory\", \"irKey\": \"ezAdjust\"}"

This can work in bash on Linux (but not in cmd on Windows):

aiopylgtvcommand 192.168.1.18 set_current_picture_settings '{"backlight": 0, "contrast": 65}'
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.softwareupdate '{"mode": "user", "flagUpdate": true}'
aiopylgtvcommand 192.168.1.18 get_picture_settings '["contrast", "backlight"]'
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin '{"id": "executeFactory", "irKey": "inStart"}'
aiopylgtvcommand 192.168.1.18 launch_app_with_params com.webos.app.factorywin '{"id": "executeFactory", "irKey": "ezAdjust"}'

Relates to: https://github.com/bendavid/aiopylgtv/issues/30#issuecomment-870477410

chros73 commented 2 years ago

I also figured it out (after decompiling a C8 and CX firmwares with epk2extract) how to launch In-Start and Ez-Adjust Service Menus, I added to the examples above.