Last active
December 19, 2025 16:00
-
-
Save gaearon/9c4469fb8e4376bab32bd5bda942861b to your computer and use it in GitHub Desktop.
Unfuck Sony hotel TV picture mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Note: Connect to the TV's wifi network first | |
| MY_IP=$(ipconfig getifaddr en0) | |
| SUBNET=$(echo $MY_IP | cut -d. -f1-3) | |
| TV_IP="" | |
| echo "π Scanning $SUBNET.0/24 for Sony TV..." | |
| for ip in $(nmap -sn $SUBNET.0/24 -oG - 2>/dev/null | grep "Up" | awk '{print $2}'); do | |
| if [[ "$ip" != "$MY_IP" && "$ip" != "$SUBNET.1" && "$ip" != "$SUBNET.254" ]]; then | |
| RESPONSE=$(curl -s --connect-timeout 2 -X POST http://$ip/sony/system \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"method":"getSystemInformation","id":1,"params":[],"version":"1.0"}' 2>/dev/null) | |
| if echo "$RESPONSE" | grep -q "BRAVIA"; then | |
| TV_IP=$ip | |
| MODEL=$(echo "$RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['result'][0]['model'])" 2>/dev/null) | |
| echo "β Found $MODEL at $TV_IP" | |
| break | |
| fi | |
| fi | |
| done | |
| if [[ -z "$TV_IP" ]]; then | |
| echo "β No Sony TV found" | |
| exit 1 | |
| fi | |
| apply() { | |
| curl -s -X POST http://$TV_IP/sony/video \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"method\":\"setPictureQualitySettings\",\"id\":1,\"params\":[{\"settings\":$1}],\"version\":\"1.0\"}" > /dev/null | |
| } | |
| MODE=$(curl -s -X POST http://$TV_IP/sony/video \ | |
| -H "Content-Type: application/json" \ | |
| -d '{"method":"getPictureQualitySettings","id":1,"params":[{"target":"pictureMode"}],"version":"1.0"}') | |
| if echo "$MODE" | grep -q "dv"; then | |
| echo "π¬ Dolby Vision β applying dvDark + sharpness 20" | |
| apply '[{"value":"dvDark","target":"pictureMode"},{"value":"20","target":"sharpness"}]' | |
| else | |
| echo "π¬ Standard β applying IMAX + sharpness 20" | |
| apply '[{"value":"imax","target":"pictureMode"},{"value":"20","target":"sharpness"}]' | |
| fi | |
| echo "β Done. Enjoy." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment