minor fixes

This commit is contained in:
Broque Thomas 2025-07-29 20:55:11 -07:00
parent ec937a6ea1
commit b16b10e724
6 changed files with 49 additions and 6 deletions

View file

@ -487,14 +487,31 @@ class PlexLibraryWorker(QThread):
if self._stop_requested:
return
# Search Plex for this combination
# Search Plex for this combination (cleaned artist)
print(f" 🔍 Searching Plex: album='{album_name}', artist='{artist_clean}'")
plex_albums = self.plex_client.search_albums(album_name, artist_clean, limit=5)
print(f" 📀 Found {len(plex_albums)} Plex albums")
all_plex_matches.extend(plex_albums)
# Also try album-only search if artist+album didn't work
if not plex_albums and artist_clean:
# Backup search with original uncleaned artist name (for cases like "Tyler, The Creator")
if not plex_albums and artist and artist != artist_clean:
print(f" 🔄 Backup search with original artist: album='{album_name}', artist='{artist}'")
original_artist_results = self.plex_client.search_albums(album_name, artist, limit=5)
print(f" 📀 Found {len(original_artist_results)} albums (original artist)")
all_plex_matches.extend(original_artist_results)
# Additional fallback: remove commas (Tyler, The Creator -> Tyler The Creator)
if not original_artist_results and ',' in artist:
artist_no_comma = artist.replace(',', '').strip()
# Clean up multiple spaces that might result from comma removal
artist_no_comma = ' '.join(artist_no_comma.split())
print(f" 🔄 Comma-removal fallback: album='{album_name}', artist='{artist_no_comma}'")
no_comma_results = self.plex_client.search_albums(album_name, artist_no_comma, limit=5)
print(f" 📀 Found {len(no_comma_results)} albums (no comma)")
all_plex_matches.extend(no_comma_results)
# Also try album-only search if no results from artist searches
if not all_plex_matches: # Only if we haven't found anything yet for this album
print(f" 🔍 Trying album-only search: album='{album_name}'")
album_only_results = self.plex_client.search_albums(album_name, "", limit=5)
print(f" 📀 Found {len(album_only_results)} albums (album-only)")

View file

@ -7602,8 +7602,34 @@ class DownloadsPage(QWidget):
counter += 1
new_file_path = f"{base} ({counter}){ext}"
print(f"📂 Copying file to: {new_file_path}")
shutil.copy2(original_file_path, new_file_path)
print(f"📂 Moving file to: {new_file_path}")
# Verify source file exists before attempting move
if not os.path.exists(original_file_path):
print(f"❌ Source file not found: {original_file_path}")
return None
# Move the file (this will delete the original automatically)
shutil.move(original_file_path, new_file_path)
# Verify the move was successful
if not os.path.exists(new_file_path):
print(f"❌ File move failed - destination file not found: {new_file_path}")
return None
if os.path.exists(original_file_path):
print(f"⚠️ Warning: Original file still exists after move: {original_file_path}")
try:
os.remove(original_file_path)
print(f"🗑️ Cleaned up remaining original file")
except Exception as cleanup_error:
print(f"⚠️ Could not remove original file: {cleanup_error}")
print(f"🧹 File successfully moved and original cleaned up")
# Clean up any empty directories left in the downloads folder
downloads_path = config_manager.get('soulseek.download_path', './Downloads')
self._cleanup_empty_directories(downloads_path, original_file_path)
# Download cover art for both albums and singles
if album_info and album_info['is_album']:

View file

@ -1654,7 +1654,7 @@ class PlaylistItem(QFrame):
}
QPushButton:hover {
background: #1ed760;
cursor: pointer;
}
""")
self.operation_status_button.clicked.connect(self.on_status_clicked)