final app
This commit is contained in:
3360
src/Resurse/log.txt
3360
src/Resurse/log.txt
File diff suppressed because it is too large
Load Diff
@@ -50,12 +50,12 @@
|
||||
size_hint: None, None
|
||||
size: 75, 75
|
||||
pos_hint: {'right': 0.88, 'bottom': 0.98}
|
||||
background_normal: './Resurse/play.png'
|
||||
background_down: './Resurse/pause.png'
|
||||
background_color: 1, 1, 1, 0.9 # Temporary blue background for debugging
|
||||
border: [0, 0, 0, 0] # Remove the default border
|
||||
background_normal: './Resurse/play.png' # Initial state
|
||||
background_down: './Resurse/play.png' # Initial state
|
||||
background_color: 1, 1, 1, 0.9 # White with 90% transparency
|
||||
border: [0, 0, 0, 0]
|
||||
opacity: 1
|
||||
on_press: root.toggle_play_pause()
|
||||
on_press: root.manage_play_pause_state() # Call the new function
|
||||
|
||||
# Left Arrow button
|
||||
Button:
|
||||
|
||||
@@ -34,6 +34,8 @@ class MediaPlayer(Screen):
|
||||
self.image_display = self.ids.image_display # Reference to the Image widget
|
||||
self.log_file = os.path.join(os.path.dirname(__file__), 'Resurse', 'log.txt') # Path to the log file
|
||||
self.is_paused = False # Track the state of the play/pause button
|
||||
self.reset_timer = None # Timer to reset the button state after 3 minutes
|
||||
self.image_timer = None # Timer for scheduling the next media for images
|
||||
|
||||
# Schedule periodic updates to check for playlist updates
|
||||
Clock.schedule_interval(self.check_playlist_updates, 300) # Every 5 minutes
|
||||
@@ -192,7 +194,7 @@ class MediaPlayer(Screen):
|
||||
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)
|
||||
self.image_timer = Clock.schedule_once(self.next_media, duration)
|
||||
|
||||
def next_media(self, dt=None):
|
||||
"""Move to the next media in the playlist."""
|
||||
@@ -208,20 +210,59 @@ class MediaPlayer(Screen):
|
||||
|
||||
def toggle_play_pause(self):
|
||||
"""Toggle the play/pause button state and update its appearance."""
|
||||
self.manage_play_pause_state()
|
||||
|
||||
def manage_play_pause_state(self):
|
||||
"""Manage the state of the play/pause button and media playback."""
|
||||
if self.is_paused:
|
||||
Logger.info("Resuming media playback.")
|
||||
self.video_player.state = 'play'
|
||||
|
||||
# Resume the image timer if it exists
|
||||
if self.image_timer:
|
||||
Logger.info("Resuming image timer.")
|
||||
self.image_timer()
|
||||
|
||||
# Update the button to indicate the playing state
|
||||
self.ids.play_pause_button.background_down = './Resurse/play.png'
|
||||
self.ids.play_pause_button.background_normal = './Resurse/play.png'
|
||||
|
||||
# Cancel the reset timer if it exists
|
||||
if self.reset_timer:
|
||||
Clock.unschedule(self.reset_timer)
|
||||
else:
|
||||
Logger.info("Pausing media playback.")
|
||||
self.video_player.state = 'pause'
|
||||
|
||||
# Pause the image timer if it exists
|
||||
if self.image_timer:
|
||||
Logger.info("Pausing image timer.")
|
||||
Clock.unschedule(self.image_timer)
|
||||
|
||||
# Update the button to indicate the paused state
|
||||
self.ids.play_pause_button.background_down = './Resurse/pause.png'
|
||||
self.ids.play_pause_button.background_normal = './Resurse/pause.png'
|
||||
|
||||
# Start a timer to reset the button state after 3 minutes
|
||||
self.reset_timer = Clock.schedule_once(self.reset_play_pause_state, 180)
|
||||
|
||||
# Toggle the state
|
||||
self.is_paused = not self.is_paused
|
||||
|
||||
def reset_play_pause_state(self, dt):
|
||||
"""Reset the play/pause button state to 'play' after 3 minutes."""
|
||||
Logger.info("Resetting play/pause button state to 'play' after timeout.")
|
||||
self.is_paused = False
|
||||
self.video_player.state = 'play'
|
||||
|
||||
# Resume the image timer if it exists
|
||||
if self.image_timer:
|
||||
Logger.info("Resuming image timer.")
|
||||
self.image_timer()
|
||||
|
||||
self.ids.play_pause_button.background_down = './Resurse/play.png'
|
||||
self.ids.play_pause_button.background_normal = './Resurse/play.png'
|
||||
|
||||
def check_playlist_updates(self, dt):
|
||||
"""Check for updates to the playlist."""
|
||||
new_playlist = load_playlist() # Load the new playlist
|
||||
|
||||
BIN
src/static/resurse/VID_20250322_121033.mp4
Normal file
BIN
src/static/resurse/VID_20250322_121033.mp4
Normal file
Binary file not shown.
Reference in New Issue
Block a user