Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement Request: Channel Change Button? #4

Open
HeroRyan opened this issue Oct 12, 2021 · 2 comments
Open

Enhancement Request: Channel Change Button? #4

HeroRyan opened this issue Oct 12, 2021 · 2 comments

Comments

@HeroRyan
Copy link

HeroRyan commented Oct 12, 2021

Any chance we can add in the ability to put a button which will skip the episode (channel change)?

@Freakadude
Copy link

Freakadude commented Oct 27, 2021

I have this implemented on my build via the use of SSH command from my phone. Basically i just trigger a process kill command that looks for a specific omxplayer running process (in my case there are always 2 running and the one that is playing the episodes uses additional command line --layer 10). Since there is a service running once the current process is killed it immediately starts up the process again but obviously due to the randomized nature of episodes a different episode is then played. This is basically my skip episode button.

I send command sudo pkill -e -f "omxplayer.bin --layer 10 *"

If you only have one instance of omxplayer running then this should probably be enough sudo pkill -e -f omxplayer.bin

If you would want to do this via an actual physical button i guess you could relatively easily pick out one of the unused GPIO pins and configure it in the RPI to run this exact command depending on its state (either low or high).

@Freakadude
Copy link

Freakadude commented Oct 29, 2021

Incidentally since in the topic subject you also mentioned Channel change button i have a solution for that as well. Since i had enough space on my SD card i placed all Futurama episodes in a seperate folder and wrote a very simple bash script that that renames the main python file that is responsible for running the episodes for a different one which is configured to run episodes from the Futurama folder. This again like the skip episode function i described above is triggered by an SSH command from my phone but again could probably easily be hooked up to a physical switch via one of the GPIO pins.

============================================================================

#!/bin/bash

#Check the original files exists or not
if [ -f /home/sysop/simpsonstv/player1.py ]; then
$(mv -i /home/sysop/simpsonstv/player.py /home/sysop/simpsonstv/playertmp.py)
fi

if [ -f /home/sysop/simpsonstv/playertmp.py ]; then
$(mv -i /home/sysop/simpsonstv/player1.py /home/sysop/simpsonstv/player.py)
fi

if [ -f /home/sysop/simpsonstv/player.py ]; then
$(mv -i /home/sysop/simpsonstv/playertmp.py /home/sysop/simpsonstv/player1.py)

sudo systemctl restart tvplayer.service
sleep 2s
fi

============================================================================

For this script to work you only need to create a second player.py file which has the folder configured where you store your other files that would be your second channel. In my above example player.py is the original file from buba which points to the folder where the simpsons episodes are located at and player1.py is configured for my Futurama folder.

After the script switches the order of the player.py files the player service is restarted and voila you "switched the channel" ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants