From d6d161dd640f06f5dcee13dcacd3156570da6b8f Mon Sep 17 00:00:00 2001 From: Tobias Perschon Date: Fri, 17 Nov 2023 15:57:21 +0100 Subject: [PATCH] v1.0.15 stop playback after each file (#202) Co-authored-by: Tobias Perschon --- Adafruit_Video_Looper/video_looper.py | 7 +++++++ README.md | 3 +++ assets/video_looper.ini | 4 ++++ 3 files changed, 14 insertions(+) diff --git a/Adafruit_Video_Looper/video_looper.py b/Adafruit_Video_Looper/video_looper.py index 5467d9e..fd96ff5 100644 --- a/Adafruit_Video_Looper/video_looper.py +++ b/Adafruit_Video_Looper/video_looper.py @@ -57,6 +57,7 @@ def __init__(self, config_path): # Load other configuration values. self._osd = self._config.getboolean('video_looper', 'osd') self._is_random = self._config.getboolean('video_looper', 'is_random') + self._one_shot_playback = self._config.getboolean('video_looper', 'one_shot_playback') self._resume_playlist = self._config.getboolean('video_looper', 'resume_playlist') self._keyboard_control = self._config.getboolean('control', 'keyboard_control') self._copyloader = self._config.getboolean('copymode', 'copyloader') @@ -435,6 +436,7 @@ def _handle_keyboard_shortcuts(self): self._print("k was pressed. skipping...") self._playlist.seek(1) self._player.stop(3) + self._playbackStopped = False if event.key == pygame.K_s: if self._playbackStopped: self._print("s was pressed. starting...") @@ -454,6 +456,7 @@ def _handle_keyboard_shortcuts(self): self._print("b was pressed. jumping back...") self._playlist.seek(-1) self._player.stop(3) + self._playbackStopped = False def _handle_gpio_control(self, pin): if self._pinMap == None: @@ -462,6 +465,7 @@ def _handle_gpio_control(self, pin): self._print("pin {} triggered: {}".format(pin, action)) self._playlist.set_next(action) self._player.stop(3) + self._playbackStopped = False def _gpio_setup(self): if self._pinMap == None: @@ -511,6 +515,9 @@ def run(self): if self._playlist.length()==1: infotext = '(endless loop)' + if self._one_shot_playback: + self._playbackStopped = True + # Start playing the first available movie. self._print('Playing movie: {0} {1}'.format(movie, infotext)) # todo: maybe clear screen to black so that background (image/color) is not visible for videos with a resolution that is < screen resolution diff --git a/README.md b/README.md index c570357..063b5dd 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ For a detailed tutorial visit: (but they might not always contain the latest version of pi_video_looper) ## Changelog +#### new in v1.0.15 + - one shot playback: option to enable stopping playback after each file (usefull in combination with gpio triggers) + #### new in v1.0.14 - control the video looper via RPI GPIO pins (see section "control" below) diff --git a/assets/video_looper.ini b/assets/video_looper.ini index fc8f6d9..aa0cfcd 100644 --- a/assets/video_looper.ini +++ b/assets/video_looper.ini @@ -88,6 +88,10 @@ is_random = false resume_playlist = false #resume_playlist = true +# stop playback after each file +one_shot_playback = false +#one_shot_playback = true + # Set the background to a custom image # This image is displayed between movies or images # an image will be scaled to the display resolution and centered. Use i.e.