Kaynağa Gözat

Merge remote-tracking branch 'origin/pr/16'

v1.0.1
pull/20/merge
Tobias Perschon 5 yıl önce
ebeveyn
işleme
149dd10d3d
3 değiştirilmiş dosya ile 24 ekleme ve 2 silme
  1. +17
    -1
      Adafruit_Video_Looper/video_looper.py
  2. +1
    -1
      setup.py
  3. +6
    -0
      video_looper.ini

+ 17
- 1
Adafruit_Video_Looper/video_looper.py Dosyayı Görüntüle

@@ -72,8 +72,9 @@ class VideoLooper:
pygame.display.init()
pygame.font.init()
pygame.mouse.set_visible(False)
size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
size = self._size = (pygame.display.Info().current_w, pygame.display.Info().current_h)
self._screen = pygame.display.set_mode(size, pygame.FULLSCREEN)
self._bgimage = self._load_bgimage()
self._blank_screen()
# Set other static internal state.
self._extensions = self._player.supported_extensions()
@@ -98,6 +99,18 @@ class VideoLooper:
return importlib.import_module('.' + module, 'Adafruit_Video_Looper') \
.create_file_reader(self._config)

def _load_bgimage(self):
"""Load the configured background image and return an instance of it."""
image = None
if self._config.has_option('video_looper', 'bgimage'):
imagepath = self._config.get('video_looper', 'bgimage')
if imagepath != "" and os.path.isfile(imagepath):
self._print('Using ' + str(imagepath) + ' as a background')
image = pygame.image.load(imagepath)
image = pygame.transform.scale(image, self._size)
return image

def _is_number(iself, s):
try:
float(s)
@@ -138,6 +151,9 @@ class VideoLooper:
def _blank_screen(self):
"""Render a blank screen filled with the background color."""
self._screen.fill(self._bgcolor)
if self._bgimage is not None:
rect = self._bgimage.get_rect()
self._screen.blit(self._bgimage, rect)
pygame.display.update()

def _render_text(self, message, font=None):


+ 1
- 1
setup.py Dosyayı Görüntüle

@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name = 'Adafruit_Video_Looper',
version = '1.0.0',
version = '1.0.1',
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.',


+ 6
- 0
video_looper.ini Dosyayı Görüntüle

@@ -41,6 +41,12 @@ is_random = false
keyboard_control = false
#keyboard_control = true

# Set the background to a custom image
# This image is displayed between movies
# Can potentially look broken if video resolution is smaller than display resolution
# bgimage = /home/pi/static/bg.png
bgimage =

# Change the color of the background that is displayed behind movies (only works
# with omxplayer). Provide 3 numeric values from 0 to 255 separated by a commma
# for the red, green, and blue color value. Default is 0, 0, 0 or black.


Yükleniyor…
İptal
Kaydet