kinduff last edited by kinduff
I've been discovering how ES works for a few days, so far so good. What I'm trying to achieve is to have an entry in the systems list (main screen) where I can watch my favorite Twitch channels. This is for a Raspberry Pi 3 using Retropie.
I'm posting here to share my progress so anyone with more experience can help out.
Here's what I have so far:
- First of all, I installed streamlink, a python cli tool to play videos from different services, including Twitch, it has omxplayer support.
- I created a
/.emulationstationto override all the systems and be able to test faster.
<?xml version="1.0"?> <systemList> <system> <name>twitch</name> <fullname>Twitch.tv</fullname> <path>/home/pi/twitch</path> <extension>.twitch</extension> <command>/home/pi/runner.sh %ROM%</command> <platform>twitch</platform> <theme>twitch</theme> </system> </systemList>
- As you can see from the
es_systems.cfgfile, I'm calling
runner.shas the command.
#!/bin/bash twitchName=$(basename "$1" .twitch) twitchUrl="twitch.tv/$twitchName" streamlink $twitchUrl best --player "omxplayer --win '0 0 800 480'" --player-http # modify --win '0 0 width height' flag to fit your resolution
- Finally the "rom" saved in
/home/pi/twitch, which is just a file using the username of the Twitch channel using .twitch extension:
Here's a demo:(sorry for bad quality)
It works as expected, when you log into ES, I can see the Twitch system, the "rom" and when I click it, I'm able to stream a live Twitch channel.
- I can't exit if omxplayer is active with a controller (haven't tested with a keyboard tho).
- I could create the gamelist.xml file to add some metadata, but I'm skipping that since I assume it works.
- No way to hide (right now) "roms" that are not live. If they are not live, streamlink will try to stream and then exit.
How can this be improved? What's a better solution?
Thanks for reading.
kinduff last edited by
Found this https://raw.githubusercontent.com/popcornmix/omxplayer/master/dbuscontrol.sh to control the omxplayer through dbus.
Is there a way to bind some of these when running the command (clicking a rom)?
This is all very impressive, but why not just run the Twitch Addon through Kodi? You'd be able to browse all the channels, follow, unfollow, choose the quality of your video on the fly, etc. Don't get me wrong, I love tackling big homegrown tasks like your attempting myself sometimes, for no other reason than the challenge. I just want to make sure you know there's a ready-made alternative.
kinduff last edited by
@mediamogul I considered that option as I already have Kodi + Twitch installed in the Pi, but I want to tackle this problem from Emulation Statation. If I manage to get a stable version of this, plus the features I'm thinking, I'll be able to tackle other problems that are similar.
I gotta say, it's a very intriguing use of ES. I commend your efforts.