Fix discovery search quality and server playlist track positioning

Fix modal results: sort standard album versions above live, remix,
cover, soundtrack, remaster, and deluxe variants so users see the
original studio track first instead of obscure versions.

Plex Find & Add: tracks were always appended to the end of the
playlist because addItems ignores position. Now moves the track
to the correct slot after adding via moveItem.
pull/333/head
Broque Thomas 4 weeks ago
parent 5b9c9bc6fa
commit dd3b71bc9a

@ -22529,6 +22529,7 @@ def get_version_info():
"• Reject Qobuz 30-second sample/preview downloads",
"• Fix library page crash on All filter — non-string soul_id broke card rendering",
"• Auto Wing It fallback for failed discovery — unmatched tracks download via Soulseek with raw metadata",
"• Fix server playlist Find & Add inserting at wrong position on Plex",
"• Smarter Fix modal results — standard album versions sorted above live/remix/cover/soundtrack variants",
"• Unmatch discovery tracks — red ✕ button to remove bad matches from playlist discovery",
"• Customizable music video naming — path template with $artist, $title, $year variables",
@ -32434,6 +32435,22 @@ def server_playlist_add_track(playlist_id):
logger.info(f"[ServerPlaylist] Adding track: '{new_item.title}' (ratingKey={new_item.ratingKey}) to playlist '{playlist_name}'")
raw_playlist.addItems([new_item])
# Move to correct position if specified (addItems always appends to end)
if position is not None:
try:
raw_playlist.reload()
items = list(raw_playlist.items())
pos = max(0, min(int(position), len(items) - 1))
if pos == 0:
raw_playlist.moveItem(items[-1]) # Move to first position
elif pos < len(items) - 1:
raw_playlist.moveItem(items[-1], after=items[pos - 1])
# else: already at end, no move needed
logger.info(f"[ServerPlaylist] Moved track to position {pos}")
except Exception as move_err:
logger.warning(f"[ServerPlaylist] Could not reposition track: {move_err}")
new_id = str(raw_playlist.ratingKey)
logger.info(f"[ServerPlaylist] Added track to playlist, playlist ID: {new_id}")
return jsonify({"success": True, "message": "Track added", "new_playlist_id": new_id})

@ -3602,6 +3602,7 @@ const WHATS_NEW = {
'2.33': [
// --- April 19, 2026 ---
{ date: 'April 19, 2026' },
{ title: 'Fix Server Playlist Find & Add Position', desc: 'When using "Find & add" on server playlists with Plex, the track was always appended to the end instead of inserted at the correct position. Now moves the track to the right slot after adding' },
{ title: 'Smarter Fix Modal Search Results', desc: 'The discovery Fix modal now sorts search results to prioritize standard album versions over live recordings, remixes, covers, soundtracks, remasters, and deluxe editions. Previously the first result was often a live or remix version instead of the original studio track' },
{ title: 'Unmatch Discovery Tracks', desc: 'Found tracks in playlist discovery now have a red ✕ button to remove the match. Sets the track back to Not Found so it won\'t be downloaded. For mirrored playlists, the unmatch persists in the DB and is respected on re-discovery runs' },
{ title: 'Customizable Music Video Naming', desc: 'Music video file naming is now configurable via a path template in Settings → Library → Paths & Organization. Default unchanged (Artist/Title-video.mp4). Remove "-video" from the template to get clean filenames. Available variables: $artist, $artistletter, $title, $year', page: 'settings' },

Loading…
Cancel
Save