adafruit / pi_video_looper

Application to turn your Raspberry Pi into a dedicated looping video playback device, good for art installations, information displays, or just playing cat videos all day.
GNU General Public License v2.0
443 stars 240 forks source link

GPIO pins for Playback Control etc #191

Closed jonechkon closed 9 months ago

jonechkon commented 1 year ago

Hello, great stuff this is, thanks!

Just out of curiosity: Would it be possible to use the gpio pins to control the looper with buttons/potis etc.? :D

Greetings, Jochen

shell3000 commented 1 year ago

As long as videolooper supports Keyboards in general, which is great, you can customize HID-Devices to control videolooper. Works fine. Attached the pico keypad from pimoroni.

IMG_1368

jonechkon commented 1 year ago

Why easy when it can be done complicated... No, thats true, thanks :)

But after trying it: How would i get the omxplayers keyboard controls working? (especially the speed up/down and seek)

jonechkon commented 1 year ago

No one? :/

jonechkon commented 1 year ago

I now have tried to edit the video_looper.py, adding keybindings. So far i had been using the precompiled images from https://videolooper.de/ which worked well. Now after "manual" setup i first need to log into the raspi OS before the looper starts and the keyboard does not respond to neither the original, nor my added keybindings (keyboard_control = true is set in the .ini) Could that be something i have to setup in the pi OS or would it be because of my wack python editing? There probably is no way to change the video_looper.py after it was installed, right?

I would be very happy to not go through the procedure of crouching under my desk rerouting the lan cable more times than necessary...^^'

christiansievers commented 1 year ago

Hmm. Not sure which version of the looper script you need, but be aware that currently the prepackaged image is lagging behind the script on GitHub. If you need the latest version, just update it with git. Am 07.07.2023 um 15:54 schrieb jonechkon @.***>: I now have tried to edit the video_looper.py, adding keybindings. So far i had been using the precompiled images from https://videolooper.de/ which worked well. Now after "manual" setup i first need to log into the raspi OS before the looper starts and the keyboard does not respond to neither the original, nor my added keybindings (keyboard_control = true is set in the .ini) Could that be something i have to setup in the pi OS or would it be because of my wack python editing?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

jonechkon commented 1 year ago

Heyyy, Thanks for your answer :) I dont know, are there differences in the versions concerning Keyboard commands?

By now i am sure that running the install.sh with additional if event.key == pygame.K_8: self._player.set_rate(1.5)

... (for example) in the video_looper.py doesnt change anything. But keyboard input seems to have to be enabled in the OS somehow (how?) anyway, since the standard key settings (p,k,s,ESC...) dont seem to work anyhow after "manual" install.

And on existing systems changing the python files on the sd card does nothing (for me at least)....

Gruß :D

tofuSCHNITZEL commented 1 year ago

hey, you dont need to run the full install.sh when changing the code python3 setup.py install --force in the pi_video_looper dir is sufficient. check out the https://github.com/adafruit/pi_video_looper/tree/next branch because it contains the code that send keyboard commands directly to omxplayer

jonechkon commented 1 year ago

Great! Thanks. I updated the pi and installed the next branch now. Now the problem is that the videolooper wont start atomatically or after supervisorctl start video_looper although it states "started".

tofuSCHNITZEL commented 1 year ago

Maybe you did not run install after cloning next and the video_looper.ini is missing settings? What does the log output say?

jonechkon commented 1 year ago

yep, seems so... how could i... I also figured out that the videolooper not responding to any keyboard input does have been because of my additions to the video_looper.py and the problem only starts after having pressed one of these newly mapped buttons.

Is there anything obviously wrong with this?

           if event.key == pygame.K_b:
                self._print("b was pressed. jumping back...")
                self._playlist.seek(-1)
                self._player.stop(3)
                #speed&playpos
            if event.key == pygame.K_6:
                self._player.set_rate(0.062)
            if event.key == pygame.K_1:
                self._player.set_rate(0.125)
            if event.key == pygame.K_2:
                self._player.set_rate(0.25)
            if event.key == pygame.K_3:
                self._player.set_rate(0.5)
            if event.key == pygame.K_4:
                self._player.set_rate(0.66)
            if event.key == pygame.K_5:
                self._player.set_rate(0.75)
            if event.key == pygame.K_7:
                self._player.set_rate(1.3)
            if event.key == pygame.K_8:
                self._player.set_rate(1.5)
            if event.key == pygame.K_9:
                self._player.set_rate(2)
            if event.key == pygame.K_0:
                self._player.set_rate(3)
            if event.key == pygame.K_MINUS:
                self.player.set_rate(4)
            if event._key == pygame.K_PLUS:
                self._player.set_rate(6)
            pstmod = 1
            if pygame.key.get_mods() & pygame.KMOD_SHIFT:
                pstmod = 10
            else:
                pstmod = 1
            if event.key == pygame.K_KP1:
                pst = self._player.position()
                self._player.seek(pst + 1 * pstmod)
            if event.key == pygame.K_KP2:
                pst = self._player.position()
                self._player.seek(pst + 1 * pstmod)
    ......

<

tofuSCHNITZEL commented 9 months ago

GPIO control is now available in https://github.com/adafruit/pi_video_looper/releases/tag/v1.0.14