final tuch

This commit is contained in:
2025-03-28 14:29:30 +02:00
parent 49eb7146b4
commit 73574bf510
4 changed files with 9139 additions and 9 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -9,6 +9,7 @@ from kivy.uix.video import Video # Import Video widget for video playback
from kivy.uix.image import Image # Import Image widget for displaying images
from kivy.logger import Logger # Import Logger for logging messages
from kivy.lang import Builder # Import Builder for loading KV files
from kivy.animation import Animation # Import Animation for fade effects
import os # Import os for file and directory operations
import json # Import json for handling JSON data
import datetime # Import datetime for timestamping logs
@@ -138,22 +139,48 @@ class MediaPlayer(Screen):
Logger.error(f"Unsupported media type for file: {file_name}")
def play_video(self, file_path):
"""Play a video file."""
"""Play a video file with a fade-in effect."""
Logger.info(f"Playing video: {file_path}")
self.video_player.source = file_path # Set the video source
self.video_player.opacity = 1 # Make the video player visible
if not os.path.exists(file_path):
Logger.error(f"Video file not found: {file_path}")
return
# Set the video source and start playback
self.video_player.source = file_path
self.video_player.state = 'play' # Start playing the video
self.video_player.opacity = 0 # Start with the video hidden
self.image_display.opacity = 0 # Hide the image display
Clock.schedule_once(self.next_media, self.video_player.duration) # Schedule the next media
# Wait for the video to start before applying the fade-in animation
def start_fade_in(*args):
fade_in = Animation(opacity=1, duration=1) # Fade in over 1 second
fade_in.start(self.video_player) # Start the fade-in animation
# Schedule the fade-in animation after a short delay
Clock.schedule_once(start_fade_in, 0.1)
# Schedule the next media after the video's duration
Clock.schedule_once(self.next_media, self.video_player.duration)
def show_image(self, file_path, duration):
"""Display an image."""
"""Display an image with a fade-in effect."""
Logger.info(f"Showing image: {file_path}")
self.image_display.source = file_path # Set the image source
self.image_display.opacity = 1 # Make the image display visible
self.image_display.reload() # Reload the image
if not os.path.exists(file_path):
Logger.error(f"Image file not found: {file_path}")
return
# Set the image source
self.image_display.source = file_path
self.image_display.opacity = 0 # Start with the image hidden
self.image_display.reload() # Reload the image to ensure it updates
self.video_player.opacity = 0 # Hide the video player
Clock.schedule_once(self.next_media, duration) # Schedule the next media
# Create a fade-in animation
fade_in = Animation(opacity=1, duration=1) # Fade in over 1 second
fade_in.start(self.image_display) # Start the fade-in animation
# Schedule the next media after the duration
Clock.schedule_once(self.next_media, duration)
def next_media(self, dt):
"""Move to the next media in the playlist."""

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 KiB