Converting an old Lenovo ThinkCentre into a user friendly dedicated streaming device.
Introduction
Our regular TV provider stopped transmitting Eurosport in 2020. Since I wanted to follow MotoGP I had to resort to other sources. Long story short: I stopped our TV subscription and got a bare internet connection. I subscribed to a couple of streaming services, which meant we would be able to watch pretty much everything we were used to, and still save money in the process. Now it would be nice if we could find a single device that could serve all services we subscribed to.
Hardware
I considered using a Raspberry PI, but that had issues streaming Netflix. Then I managed to get my hands on an old ThinkStation PC, including the DVD player. Tiny form factor, silent and able to serve all streaming services from a regular web browser. Only an i3, but should be plenty powerful enough, ideal for my new project!
Unfortunately, the ThinkStation lacked an HDMI port, but using a simple DisplayPort to HDMI adapter sorted that out. That did sometimes cause a small problem though. After starting up, the sound would sometimes not properly synchronize with the TV. Switching the TV off and on again1 fixed that, so probably an HDMI issue caused by the old TV or the DisplayPort to HDMI conversion. A minor inconvenience but I never found the cause.
Operating system
I installed Linux Mint on the ThinkStation. This was the OS I used on my laptop at the time. I considered a couple of other options, including Kodi, but most of them introduced new complexity and too many unknown factors, so I decided to stick to what I knew. Using Mint, I could use a browser to stream anything with browser support. I configured Mint to update automatically, so we would not be bothered with “Please update now” messages while watching TV.
Remote control
TV should be enjoyed from the couch, so we should be able to operate the ThinkCentre from the couch. I did not want to use a bulky keyboard or a clumsy mouse while watching TV. So I bought a relatively cheap airmouse. This is a “Wechip W1”, this control is also sold unbranded and under a couple of other names.
It has mouse control buttons on the front, a keyboard on the back, infrared to control the TV and a USB dongle to connect to the PC. This is a so called “airmouse”, so tilt the control back to move the mouse pointer up, rotate to the left to move the pointer left, etc.
Switching on
I would like to be able to switch the ThinkStation on from the couch, together with the TV. The TV can be switched on using the new remote, it has infrared. To remotely power on the ThinkStation I wanted to use its Wake on Lan function. Setup would be to connect the TV to the home network, and have one of the Raspberry Pi’s in the house constantly check for the IP of the TV. Then make the Pi send a WOL to the ThinkStation as soon as the TV is switched on. Unfortunately, I never got the WOL function on the ThinkStation working, so we had to stand up to switch on the ThinkStation.
Switching off
Switching off is easier and can be done from the ThinkStation.
I wrote a little shell script to power down the ThinkStation when the TV goes offline. This also requires a graceful shutdown of Firefox. If you bluntly pull the plug on the Firefox application, it would start with an error message the next time.
I wrote the following script and created an entry for it in the Linux Mint application named “Startup Applications”:
#!/bin/bash
IPTV=192.168.1.111
# Wait for the TV before starting the main loop
while true
do
ping -c1 -W 5 $IPTV >/dev/null 2>&1
PINGEXITCODE=$?
if [[ $PINGEXITCODE == 0 ]]
then
break
fi
sleep 1
done
FAILEDPINGS=0
# TV is online, now ping every 4 seconds. If the TV is offline long enough, perform a shutdown
while true
do
ping -c1 -W 1 $IPTV >/dev/null 2>&1
PINGEXITCODE=$?
if [[ $PINGEXITCODE == 0 ]]
then
FAILEDPINGS=0
else
FAILEDPINGS=$(($FAILEDPINGS + 1))
if [[ $FAILEDPINGS == 9 ]]
then
break
fi
fi
sleep 4
done
# TV is now offline, close Firefox gracefully and perform a shutdown
EXITCODE=0
while [[ $EXITCODE == 0 ]]
do
wmctrl -c "Mozilla Firefox"
EXITCODE=$?
sleep 1
done
shutdown -h now
Volume control
Unfortunately, the volume buttons on the remote control do send an infrared signal. Instead, they act as multimedia controls on the PC. Controlling the volume on the PC is not accurate enough though. So I have to relay the commands from the PC to the TV. Fortunately, the Samsung TV can be controlled over IP. I installed the samsungctl project for this. Now I can use python3 -m samsungctl --host 192.168.1.111 key
with KEY_VOLUP
to increase the volume and KEY_VOLDOWN
to decrease the volume.
Binding a key to a command is easy in the Cinnamon Desktop, just open the keyboard preferences, create shortcuts with the correct commands and bind them to the media control buttons:
Screen tearing
Screen tearing happens when a device sends frames to the display at a faster rate than the display refreshes. What is visible is that sometimes half of one frame is shown at the top of the screen, and half of the next frame at the bottom. In fast moving scenes this can be very annoying.
The ThinkStation suffered some screen tearing. To fix this, a parameter for the Intel graphics driver needs to beset. To find the name of the driver, enter inxi -G
, which produces:
Graphics: Device-1: Intel 4th Generation Core Processor Family Integrated Graphics driver: i915 v: kernel
Display: server: X.org 1.19.6 driver: intel tty: 168x43
Message: Advanced graphics data unavailable in console. Try -G --display
So, in my case the driver name is “intel”. Now I create the following file to enable the option:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
After a reboot, screen tearing is fixed!
Netflix HD
Netflix does not stream in full HD (1080p) in Firefox, for no apparent reason. I initially installed a plugin to make that possible, which functioned fine most of the time. The plugin caused problems from time to time and we eventually decided that we could not see the difference (which was true), and stuck to the lower resolution.
Portal
To make the selection of channels and websites easier, I created a bookmark page with large icons for every website we use. First, I add Firefox to the “Startup Applications” in Mint.
Next, I create a start page for Firefox. For this, I used the static site generator Hugo with the theme Slate. Enter every site into the data/links.yml file, e.g.:
titles:
-
name: "F1 TV"
url: "https://f1tv.formula1.com/en/current-season"
img: "logos/f1tv.svg"
bg_color: "#eeeeee"
txt_color: "#cd201f"
tags: ["video", "favorite"]
-
name: "YouTube"
url: "https://youtube.com"
img: "logos/youtube.svg"
bg_color: "#cccccc"
txt_color: "#cd201f"
tags: ["video", "favorite"]
Now create a new entry in the Linux Mint application “Startup Applications” to start hugo -server
. This makes the page available on localhost:1313
:
Conclusion
The ThinkStation was converted into a comfortable and user friendly streaming device. We used this setup for over 2 years without problems. Mint would update unnoticed during shutdown when necessary and remained rock stable. Then the MotoGP broadcasting rights moved from Eurosport to Ziggo (Dutch internet en TV provider) in 2022, so we moved with it. The ThinkCentre is mostly idle, but still incidently used for streaming presentations in Teams or Zoom.
We discovered this by accident. We used to reboot the PC, to fix the issue. At one point my wife accidentally switched TV off and on again, instead of the PC. To our surprise, that fixed the problem as well! ↩︎