From cf0fd4d0c583d781d2adc5f493b3537d2e828fec Mon Sep 17 00:00:00 2001 From: Tobias Perschon Date: Mon, 20 May 2024 23:30:40 +0200 Subject: [PATCH] v1.0.18 (#223) - fixed one-shot playback with only one video file - added option to not start video playback on looper startup (boot) --- Adafruit_Video_Looper/video_looper.py | 13 ++++++++++--- README.md | 4 ++++ assets/video_looper.ini | 5 +++++ setup.py | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Adafruit_Video_Looper/video_looper.py b/Adafruit_Video_Looper/video_looper.py index 9378fef..e9565e9 100644 --- a/Adafruit_Video_Looper/video_looper.py +++ b/Adafruit_Video_Looper/video_looper.py @@ -58,6 +58,7 @@ def __init__(self, config_path): 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._play_on_startup = self._config.getboolean('video_looper', 'play_on_startup') 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') @@ -105,7 +106,8 @@ def __init__(self, config_path): self._medium_font = pygame.font.Font(None, 96) self._big_font = pygame.font.Font(None, 250) self._running = True - self._playbackStopped = False + # set the inital playback state according to the startup setting. + self._playbackStopped = not self._play_on_startup #used for not waiting the first time self._firstStart = True @@ -527,13 +529,18 @@ def run(self): if self._playlist.length()==1: infotext = '(endless loop)' + #player loop setting: + player_loop = -1 if self._playlist.length()==1 else None + + #special one-shot playback condition if self._one_shot_playback: self._playbackStopped = True - + player_loop = None + # 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 - self._player.play(movie, loop=-1 if self._playlist.length()==1 else None, vol = self._sound_vol) + self._player.play(movie, loop=player_loop, vol = self._sound_vol) # Check for changes in the file search path (like USB drives added) # and rebuild the playlist. diff --git a/README.md b/README.md index 662031e..4439b3a 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ For a detailed tutorial visit: (but they might not always contain the latest version of pi_video_looper) ## Changelog +#### v1.0.18 + - fixed one-shot playback with only one video file + - added option to not start video playback on looper startup (boot) + #### new in v1.0.17 - GPIO pins can now be used to send "keyboard commands", i.e. to pause playback or shut down the system diff --git a/assets/video_looper.ini b/assets/video_looper.ini index 7d3181d..073e722 100644 --- a/assets/video_looper.ini +++ b/assets/video_looper.ini @@ -92,6 +92,11 @@ resume_playlist = false one_shot_playback = false #one_shot_playback = true +# play videos on startup +# it is usefull to disable this if you want to trigger videos only by e.g. gpio +play_on_startup = true +#play_on_startup = false + # 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. diff --git a/setup.py b/setup.py index d1024fc..c3eecf1 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name = 'Adafruit_Video_Looper', - version = '1.0.17', + version = '1.0.18', author = 'Tony DiCola', author_email = 'tdicola@adafruit.com', description = '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.',