Perf: Optimize playback and simplify playlist management
- Performance improvements: * Throttle drawing updates to 60fps (16ms intervals) * Optimize file I/O: use single os.stat() instead of exists+getsize * Reduce logger overhead: convert hot-path info logs to debug * Preload next media asynchronously for smoother transitions * Smart cache invalidation for edited images - Simplify playlist management: * Remove versioning: single server_playlist.json file * Create nested directories for edited_media downloads * Recursively delete unused media and empty folders * Cleaner version tracking without file proliferation - UI improvements: * Smoother intro-to-playlist transition * Fix edited media directory creation for nested paths
This commit is contained in:
+7
-3
@@ -30,6 +30,8 @@ class DrawingLayer(Widget):
|
||||
self.current_width = 3 # Default thickness
|
||||
self.drawing_enabled = True # Drawing always enabled in edit mode
|
||||
self.reset_callback = reset_callback # Callback to reset countdown timer
|
||||
self._last_draw_time = 0 # For throttling touch updates
|
||||
self._draw_throttle_interval = 0.016 # ~60fps (16ms between updates)
|
||||
|
||||
def on_touch_down(self, touch):
|
||||
if not self.drawing_enabled or not self.collide_point(*touch.pos):
|
||||
@@ -48,7 +50,11 @@ class DrawingLayer(Widget):
|
||||
|
||||
def on_touch_move(self, touch):
|
||||
if 'line' in touch.ud and self.drawing_enabled:
|
||||
touch.ud['line'].points += [touch.x, touch.y]
|
||||
# Throttle updates to ~60fps for better performance
|
||||
current_time = time.time()
|
||||
if current_time - self._last_draw_time >= self._draw_throttle_interval:
|
||||
touch.ud['line'].points += [touch.x, touch.y]
|
||||
self._last_draw_time = current_time
|
||||
return True
|
||||
|
||||
def undo(self):
|
||||
@@ -68,12 +74,10 @@ class DrawingLayer(Widget):
|
||||
def set_color(self, color_tuple):
|
||||
"""Set drawing color (RGBA)"""
|
||||
self.current_color = color_tuple
|
||||
Logger.debug(f"DrawingLayer: Color set to {color_tuple}")
|
||||
|
||||
def set_thickness(self, value):
|
||||
"""Set line thickness"""
|
||||
self.current_width = value
|
||||
Logger.debug(f"DrawingLayer: Thickness set to {value}")
|
||||
|
||||
|
||||
class EditPopup(Popup):
|
||||
|
||||
Reference in New Issue
Block a user