Skip to content

Commit

Permalink
v1.0.15
Browse files Browse the repository at this point in the history
stop playback after each file (#202)
Co-authored-by: Tobias Perschon <[email protected]>
  • Loading branch information
tofuSCHNITZEL committed Nov 17, 2023
1 parent 55cb6d8 commit d6d161d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Adafruit_Video_Looper/video_looper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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...")
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ For a detailed tutorial visit: <https://learn.adafruit.com/raspberry-pi-video-lo
There are also pre-compiled images available from <https://videolooper.de> (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)

Expand Down
4 changes: 4 additions & 0 deletions assets/video_looper.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit d6d161d

Please sign in to comment.