Fixed Wrong Names
This commit is contained in:
1 parent
348a6c6cfc
commit
5d9db0a66f
2 files changed
+69
-17
No files matched your search
@@ -63,6 +63,7 @@ def cleanup_old_cache_files():
|
|||||||
return
|
return
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
current_time = time.time()
|
current_time = time.time()
|
||||||
# Clean files older than 2 hours (more aggressive)
|
# Clean files older than 2 hours (more aggressive)
|
||||||
two_hours_ago = current_time - (2 * 60 * 60)
|
two_hours_ago = current_time - (2 * 60 * 60)
|
||||||
@@ -99,7 +100,9 @@ def get_artwork_cached(url: str) -> Optional[str]:
|
|||||||
os.makedirs(CACHE_DIR, exist_ok=True)
|
os.makedirs(CACHE_DIR, exist_ok=True)
|
||||||
|
|
||||||
# Generate cache filename
|
# Generate cache filename
|
||||||
safe_filename = re.sub(r'[^\w\-_.]', '_', urllib.parse.urlparse(url).path.split('/')[-1])
|
safe_filename = re.sub(
|
||||||
|
r"[^\w\-_.]", "_", urllib.parse.urlparse(url).path.split("/")[-1]
|
||||||
|
)
|
||||||
if not safe_filename:
|
if not safe_filename:
|
||||||
safe_filename = f"artwork_{hash(url)}"
|
safe_filename = f"artwork_{hash(url)}"
|
||||||
|
|
||||||
@@ -108,6 +111,7 @@ def get_artwork_cached(url: str) -> Optional[str]:
|
|||||||
# Check if cached file exists and is recent (within 2 hours)
|
# Check if cached file exists and is recent (within 2 hours)
|
||||||
if os.path.exists(cache_file):
|
if os.path.exists(cache_file):
|
||||||
import time
|
import time
|
||||||
|
|
||||||
if time.time() - os.path.getmtime(cache_file) < 7200: # 2 hours
|
if time.time() - os.path.getmtime(cache_file) < 7200: # 2 hours
|
||||||
_artwork_cache[url] = cache_file
|
_artwork_cache[url] = cache_file
|
||||||
return cache_file
|
return cache_file
|
||||||
@@ -201,11 +205,13 @@ class EmbeddedExpandedPlayer(Box):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Destroy player content (PlayerBoxStack)
|
# Destroy player content (PlayerBoxStack)
|
||||||
if hasattr(self, 'player_content') and hasattr(self.player_content, "destroy"):
|
if hasattr(self, "player_content") and hasattr(
|
||||||
|
self.player_content, "destroy"
|
||||||
|
):
|
||||||
self.player_content.destroy()
|
self.player_content.destroy()
|
||||||
|
|
||||||
# Clean up back button
|
# Clean up back button
|
||||||
if hasattr(self, 'back_button') and hasattr(self.back_button, "destroy"):
|
if hasattr(self, "back_button") and hasattr(self.back_button, "destroy"):
|
||||||
self.back_button.destroy()
|
self.back_button.destroy()
|
||||||
|
|
||||||
# Clean up any other widgets we might have
|
# Clean up any other widgets we might have
|
||||||
@@ -216,7 +222,7 @@ class EmbeddedExpandedPlayer(Box):
|
|||||||
logger.warning(f"Failed to destroy child widget: {e}")
|
logger.warning(f"Failed to destroy child widget: {e}")
|
||||||
|
|
||||||
# Clean up keybinding if it was added
|
# Clean up keybinding if it was added
|
||||||
if hasattr(self, '_keybinding_added') and self._keybinding_added:
|
if hasattr(self, "_keybinding_added") and self._keybinding_added:
|
||||||
try:
|
try:
|
||||||
if hasattr(self.control_center, "remove_keybinding"):
|
if hasattr(self.control_center, "remove_keybinding"):
|
||||||
self.control_center.remove_keybinding("Escape")
|
self.control_center.remove_keybinding("Escape")
|
||||||
@@ -230,9 +236,9 @@ class EmbeddedExpandedPlayer(Box):
|
|||||||
logger.debug("🗑️ Cleared global widget and artwork caches")
|
logger.debug("🗑️ Cleared global widget and artwork caches")
|
||||||
|
|
||||||
# Clear references
|
# Clear references
|
||||||
if hasattr(self, 'control_center'):
|
if hasattr(self, "control_center"):
|
||||||
self.control_center = None
|
self.control_center = None
|
||||||
if hasattr(self, 'mpris_manager'):
|
if hasattr(self, "mpris_manager"):
|
||||||
self.mpris_manager = None
|
self.mpris_manager = None
|
||||||
|
|
||||||
# Force garbage collection
|
# Force garbage collection
|
||||||
@@ -250,7 +256,9 @@ class EmbeddedExpandedPlayer(Box):
|
|||||||
logger.debug("🧹 EmbeddedExpandedPlayer light cleanup starting")
|
logger.debug("🧹 EmbeddedExpandedPlayer light cleanup starting")
|
||||||
|
|
||||||
# Only clean up the player content lightly
|
# Only clean up the player content lightly
|
||||||
if hasattr(self, 'player_content') and hasattr(self.player_content, '_periodic_cleanup'):
|
if hasattr(self, "player_content") and hasattr(
|
||||||
|
self.player_content, "_periodic_cleanup"
|
||||||
|
):
|
||||||
self.player_content._periodic_cleanup()
|
self.player_content._periodic_cleanup()
|
||||||
|
|
||||||
# Clean global caches but don't destroy core functionality
|
# Clean global caches but don't destroy core functionality
|
||||||
@@ -312,11 +320,15 @@ class PlayerBoxStack(Box):
|
|||||||
|
|
||||||
# Process existing players
|
# Process existing players
|
||||||
for player in self.mpris_manager.players: # type: ignore
|
for player in self.mpris_manager.players: # type: ignore
|
||||||
logger.info(f"[PLAYER MANAGER] player found: {player.get_property('player-name')}")
|
logger.info(
|
||||||
|
f"[PLAYER MANAGER] player found: {player.get_property('player-name')}"
|
||||||
|
)
|
||||||
self.on_new_player(self.mpris_manager, player)
|
self.on_new_player(self.mpris_manager, player)
|
||||||
|
|
||||||
# Schedule periodic memory cleanup and store source ID
|
# Schedule periodic memory cleanup and store source ID
|
||||||
self._cleanup_source_id = GLib.timeout_add_seconds(300, self._periodic_cleanup) # Every 5 minutes
|
self._cleanup_source_id = GLib.timeout_add_seconds(
|
||||||
|
300, self._periodic_cleanup
|
||||||
|
) # Every 5 minutes
|
||||||
|
|
||||||
def _periodic_cleanup(self):
|
def _periodic_cleanup(self):
|
||||||
"""Light cleanup for widget reuse - preserve functionality."""
|
"""Light cleanup for widget reuse - preserve functionality."""
|
||||||
@@ -339,7 +351,7 @@ class PlayerBoxStack(Box):
|
|||||||
|
|
||||||
# Reset stack to show no_media_box without destroying children
|
# Reset stack to show no_media_box without destroying children
|
||||||
try:
|
try:
|
||||||
if hasattr(self, 'player_stack') and hasattr(self, 'no_media_box'):
|
if hasattr(self, "player_stack") and hasattr(self, "no_media_box"):
|
||||||
self.player_stack.set_visible_child(self.no_media_box)
|
self.player_stack.set_visible_child(self.no_media_box)
|
||||||
self.current_stack_pos = 0
|
self.current_stack_pos = 0
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -359,7 +371,7 @@ class PlayerBoxStack(Box):
|
|||||||
"""Clean up resources when the widget is destroyed."""
|
"""Clean up resources when the widget is destroyed."""
|
||||||
try:
|
try:
|
||||||
# Cancel any pending cleanup timer
|
# Cancel any pending cleanup timer
|
||||||
if hasattr(self, '_cleanup_source_id') and self._cleanup_source_id:
|
if hasattr(self, "_cleanup_source_id") and self._cleanup_source_id:
|
||||||
try:
|
try:
|
||||||
GLib.source_remove(self._cleanup_source_id)
|
GLib.source_remove(self._cleanup_source_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -368,7 +380,7 @@ class PlayerBoxStack(Box):
|
|||||||
# Disconnect all signal connections
|
# Disconnect all signal connections
|
||||||
for obj, handler_id in self._signal_connections:
|
for obj, handler_id in self._signal_connections:
|
||||||
try:
|
try:
|
||||||
if obj and hasattr(obj, 'disconnect'):
|
if obj and hasattr(obj, "disconnect"):
|
||||||
obj.disconnect(handler_id)
|
obj.disconnect(handler_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"Failed to disconnect signal: {e}")
|
logger.warning(f"Failed to disconnect signal: {e}")
|
||||||
@@ -770,7 +782,7 @@ class PlayerBox(Box):
|
|||||||
min_value=0,
|
min_value=0,
|
||||||
max_value=100,
|
max_value=100,
|
||||||
increments=(1, 1),
|
increments=(1, 1),
|
||||||
name="macos-seek-bar",
|
name="expanded-seek-bar",
|
||||||
size=1,
|
size=1,
|
||||||
h_expand=True,
|
h_expand=True,
|
||||||
)
|
)
|
||||||
@@ -998,6 +1010,7 @@ class PlayerBox(Box):
|
|||||||
if self._seekbar_timer_id:
|
if self._seekbar_timer_id:
|
||||||
try:
|
try:
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
GLib.source_remove(self._seekbar_timer_id)
|
GLib.source_remove(self._seekbar_timer_id)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -1117,6 +1130,7 @@ class PlayerBox(Box):
|
|||||||
if self._seekbar_timer_id:
|
if self._seekbar_timer_id:
|
||||||
try:
|
try:
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
GLib.source_remove(self._seekbar_timer_id)
|
GLib.source_remove(self._seekbar_timer_id)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@@ -286,8 +286,8 @@
|
|||||||
#control-center-menu slider {
|
#control-center-menu slider {
|
||||||
background: linear-gradient(135deg, #ffffff 0%, #f0f1f2 100%);
|
background: linear-gradient(135deg, #ffffff 0%, #f0f1f2 100%);
|
||||||
border-color: #000;
|
border-color: #000;
|
||||||
/* min-width: 28px; */
|
min-width: 28px;
|
||||||
/* min-height: 28px; */
|
min-height: 28px;
|
||||||
margin: -2px;
|
margin: -2px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
/* background-image: none; */
|
/* background-image: none; */
|
||||||
@@ -657,7 +657,6 @@
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
/* macOS seek bar styling */
|
/* macOS seek bar styling */
|
||||||
|
|
||||||
#macos-seek-bar {
|
#macos-seek-bar {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
margin: 8px 0 4px 0;
|
margin: 8px 0 4px 0;
|
||||||
@@ -684,7 +683,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-radius: 20%;
|
border-radius: 20%;
|
||||||
min-width: 1px;
|
min-width: 1px;
|
||||||
min-height: 10px;
|
min-height: 8px;
|
||||||
margin: -3px;
|
margin: -3px;
|
||||||
box-shadow: 0 1px 3px alpha(#000, 0.3);
|
box-shadow: 0 1px 3px alpha(#000, 0.3);
|
||||||
transition: all 0.1s ease;
|
transition: all 0.1s ease;
|
||||||
@@ -785,3 +784,42 @@
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
padding-right: 8px;
|
padding-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#expanded-seek-bar {
|
||||||
|
background-color: transparent;
|
||||||
|
margin: 8px 0 4px 0;
|
||||||
|
min-height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#expanded-seek-bar trough {
|
||||||
|
min-width: 200px;
|
||||||
|
|
||||||
|
min-height: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background-color: alpha(#fff, 0.25);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#expanded-seek-bar highlight {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#expanded-seek-bar slider {
|
||||||
|
background: #ffffff;
|
||||||
|
border: none;
|
||||||
|
border-radius: 20%;
|
||||||
|
min-width: 1px;
|
||||||
|
min-height: 10px;
|
||||||
|
margin: -3px;
|
||||||
|
box-shadow: 0 1px 3px alpha(#000, 0.3);
|
||||||
|
transition: all 0.1s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#expanded-seek-bar slider:hover {
|
||||||
|
min-width: 4px;
|
||||||
|
min-height: 14px;
|
||||||
|
margin: -5px;
|
||||||
|
box-shadow: 0 2px 6px alpha(#000, 0.4);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user