My main goals:
- I should not have to get out of bed in the morning to turn it on.
- I need to be able to control volume and channel remotely.
- I should never have to use a mouse or keyboard to control it.
- It needs to work consistently and reliably. If I have to get out of my warm bed in the morning I'll be very cranky!
- It should start up quickly, like a regular Smart TV.
- It needs to automatically display public TV network streams (German in my case).
- Network segregation for security reasons.
- Audio streaming to my phone in case I watch movies late at night. Don't want to disturb the neighbors!
- Bring me coffee and breakfast in bed. Anyone got any ideas?
In order to achieve the goal of booting up quickly I put a small 128 GB SSD in it. You could get away with a much smaller one, but this is what I had on hand. I decided against using any disk encryption as that would require my lazy butt to get out of bed in the morning to type the password in and would kind of make it less TV-like. I will not be keeping any sensitive information on my TV SSD anyway.
Aside from that, Solus is fast enough by default that I didn't even bother trying to trim it down. The only changes I decided to make was to turn off POST in the BIOS and to make the following changes to /etc/defaults/grub:
I commented out GRUB_BACKGROUND in order to save Grub from having to render that and added the following lines:
Code: Select all
GRUB_DEFAULT=0 GRUB_TIMEOUT=0 GRUB_GFXMODE=640x480
With these changes Grub flashes by in a split second and the "TV" is on in 7 seconds flat. This is on par with what I have seen with modern Smart TVs, not bad for running a full-blown Linux OS in the background! (Don't forget to run update-grub after making the changes if you follow along at home.)
Hands-free, keyboardless and mouseless.
This step is by far the most complicated, and even so it's quite easy. First I decided that I would let VLC be responsible for playing back video, so I installed that using sudo eopkg it vlc. The biggest reason I went with VLC is that I am very familiar with it and I also happen to know that there is a number of free remote controls for Android around for it. Another reason is that setting VLC to start up with a playlist and in fullscreen is very easy.
I decided to write a script for everything the "TV" needs to do at startup, that way I can easily disable the entire system if I don't want it to start up with the computer anymore. It would also allow me to re-run the script if I need to restart the TV-functionality. So I went ahead and created
Code: Select all
sudo touch /usr/bin/solus_tv sudo chown tv:tv /usr/bin/solus_tv chmod +x /usr/bin/solus_tv
Next I needed to actually write some code, and here's the code I put into it. I decided to make it so I can restart the "VLC TV" by executing the script again through SSH, just in case something goes awry, without restarting the entire computer. After all, streams and connections can be unreliable. I use the Termius client on my phone for SSH access and I installed sudo eopkg it openssh-server and configured it to only accept my phone's IP (I have given all my network devices static IPs). I'm not going to go into details on configuring it here, it would make this topic way too long, you can look up how to secure SSH servers on Google if you want to do this.
Here's the tv.m3u file in case anyone from Germany wants it. This contains all public TV network streams. Most of these will not work outside of Germany unless you access them through a VPN, although some (3 or 4, maybe) do. I added this as a startup command under Budgie Desktop Settings => Autostart.
Doing The Unthinkable (disabling password requests)
Because I don't want to type a password just to watch some TV, I needed to disable the password prompt on startup. This is typically not a great idea, but as a lazy person who just wants her morning cartoons without typing passwords, this just needed to be done. I opened the Settings app and went to Details => Users and unlocked (in the top right corner) the Automatic Login option and set that. I also used dconf-editor and disabled the lock screen under /org/gnome/desktop/lockdown, because I don't want to be locked out if the TV ends up getting suspended. I did make sure screensavers and power management wouldn't cause it to go to sleep, but you never know.
That's it, the TV now starts up and starts playing 3sat right away. Great! Except I don't like 3sat that much, I want to watch KiKA or Nick! I did actually set KiKA to be first on my playlist, but I let 3sat be first on the playlist I uploaded because I assume most people don't want to start their TV with cartoons. I still want to be able to change channels though, so it's time to set up a:
I decided to use the app VLC Remote Free by Hobbyist Software Ltd. It's very easy to use and allows me to see the channels (AKA playlist) on the main screen, it also lets me set the volume by using the hard keys on my phone. I'm very happy with it!
This of course required me to allow VLC to be controlled remotely as well. This is how to set that up:
- Open VLC.
- Go to Tools => Preferences (or hit Ctrl+P)
- In the bottom left corner, set it to show All settings instead of Simple.
- Browse to Main Interfaces and check the "Web" checkbox.
- Expand Main Interfaces and click Lua, set any password you like.
In the remote control app, add the IP and give it the password and you're set. Now I can watch my cartoons from bed! Or can I...?
Turn it Off and On Again
I need to be able to turn it on remotely. This was simple enough, I decided to use Wake-On-LAN. There's a great free app for that as well, by Mike Webb, called simply Wake On Lan. All I had to do was enable it in the BIOS and I was set. It works beautifully and even resumes the TV from a suspended state. I ended up deciding against suspending the TV box because it brought about complications with VLC and because starts up so quickly from being shut down, but it's good to have anyway.
I ended up also installing Unified Remote by Unified Intents instead to make it easier for me to shut down the TV as well without having to type out commands in Termius. You need to run their server on your box for it to work, so I added that to the script.
The script now looks like this. That's it. This now works like a regular TV, with bonus smart TV features if I want thanks to Unified Remote's features.
Because I have completely disabled all password-related security on my TV box and because I might not update it quite as often as I do my regular computers, I didn't want to give it free access to my entire network. I also didn't want it to have free access to the entire internet in case it gets rooted and someone tries to make it be part of a botnet or something. This part I won't go into details on, because it would make for a huge topic, but I put it on its own VLAN and gave my phone access and a static IP on that as well. I then created strict rules on my external firewall for it to only allow it access to DNS and the TV networks.
Bye bye, most Smart TV features, but it lets me sleep better at night.
Audio Streaming to Android
PulseAudio is very networking friendly (that isn't really a word I use often with PA) and there's a free Android app called Simple Protocol Player by kaytat which will play back the streams. All I had to do was load the simple protocol module and I was set. If you want to do this, here's the script to use.
However, it turned out to not work so well over WiFi and there was audio drifting, so I ended up using SoundWire by GeorgieLabs and it works perfectly. It will tell you once an hour that it's not the full version, but that's it. I actually ended up buying it because it was so good and I don't want the lady to yell at me about it being a free version if I fall asleep watching TV.
This is the final script I ended up with, in the unlikely event that someone wants to do all this exactly the same way I did.
I hope someone finds this useful and I really hope I didn't forget to describe any steps I took along the way. Feel free to ask questions if you're trying this and something isn't working. Suggestions for improvements are very welcome as well!