randomize wishlist order

This commit is contained in:
Broque Thomas 2025-08-08 17:02:18 -07:00
parent 851c3d77b2
commit a5ece58379
4 changed files with 42 additions and 2 deletions

View file

@ -1468,7 +1468,7 @@ class MusicDatabase:
SELECT id, spotify_track_id, spotify_data, failure_reason, retry_count,
last_attempted, date_added, source_type, source_info
FROM wishlist_tracks
ORDER BY date_added ASC
ORDER BY RANDOM()
"""
if limit:

View file

@ -3351,7 +3351,7 @@ class AutoWishlistProcessorWorker(QRunnable):
quality_preference = config_manager.get_quality_preference()
# Get wishlist tracks (limit to prevent overwhelming the system)
wishlist_tracks = self.wishlist_service.get_wishlist_tracks_for_download(limit=10)
wishlist_tracks = self.wishlist_service.get_wishlist_tracks_for_download(limit=25)
if not wishlist_tracks:
self.signals.processing_complete.emit(0, 0, 0)

View file

@ -7493,6 +7493,46 @@ class DownloadsPage(QWidget):
except Exception as e:
print(f"❌ Error re-enabling album buttons: {e}")
def _cleanup_empty_directories(self, download_path, moved_file_path):
"""
Clean up empty directories left after moving a file, ignoring hidden files.
Walks up the directory tree until it finds a non-empty folder or the root download path.
"""
import os
try:
# Start with the directory that contained the moved file
# For you, this will be 'downloads/SomeAlbumFolder'
current_dir = os.path.dirname(moved_file_path)
# This loop will continue as long as the directory is inside the main download path
while current_dir != download_path and current_dir.startswith(download_path):
# Check if the directory is empty, IGNORING hidden files like .DS_Store
is_empty = True
for entry in os.listdir(current_dir):
if not entry.startswith('.'): # This is the key fix
is_empty = False
break
if is_empty:
print(f"Removing empty directory (ignoring hidden files): {current_dir}")
try:
os.rmdir(current_dir)
# After deleting, move up to the parent to check it too
current_dir = os.path.dirname(current_dir)
except OSError as e:
print(f"Warning: Could not remove directory {current_dir}: {e}")
break # Stop if we can't remove a directory
else:
# If the directory is not empty, the job is done.
print(f"Stopping cleanup at non-empty directory: {current_dir}")
break
except Exception as e:
print(f"Warning: An error occurred during directory cleanup: {e}")
def _organize_matched_download(self, download_item, original_file_path: str) -> Optional[str]:
"""Organize a matched download into the Transfer folder structure"""
try: