diff --git a/CHANGELOG.md b/CHANGELOG.md index 977b9ea..e4e5314 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,23 @@ - Desktop/mobile lyrics view following playback, individual track previews, availability icons, and local version editing in the admin track editor. +## v0.16.1 — 2026-11-24 + +- Artist pages show five distinct popular titles at first. Matching titles are + grouped regardless of capitalization, with each recording available from its + branch button. A slim control below the list quickly expands or collapses + the top 50 and respects reduced-motion settings. +- The bottom player uses a shorter, responsive grid for playback, seeking and + track actions on desktop and mobile. +- Saved music in account settings opens a searchable, sortable, paginated cache + manager. It shows download and last-played dates, play counts, audio details + and sizes. Cleanup by date previews the number of recordings and the space + that removing them would free, including shared audio and artwork. +- The account menu shows cache usage against the configured limit and stays + open when interacting with its controls. Unpin notifications can be dismissed early. +- Playlists and Liked songs have an in-list search by track title or artist. + Matching rows animate into place and retain their original playback and edit positions. + ## v0.16.0 — 2026-11-24 - Added opt-in offline listening to the web player. Starting a music track saves diff --git a/Cargo.lock b/Cargo.lock index 8cfd6ec..e12d157 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2062,7 +2062,7 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "furumusic" -version = "0.16.0" +version = "0.16.1" dependencies = [ "anyhow", "async-stream", diff --git a/Cargo.toml b/Cargo.toml index b003258..4ba49c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "furumusic" -version = "0.16.0" +version = "0.16.1" edition = "2024" description = "Reusable web-app boilerplate: auth, OIDC/SSO, admin panel, user management, i18n, PostgreSQL" diff --git a/src/i18n/phrases.rs b/src/i18n/phrases.rs index db30550..5af1206 100644 --- a/src/i18n/phrases.rs +++ b/src/i18n/phrases.rs @@ -303,6 +303,30 @@ translations! { player_offline_used: "Audio and artwork" , "Аудио и обложки"; player_offline_limit: "Cache limit" , "Лимит кеша"; player_offline_saved: "Saved music" , "Сохранённая музыка"; + player_offline_open_cache: "Open cache" , "Открыть кеш"; + player_offline_back_settings: "Back to settings" , "Назад к настройкам"; + player_offline_cache_search: "Search titles and artists" , "Поиск по трекам и артистам"; + player_offline_sort: "Sort by" , "Сортировка"; + player_offline_download_date: "Download date" , "Дата загрузки"; + player_offline_last_played: "Last played" , "Последнее прослушивание"; + player_offline_play_count: "Plays" , "Прослушивания"; + player_offline_bitrate: "Bitrate" , "Битрейт"; + player_offline_ascending: "Ascending order" , "По возрастанию"; + player_offline_descending: "Descending order" , "По убыванию"; + player_offline_manage_storage: "Manage storage" , "Освободить место"; + player_offline_cleanup_scope: "Date filters apply to all saved music, including tracks outside the search results." , "Очистка по дате охватывает все сохранённые треки, включая те, которые не попали в результаты поиска."; + player_offline_remove_by: "Removal criterion" , "Критерий удаления"; + player_offline_downloaded_before: "Downloaded before" , "Загружены до"; + player_offline_played_before: "Last played before" , "Последнее прослушивание до"; + player_offline_never_cleanup: "For tracks with no plays, the download date is used." , "Для треков без прослушиваний используется дата загрузки."; + player_offline_cutoff: "Cutoff date" , "Дата отсечения"; + player_offline_preview_removal: "Preview removal" , "Проверить перед удалением"; + player_offline_will_free: "Space to free" , "Освободится"; + player_offline_remove_confirm: "Remove saved music?" , "Удалить сохранённую музыку?"; + player_offline_saved_all: "All saved tracks on this device" , "Все сохранённые треки на этом устройстве"; + player_offline_pages: "Saved music pages" , "Страницы сохранённой музыки"; + player_offline_previous_page: "Previous page" , "Предыдущая страница"; + player_offline_next_page: "Next page" , "Следующая страница"; player_offline_empty: "No music saved on this device yet." , "На этом устройстве пока нет сохранённой музыки."; player_offline_empty_uploads: "None of your uploads are saved on this device." , "На этом устройстве пока нет треков из ваших загрузок."; player_offline_empty_followed: "No music by your followed artists is saved on this device." , "На этом устройстве пока нет музыки артистов, на которых вы подписаны."; @@ -310,8 +334,6 @@ translations! { player_offline_page_missing: "This page is unavailable offline." , "Эта страница недоступна в офлайн-режиме."; player_offline_open_catalog: "Open saved catalog" , "Открыть сохранённый каталог"; player_offline_clear: "Clear cache" , "Очистить кеш"; - player_offline_show_more: "Show more tracks" , "Показать ещё треки"; - player_offline_confirm_clear: "Remove all saved music from this device?" , "Удалить всю сохранённую музыку с этого устройства?"; player_offline_remove: "Remove from this device" , "Удалить с устройства"; player_offline_save: "Save for offline listening" , "Сохранить для офлайна"; player_offline_available: "Saved on this device" , "Сохранено на устройстве"; @@ -348,6 +370,9 @@ translations! { player_likes_playlist: "Liked songs" , "Мне нравится"; player_listened: "listened" , "прослушано"; player_search_placeholder: "Search artists, releases, tracks, podcasts..." , "Поиск артистов, релизов, треков, подкастов..."; + player_playlist_search: "Search this playlist" , "Поиск по плейлисту"; + player_clear_playlist_search: "Clear playlist search" , "Очистить поиск по плейлисту"; + player_playlist_no_matches: "No matching tracks" , "Подходящих треков нет"; player_search_similar_to: "Search similar to:" , "Поиск похожих на:"; player_find_similar: "Find similar tracks" , "Найти похожие треки"; player_similarity_failed: "Similarity search failed" , "Не удалось найти похожие треки"; @@ -446,6 +471,10 @@ translations! { player_queue_empty: "Queue is empty" , "Очередь пуста"; player_shuffle: "Shuffle" , "Перемешать"; player_repeat: "Repeat" , "Повтор"; + player_pause: "Pause" , "Пауза"; + player_seek: "Playback position" , "Позиция воспроизведения"; + player_mute: "Mute" , "Выключить звук"; + player_unmute: "Unmute" , "Включить звук"; player_volume: "Volume" , "Громкость"; player_appears_on: "Appears on" , "Участвует в"; player_top_tracks: "Popular tracks" , "Популярные треки"; diff --git a/src/player/artist_tests.rs b/src/player/artist_tests.rs index 9fd2fbd..3b08def 100644 --- a/src/player/artist_tests.rs +++ b/src/player/artist_tests.rs @@ -8,6 +8,13 @@ async fn artist_credits_include_visible_features_and_count_each_track_once() -> .max_connections(1) .connect(&std::env::var("FURU_ARTIST_TEST_DATABASE_URL")?) .await?; + let schema = format!("artist_{}", uuid::Uuid::new_v4().simple()); + sqlx::raw_sql(&format!( + "BEGIN; CREATE SCHEMA {schema}; SET LOCAL search_path TO {schema}, public; + CREATE COLLATION furumusic_unicode (provider=icu, locale='und', deterministic=true);" + )) + .execute(&pool) + .await?; sqlx::raw_sql( r#" CREATE TEMP TABLE furumusic__artist ( @@ -82,5 +89,21 @@ async fn artist_credits_include_visible_features_and_count_each_track_once() -> let cards = helpers::artist_cards(&pool, rows.into(), "medium").await?; assert_eq!((cards[0].release_count, cards[0].track_count), (0, 1)); assert_eq!((cards[1].release_count, cards[1].track_count), (1, 3)); + + // Rank titles by their best recording, retaining every version even below the 50-title cutoff. + sqlx::raw_sql( + r#"UPDATE furumusic__track SET title = 'За дверью' WHERE id = 20; + INSERT INTO furumusic__track (id,title,release_id,lastfm_rating,lastfm_playcount) VALUES + (100,'ЗА ДВЕРЬЮ',10,90,100), (101,' за Дверью ',10,90,120); + INSERT INTO furumusic__track (id,title,release_id,lastfm_rating) + SELECT id, 'Song ' || id, 10, 10 FROM generate_series(1000,1049) id;"#, + ) + .execute(&pool) + .await?; + let popular = load_artist_detail(&pool, 2).await?.unwrap().top_tracks; + let ids: Vec<_> = popular.iter().map(|track| track.id).collect(); + let expected: Vec<_> = [101, 100, 20].into_iter().chain(1000..1049).collect(); + assert_eq!(ids, expected); + sqlx::query("ROLLBACK").execute(&pool).await?; Ok(()) } diff --git a/src/player/mod.rs b/src/player/mod.rs index a525fc6..5f3806d 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -4087,28 +4087,18 @@ async fn load_artist_detail( let featured_tracks = build_track_items(featured_rows, pool).await?; let top_tracks = sqlx::query_as::<_, PlaylistTrackRow>( - r#"SELECT * FROM ( - SELECT DISTINCT ON (lower(t.title::text)) - NULL::bigint AS playlist_track_id, - t.id, t.title::text as title, t.track_number, t.disc_number, - t.duration_seconds, t.cover_file_id, - r.cover_file_id as release_cover_file_id, - r.id as release_id, - r.title::text as release_title, - r.year as release_year, - COALESCE(mf.uploader_name, 'UFO')::text AS uploader_name, - mf.audio_format, - mf.audio_bitrate, - mf.audio_sample_rate, - mf.audio_bit_depth, - mf.file_size_bytes, - t.lastfm_listeners, - t.lastfm_playcount, - t.lastfm_rating, - t.lastfm_updated_at + r#"WITH ranked AS ( + SELECT t.id, + lower(trim(regexp_replace(normalize(t.title::text, NFKC) COLLATE furumusic_unicode, + '[[:space:]]+', ' ', 'g'))) AS title_key, + row_number() OVER ( + ORDER BY COALESCE(t.lastfm_rating, 0) DESC, + COALESCE(t.lastfm_playcount, 0) DESC, + COALESCE(t.lastfm_listeners, 0) DESC, + r.year DESC NULLS LAST, t.track_number NULLS LAST, t.id + ) AS rank FROM furumusic__track t JOIN furumusic__release r ON r.id = t.release_id - LEFT JOIN furumusic__media_file mf ON mf.id = t.audio_file_id WHERE t.is_hidden = false AND r.is_hidden = false AND t.id IN ( @@ -4119,15 +4109,23 @@ async fn load_artist_detail( JOIN furumusic__track rt ON rt.release_id = ra.release_id WHERE ra.artist_id = $1 ) - ORDER BY lower(t.title::text), COALESCE(t.lastfm_rating, 0) DESC - ) deduped - ORDER BY COALESCE(lastfm_rating, 0) DESC, - COALESCE(lastfm_playcount, 0) DESC, - COALESCE(lastfm_listeners, 0) DESC, - release_year DESC NULLS LAST, - track_number NULLS LAST, - id - LIMIT 50"#, + ), top_titles AS ( + SELECT title_key, min(rank) AS first_rank + FROM ranked GROUP BY title_key ORDER BY first_rank LIMIT 50 + ) + SELECT NULL::bigint AS playlist_track_id, + t.id, t.title::text AS title, t.track_number, t.disc_number, + t.duration_seconds, t.cover_file_id, r.cover_file_id AS release_cover_file_id, + r.id AS release_id, r.title::text AS release_title, r.year AS release_year, + COALESCE(mf.uploader_name, 'UFO')::text AS uploader_name, + mf.audio_format, mf.audio_bitrate, mf.audio_sample_rate, mf.audio_bit_depth, mf.file_size_bytes, + t.lastfm_listeners, t.lastfm_playcount, t.lastfm_rating, t.lastfm_updated_at + FROM top_titles + JOIN ranked USING (title_key) + JOIN furumusic__track t ON t.id = ranked.id + JOIN furumusic__release r ON r.id = t.release_id + LEFT JOIN furumusic__media_file mf ON mf.id = t.audio_file_id + ORDER BY top_titles.first_rank, ranked.rank"#, ) .bind(artist_id) .fetch_all(pool) diff --git a/src/player/offline-catalog.js b/src/player/offline-catalog.js index 2e7d5e8..949c5d9 100644 --- a/src/player/offline-catalog.js +++ b/src/player/offline-catalog.js @@ -53,6 +53,8 @@ return {id, content_id:t.content_id, title:t.title, artists, featured_artists:featured, release_id:releaseId, release_title:releaseTitle, release_year:year, track_number:t.track_number ?? null, disc_number:t.disc_number ?? null, duration_seconds:t.duration_seconds || 0, cover_url:coverKey(t.cover_url), + audio_format:t.audio_format ?? metadata.audio_format, audio_bitrate:t.audio_bitrate ?? metadata.audio_bitrate, + audio_sample_rate:t.audio_sample_rate ?? metadata.audio_sample_rate, audio_bit_depth:t.audio_bit_depth ?? metadata.audio_bit_depth, uploader_name:'Federation', offline_remote:true, has_lyrics:false, stream_url:BASE + 'stream/' + id, offline_release:{artists:releaseArtists,release_type:key.release_type || ''}}; } @@ -175,9 +177,15 @@ return {tracks, bytes:bytes || 0}; } async list() { - const [rows, plays] = await Promise.all([this.all('tracks'), this.all('plays')]); + const tx = (await this.db()).transaction(['tracks','plays','files']); + const files = tx.objectStore('files'); + const [rows, plays, fileKeys, fileInfo] = await Promise.all([ + requests(tx.objectStore('tracks').getAll()), requests(tx.objectStore('plays').getAll()), + requests(files.getAllKeys()), requests(files.getAll()), + ]); + const mime = new Map(fileKeys.map((key,i) => [key, fileInfo[i].mime])); const counts = new Map(plays.map(p => [p.id, p])); - return rows.map(r => ({...r.track, bytes:r.bytes, downloaded_at:r.downloaded_at, + return rows.map(r => ({...r.track, bytes:r.bytes, audio_mime:mime.get(r.file), downloaded_at:r.downloaded_at, last_played_at:counts.get(r.id)?.last_played_at || null, play_count:counts.get(r.id)?.play_count || 0})); } async has(value) { @@ -406,16 +414,93 @@ if (!activeNames.has(name)) await dir.removeEntry(name); } } - async remove(trackId) { - const id = OfflineCatalog.trackId(trackId); - if (!id) return; - await navigator.locks.request(this.name, async () => { - await this.write(['tracks','plays','pending','lyrics','meta'], get => { - get('tracks').delete(id); get('plays').delete(id); get('pending').delete(id); get('lyrics').delete(id); - get('meta').put(crypto.randomUUID(),'revision'); - }); - await this.prune(await this.directory()); + previewCleanup(criteria = {}) { + return this._cleanup(criteria, null); + } + removeMany(ids, criteria = {}) { + if (!Array.isArray(ids)) throw new TypeError('Expected selected track IDs'); + const selected = new Set(ids.map(trackId).filter(Boolean)); + return navigator.locks.request(this.name, () => this._cleanup(criteria, selected)); + } + async remove(value) { + const id = trackId(value); + if (id) await navigator.locks.request(this.name, () => this._cleanup({}, new Set([id]), true)); + } + async _cleanup(criteria, selected, cancelUnstored = false) { + for (const [field, cutoff] of Object.entries(criteria)) { + if (!['downloadedBefore','lastPlayedBefore'].includes(field) || !Number.isFinite(cutoff)) + throw new TypeError('Invalid offline cleanup cutoff'); + } + const deleting = selected !== null; + const db = await this.db(); + const tx = db.transaction(deleting ? stores : ['tracks','plays','files','assets'], deleting ? 'readwrite' : 'readonly'); + const get = name => tx.objectStore(name); + const finished = new Promise((resolve,reject) => { + tx.oncomplete = resolve; + tx.onabort = () => reject(tx.error || new DOMException('Cleanup aborted','AbortError')); }); + let ids, bytes, discardedFiles; + try { + const [rows, activity, used] = await Promise.all([ + requests(get('tracks').getAll()), requests(get('plays').getAll()), + deleting ? requests(get('meta').get('bytes')) : 0, + ]); + const lastPlay = new Map(activity.map(p => [p.id, p.last_played_at])); + const retainedFiles = new Set(), retainedAssets = new Set(), retainedReleases = new Set(); + const files = new Set(), assets = new Set(), releases = new Set(); + ids = []; + for (const row of rows) { + const lastUsed = lastPlay.get(row.id) ?? row.downloaded_at; + const matches = (!deleting || selected.has(row.id)) + && (criteria.downloadedBefore === undefined || row.downloaded_at < criteria.downloadedBefore) + && (criteria.lastPlayedBefore === undefined || lastUsed < criteria.lastPlayedBefore); + if (matches) ids.push(row.id); + (matches ? files : retainedFiles).add(row.file); + (matches ? releases : retainedReleases).add(row.track.release_id); + for (const key of row.assets) (matches ? assets : retainedAssets).add(key); + } + const fileKeys = [...files].filter(key => !retainedFiles.has(key)); + const assetKeys = [...assets].filter(key => !retainedAssets.has(key)); + // OPFS holds the audio. These reads access file descriptors and Blob sizes only. + const [fileInfo, artwork] = await Promise.all([ + Promise.all(fileKeys.map(key => requests(get('files').get(key)))), + Promise.all(assetKeys.map(key => requests(get('assets').get(key)))), + ]); + discardedFiles = fileInfo.filter(Boolean); + bytes = discardedFiles.reduce((n,f) => n + f.bytes, 0) + artwork.reduce((n,a) => n + (a?.size || 0), 0); + if (deleting) { + // Reading plays and checking cutoffs in this same write transaction protects a newly played track. + for (const id of cancelUnstored ? selected : ids) { + for (const name of ['tracks','plays','pending','lyrics']) get(name).delete(id); + } + for (const key of fileKeys) get('files').delete(key); + for (const key of assetKeys) get('assets').delete(key); + for (const id of releases) if (!retainedReleases.has(id)) get('meta').delete('release/'+id); + if (ids.length) { + get('meta').put(Math.max(0,(used || 0) - bytes),'bytes'); + get('meta').put(crypto.randomUUID(),'revision'); + } + } + await finished; + } catch (error) { + try { tx.abort(); } catch { /* already completed or aborted */ } + await finished.catch(() => {}); + throw error; + } + // Commit the index first so an interrupted removal can only leave an unreferenced file. + if (deleting && discardedFiles.length) { + try { + const dir = await this.directory(); + for (const file of discardedFiles) { + try { await dir.removeEntry(file.name); } + catch (error) { if (error.name !== 'NotFoundError') throw error; } + } + } catch (error) { + this._reconciled = false; + throw error; + } + } + return {ids, count:ids.length, bytes}; } async clear() { await navigator.locks.request(this.name, async () => { diff --git a/src/podcasts/tests.rs b/src/podcasts/tests.rs index cb01fcc..e5eac31 100644 --- a/src/podcasts/tests.rs +++ b/src/podcasts/tests.rs @@ -18,7 +18,7 @@ fn episode_routes_accept_encoded_colons_and_reject_invalid_ids() { #[test] fn renders_podcast_navigation_and_views() { - let html = crate::player::PlayerPageTemplate { + let player = crate::player::PlayerPageTemplate { t: crate::i18n::Translations::for_lang(crate::i18n::Lang::En), guest: false, account_id: 1, @@ -26,9 +26,8 @@ fn renders_podcast_navigation_and_views() { downloads_enabled: true, torrent_downloads_enabled: true, youtube_downloads_enabled: true, - } - .render() - .unwrap(); + }; + let html = player.render().unwrap(); assert_eq!( html.matches("href=\"#podcasts\" class=\"podcast-nav\"").count(), 2 @@ -41,6 +40,13 @@ fn renders_podcast_navigation_and_views() { ); if std::env::var_os("FURU_PODCAST_RENDER_FIXTURE").is_some() { std::fs::write("target/podcast-player-fixture.html", html).unwrap(); + let shared = crate::player::PlayerPageTemplate { + guest: true, + account_id: 0, + share_token: "playlist-filter-test".into(), + ..player + }; + std::fs::write("target/shared-player-fixture.html", shared.render().unwrap()).unwrap(); } } diff --git a/templates/player.html b/templates/player.html index e05f0a2..2baf732 100644 --- a/templates/player.html +++ b/templates/player.html @@ -30,6 +30,7 @@ if ('serviceWorker' in navigator) { {% include "player/modals.html" %} {% include "player/lyrics_modal.html" %} {% include "player/offline_scripts.html" %} +{% include "player/offline_manager_scripts.html" %} {% include "player/podcast_scripts.html" %} {% include "player/lyrics_scripts.html" %} {% include "player/lyrics_search_scripts.html" %} @@ -38,6 +39,7 @@ if ('serviceWorker' in navigator) { {% include "player/listening_scripts.html" %} {% include "player/track_actions_scripts.html" %} {% include "player/playlist_header_scripts.html" %} +{% include "player/playlist_filter_scripts.html" %} {% include "player/scripts.html" %} {% endblock body %} diff --git a/templates/player/account_actions.html b/templates/player/account_actions.html index 43c5dc4..8d10ace 100644 --- a/templates/player/account_actions.html +++ b/templates/player/account_actions.html @@ -3,25 +3,26 @@
- +
+ {% endif %} -
- +
+ {{ t.player_my_listening }} - + {{ t.player_followed_page }} diff --git a/templates/player/artist_popular_track_row.html b/templates/player/artist_popular_track_row.html new file mode 100644 index 0000000..c6916c9 --- /dev/null +++ b/templates/player/artist_popular_track_row.html @@ -0,0 +1,50 @@ +
+
+
+ +
+ +
+
+ {% include "player/track_version_toggle.html" %} + + + · + + +
+
+ {% include "player/track_artist_links.html" %} +
+
+
+ +
+ {% include "player/track_row_badges.html" %} + + + {% include "player/track_actions_button.html" %} +
+ +
+
+
diff --git a/templates/player/artist_popular_tracks.html b/templates/player/artist_popular_tracks.html new file mode 100644 index 0000000..5ca7f36 --- /dev/null +++ b/templates/player/artist_popular_tracks.html @@ -0,0 +1,31 @@ +
+

{{ t.player_top_tracks }}

+
+ # + {{ t.player_title }} + + + {{ t.player_duration }} +
+ + +
diff --git a/templates/player/collection_scripts.html b/templates/player/collection_scripts.html index afaec92..d73d87c 100644 --- a/templates/player/collection_scripts.html +++ b/templates/player/collection_scripts.html @@ -109,12 +109,16 @@ document.addEventListener('alpine:init', () => { const id = ++noticeId; this.undoNotices.push({id, item, order, expires:Date.now() + undoWindow, restoring:false}); setTimeout(() => this.expireUndo(id), undoWindow); - if (keyboard) Alpine.nextTick(() => this.focusVisible('.pin-undo-notice[data-undo-id="' + id + '"] button')); + if (keyboard) Alpine.nextTick(() => this.focusVisible('.pin-undo-notice[data-undo-id="' + id + '"] .pin-undo-action')); }); }, expireUndo(id) { this.undoNotices = this.undoNotices.filter(n => n.id !== id || n.restoring); }, + dismissUndo(id, event) { + this.expireUndo(id); + if (event.detail === 0) Alpine.nextTick(() => this.focusVisible('.music-nav-pages a[href="#artists"]')); + }, undo(id, event) { const notice = this.undoNotices.find(n => n.id === id); if (!notice || notice.restoring) return; diff --git a/templates/player/collection_styles.html b/templates/player/collection_styles.html index 1d07b70..a3a02b8 100644 --- a/templates/player/collection_styles.html +++ b/templates/player/collection_styles.html @@ -43,6 +43,7 @@ padding:6px 8px 6px 14px; min-width:0; min-height:40px; border:1px solid var(--border-color); border-radius:8px; background:var(--bg-elevated); color:var(--text-primary); font-size:13px; } +.pin-undo-notice {position:relative; padding-left:30px} .pin-undo-notice > span {overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0} .pin-undo-notice button { flex:none; padding:6px 10px; min-height:32px; border:0; border-radius:5px; @@ -52,4 +53,13 @@ .pin-undo-notice button:disabled {opacity:.6} .mobile-library-drawer .pin-feedback {position:static; flex:0 0 auto; max-width:100%} .mobile-library-drawer .pin-undo-notice button {min-height:44px} +.pin-undo-notice .pin-notice-close, .mobile-library-drawer .pin-undo-notice .pin-notice-close { + position:absolute; top:1px; left:1px; display:grid; place-items:center; width:26px; height:26px; + min-height:0; padding:0; color:var(--text-secondary); +} +.pin-notice-close svg {width:13px; height:13px} +@media (min-width:901px) and (pointer:fine), (min-width:1025px) { + .pin-feedback {left:calc(var(--sidebar-width) + 12px)} +} +{% include "player/playlist_filter_styles.css" %} diff --git a/templates/player/modals.html b/templates/player/modals.html index 384c1ab..643f9de 100644 --- a/templates/player/modals.html +++ b/templates/player/modals.html @@ -971,10 +971,30 @@ diff --git a/templates/player/offline_cache_manager.html b/templates/player/offline_cache_manager.html new file mode 100644 index 0000000..d86017d --- /dev/null +++ b/templates/player/offline_cache_manager.html @@ -0,0 +1,162 @@ +
+
+
+
+ +

{{ t.player_offline_saved }}

+

+
+ +
+
+
+ +
+ + + +
+
+
+ {{ t.player_offline_manage_storage }} +
+

{{ t.player_offline_cleanup_scope }}

+
+ + + + +
+

{{ t.player_offline_never_cleanup }}

+ +
+
+ +

+ +
    + +
+

+
+ +
+
diff --git a/templates/player/offline_cache_styles.css b/templates/player/offline_cache_styles.css new file mode 100644 index 0000000..b5eaf7c --- /dev/null +++ b/templates/player/offline_cache_styles.css @@ -0,0 +1,127 @@ +.user-settings-overlay .user-settings-modal.cache-view { + width: min(950px, calc(100% - 24px)); + height: min(82dvh, 740px); + max-width: none; + max-height: none; + min-width: 0; + padding: 0; + overflow: hidden; +} +.offline-cache-manager, .offline-cache-layout { min-height: 0; height: 100%; } +.offline-cache-layout { + display: grid; + grid-template-rows: auto minmax(0, 1fr) auto; + --cache-gutter: clamp(14px, 3vw, 26px); + --cache-columns: minmax(130px, 1.8fr) minmax(100px, 1.1fr) repeat(2, minmax(82px, .85fr)) minmax(48px, .6fr) 34px; +} +.offline-cache-head, .offline-cache-pages { + display: flex; + align-items: center; + justify-content: space-between; + gap: 14px; + padding-inline: var(--cache-gutter); +} +.offline-cache-head { align-items: flex-start; padding-block: 12px 16px; border-bottom: 1px solid var(--border-color); } +.offline-cache-head h3 { margin: 3px 0; font-size: 22px; } +.offline-cache-head p, .offline-cleanup-content > p, .offline-cache-notice, .offline-cache-error, +.offline-cache-confirm p, .offline-cache-empty { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.45; } +.offline-cache-back, .offline-cache-icon, .offline-cache-button, .offline-cache-clear { + display: inline-flex; align-items: center; justify-content: center; gap: 5px; + border: 0; border-radius: 6px; background: transparent; color: var(--text-secondary); font: inherit; cursor: pointer; +} +.offline-cache-back { margin-left: -4px; padding: 4px; min-height: 32px; font-size: 12px; } +.offline-cache-layout svg:not(.mobile-list-action svg) { + width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; +} +.offline-cache-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px var(--cache-gutter) 0; } +.offline-cache-tools, .offline-cache-sort, .offline-cleanup-controls, .offline-cache-confirm-actions, .offline-cache-pages > div { + display: flex; align-items: center; gap: 7px; +} +.offline-cache-tools { justify-content: space-between; gap: 12px; } +.offline-cache-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; } +.offline-cache-search, .offline-cache-layout select, .offline-cache-layout input[type="date"] { + box-sizing: border-box; border: 1px solid var(--border-color); border-radius: 6px; background: var(--bg-primary); color: var(--text-primary); +} +.offline-cache-search svg { color: var(--text-secondary); } +.offline-cache-search input { + min-width: 0; width: 100%; height: 36px; border: 0; background: transparent; color: var(--text-primary); font: inherit; font-size: 13px; +} +.offline-cache-search:focus-within { border-color: var(--accent); } +.offline-cache-search input:focus { outline: none; } +.offline-cache-layout select, .offline-cache-layout input[type="date"] { + min-width: 0; max-width: 100%; padding: 0 8px; height: 38px; font: inherit; font-size: 13px; color-scheme: dark; +} +.offline-cache-sort label, .offline-cache-columns, .offline-cache-list small { color: var(--text-secondary); font-size: 12px; } +.offline-cache-icon { width: 34px; height: 34px; padding: 0; } +.offline-cache-icon .ascending { transform: scaleY(-1); } +.offline-cache-layout :is(button, summary, select, input[type="date"]):focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; } +.offline-cache-layout button:disabled { opacity: .45; cursor: default; } +.offline-cache-layout :is(.offline-cache-back,.offline-cache-icon,.offline-cache-clear):not(:disabled):hover { + background: var(--bg-hover); color: var(--text-primary); +} +.offline-cache-cleanup { margin: 12px 0; border-block: 1px solid var(--border-color); } +.offline-cache-cleanup summary { width: fit-content; padding-block: 9px; cursor: pointer; color: var(--text-secondary); font-size: 13px; } +.offline-cleanup-content { display: grid; gap: 9px; padding-bottom: 12px; } +.offline-cleanup-controls { flex-wrap: wrap; } +.offline-cache-button { min-height: 36px; padding: 0 12px; border: 1px solid var(--border-color); background: var(--bg-active); color: var(--text-primary); font-size: 13px; } +.offline-cache-button:not(:disabled):hover { border-color: var(--text-secondary); } +.offline-cache-clear { min-height: 36px; padding: 0 8px; margin-left: auto; font-size: 13px; } +.offline-cache-confirm { + position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; + box-sizing: border-box; margin: 0; padding: 16px; border: 0; background: transparent; color: var(--text-primary); +} +.offline-cache-confirm[open] { display: grid; place-items: center; } +.offline-cache-confirm::backdrop { background: rgba(0,0,0,.65); } +.offline-confirm-card { + width: min(100%, 360px); box-sizing: border-box; padding: 20px; border-radius: 12px; + border: 1px solid var(--border-color); background: var(--bg-elevated); box-shadow: 0 16px 48px rgba(0,0,0,.45); +} +.offline-confirm-card h4 { margin: 0 0 8px; font-size: 18px; } +.offline-confirm-card p { margin-top: 4px; } +.offline-cache-confirm-actions { justify-content: flex-end; margin-top: 18px; } +.offline-cache-destructive, .offline-cache-error { color: #f5b6b1; } +.offline-cache-destructive { border-color: #69443f; background: #342624; } +.offline-cache-notice, .offline-cache-error, .offline-cache-empty { padding-block: 10px; } +.offline-cache-columns, .offline-cache-list li { + display: grid; grid-template-columns: var(--cache-columns); align-items: center; gap: 10px; padding: 8px 0; +} +.offline-cache-columns { border-bottom: 1px solid var(--border-color); } +.offline-cache-list { margin: 0; padding: 0; list-style: none; } +.offline-cache-list li { min-height: 52px; border-bottom: 1px solid var(--border-color); font-variant-numeric: tabular-nums; font-size: 13px; } +.offline-cache-list li:last-child { border-bottom: 0; } +.offline-cache-list li > div { min-width: 0; overflow-wrap: anywhere; } +.offline-cache-track strong, .offline-cache-track small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.offline-cache-track strong { font-size: 14px; font-weight: 600; } +.offline-cache-list small { display: block; line-height: 1.35; } +.offline-cache-downloaded small, .offline-cache-played small, .offline-cache-plays small { + position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); +} +.offline-cache-pages { min-height: 49px; border-top: 1px solid var(--border-color); font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; } +.offline-cache-pages > div > span { min-width: 4ch; text-align: center; } +@media (max-width: 700px) { + .user-settings-overlay .user-settings-modal.cache-view { height: min(90dvh, 840px); } + .offline-cache-tools { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; } + .offline-cache-sort { display: grid; grid-template-columns: auto minmax(0,1fr) 38px; } + .offline-cache-columns { display: none; } + .offline-cache-list li { + grid-template-columns: repeat(4, minmax(0,1fr)); + grid-template-areas: "track track track remove" "audio audio audio plays" "downloaded downloaded played played"; + gap: 5px 12px; padding: 10px 0; + } + .offline-cache-track { grid-area: track; } + .offline-cache-audio { grid-area: audio; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; } + .offline-cache-played { grid-area: played; } + .offline-cache-downloaded { grid-area: downloaded; } + .offline-cache-downloaded, .offline-cache-played { align-self: start; } + .offline-cache-plays { grid-area: plays; } + .offline-cache-delete { grid-area: remove; justify-self: end; } + .offline-cache-icon { width: 38px; height: 38px; } + .offline-cache-downloaded small, .offline-cache-played small, .offline-cache-plays small { position: static; width: auto; height: auto; overflow: visible; clip-path: none; } + .offline-cache-cleanup summary { padding-block: 12px; } + .offline-cleanup-controls { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; } + .offline-cleanup-controls :is(select,input) { width: 100%; } + .offline-cleanup-controls .offline-cache-clear { margin-left: 0; } +} +@media (max-width: 390px) { + .offline-cleanup-controls { grid-template-columns: minmax(0,1fr); } +} diff --git a/templates/player/offline_manager_scripts.html b/templates/player/offline_manager_scripts.html new file mode 100644 index 0000000..ad442a0 --- /dev/null +++ b/templates/player/offline_manager_scripts.html @@ -0,0 +1,161 @@ + diff --git a/templates/player/offline_scripts.html b/templates/player/offline_scripts.html index 68cc843..d8d14b6 100644 --- a/templates/player/offline_scripts.html +++ b/templates/player/offline_scripts.html @@ -83,6 +83,7 @@ document.addEventListener('alpine:init', () => { else this.refresh(); } if (data === 'queue') this.drain(); + if (data === 'plays') window.dispatchEvent(new Event('furumusic:offline-plays')); }; } window.addEventListener('storage', event => { @@ -274,6 +275,8 @@ document.addEventListener('alpine:init', () => { if (!this.enabled || !eligible(track)) return; try { await catalog().touch(track); + channel?.postMessage('plays'); + window.dispatchEvent(new Event('furumusic:offline-plays')); if (!this.active) await this.saveTrack(track); } catch { this.error = label('storage'); } }, @@ -335,26 +338,23 @@ document.addEventListener('alpine:init', () => { this.persist(); this.drain(); }, - async removeTrack(id) { + previewCleanup(criteria) { + return catalog().previewCleanup(criteria); + }, + async removeSaved(ids, criteria) { transfer?.abort(); try { - await catalog().remove(id); - blocked = false; this.error = ''; await this.refresh(); channel?.postMessage('cache'); + const removed = await catalog().removeMany(ids, criteria); + blocked = false; + this.error = ''; + return removed; + } finally { + // The database can commit before the browser finishes unlinking the audio file. + await this.refresh(); + channel?.postMessage('cache'); if (this.active) window.dispatchEvent(new CustomEvent('furumusic:offline-catalog')); this.drain(); - } catch { this.error = label('storage'); } - }, - async clearCache() { - transfer?.abort(); - try { - await catalog().clear(); - const profile = Alpine.store('user')?.profile; - if (this.enabled && profile) await catalog().observe('/api/player/me', profile); - localStorage.removeItem(stateKey); - this.error = ''; blocked = false; await this.refresh(); channel?.postMessage('cache'); - if (this.enabled && !this.active) await this.captureLibrary(); - if (this.active) window.dispatchEvent(new CustomEvent('furumusic:offline-catalog')); - } catch { this.error = label('storage'); } + } }, saveState(state) { if (this.enabled) { try { localStorage.setItem(stateKey, JSON.stringify(state)); } catch {} } diff --git a/templates/player/offline_settings.html b/templates/player/offline_settings.html index 731d362..8816d1a 100644 --- a/templates/player/offline_settings.html +++ b/templates/player/offline_settings.html @@ -1,6 +1,6 @@
- +

{{ t.player_offline_empty }}

- - diff --git a/templates/player/offline_styles.css b/templates/player/offline_styles.css index fa11ff7..e43161d 100644 --- a/templates/player/offline_styles.css +++ b/templates/player/offline_styles.css @@ -1,16 +1,20 @@ html:not(.offline-active) [data-offline-only], html.offline-active [data-online-only], .offline-active :is(.device-popover,.user-settings-devices) > :not([data-offline-only]) {display:none !important} .offline-account {padding:8px 8px 9px; border-bottom:1px solid var(--border-color); margin-bottom:3px} +.offline-account-meter {display:block; width:100%; height:3px; margin:7px 0 3px; appearance:none; border:0; border-radius:4px; overflow:hidden; color:var(--accent); background:var(--bg-active)} +.offline-account-meter::-webkit-progress-bar {background:var(--bg-active)} +.offline-account-meter::-webkit-progress-value {background:var(--accent); border-radius:4px} +.offline-account-meter::-moz-progress-bar {background:var(--accent); border-radius:4px} .offline-account-summary,.offline-limit-label,.offline-saved-summary {display:flex; justify-content:space-between; align-items:center; gap:8px} -.offline-account-summary > div,.offline-saved-summary > div,.offline-saved-list li > div {min-width:0} +.offline-account-summary > div,.offline-saved-summary > div {min-width:0} .offline-account strong,.offline-saved-summary strong {display:block; font-size:13px; font-weight:600; line-height:1.3} -.offline-account small,.offline-saved small,.offline-track-size {display:block; color:var(--text-subdued); font-size:12px; font-variant-numeric:tabular-nums} -.offline-manage,.offline-switch-row,.offline-saved-list button {border:0; border-radius:6px; color:var(--text-secondary); background:transparent; font:inherit; cursor:pointer} +.offline-account small,.offline-saved small {display:block; color:var(--text-subdued); font-size:12px; font-variant-numeric:tabular-nums} +.offline-manage,.offline-switch-row {border:0; border-radius:6px; color:var(--text-secondary); background:transparent; font:inherit; cursor:pointer} .offline-manage {flex:none; padding:6px; font-size:12px; text-decoration:underline; text-underline-offset:3px} -.offline-manage:is(:hover,:focus-visible),.offline-saved-list button:is(:hover,:focus-visible) {background:var(--bg-active); color:var(--text-primary)} +.offline-manage:is(:hover,:focus-visible) {background:var(--bg-active); color:var(--text-primary)} .offline-switch-row {display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:30px; padding:0; text-align:left} .offline-account .offline-switch-row {width:100%; margin-top:3px; font-size:12px} -.offline-switch-row:focus-visible,.offline-manage:focus-visible,.offline-saved-list button:focus-visible,.offline-scale input:focus-visible {outline:2px solid var(--accent); outline-offset:2px} +.offline-switch-row:focus-visible,.offline-manage:focus-visible,.offline-scale input:focus-visible {outline:2px solid var(--accent); outline-offset:2px} .offline-switch-row:disabled,.offline-saved button:disabled {opacity:.5; cursor:default} .offline-switch {position:relative; display:block; flex:none; width:32px; height:18px; border-radius:99px; background:var(--bg-active); border:1px solid var(--text-subdued)} .offline-switch::before {content:""; position:absolute; top:2px; left:2px; width:12px; height:12px; border-radius:50%; background:var(--text-secondary); transition:transform .12s} @@ -33,17 +37,12 @@ html:not(.offline-active) [data-offline-only], html.offline-active [data-online- .offline-scale-marks span:last-of-type {transform:translateX(-100%)} .offline-scale input {display:block; width:100%; height:20px; margin:0; accent-color:var(--accent)} .offline-saved {margin-top:16px} -.offline-saved-list {list-style:none; margin:8px 0 0; padding:0; max-height:min(28dvh,220px); overflow:auto; overscroll-behavior:contain; scrollbar-width:thin} -.offline-saved-list li {display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:8px; min-height:40px; border-top:1px solid var(--border-color)} -.offline-saved-list strong,.offline-saved-list small {display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap} -.offline-saved-list strong {font-size:13px; font-weight:500} -.offline-saved-list button {display:grid; place-items:center; width:36px; height:36px} -.offline-saved-list svg,.offline-topbar-state svg {width:17px; height:17px; flex:none} +.offline-topbar-state svg {width:17px; height:17px; flex:none} .offline-settings .offline-error {color:var(--error, #edadaa)} .offline-topbar-state {display:inline-flex; align-items:center; gap:5px; flex:none; color:var(--text-secondary); font-size:12px; font-weight:600} .offline-devices-note {padding:9px; color:var(--text-secondary); font-size:13px} @media(max-width:600px) { - .offline-account .offline-switch-row,.offline-manage,.offline-saved-list button {min-height:40px} + .offline-account .offline-switch-row,.offline-manage {min-height:40px} .offline-topbar-state span {position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%)} } @media(max-width:360px) { diff --git a/templates/player/pin_undo.html b/templates/player/pin_undo.html index 004d93b..9ed96f2 100644 --- a/templates/player/pin_undo.html +++ b/templates/player/pin_undo.html @@ -1,8 +1,13 @@
diff --git a/templates/player/playlist_filter_scripts.html b/templates/player/playlist_filter_scripts.html new file mode 100644 index 0000000..0bb4559 --- /dev/null +++ b/templates/player/playlist_filter_scripts.html @@ -0,0 +1,89 @@ + diff --git a/templates/player/playlist_filter_styles.css b/templates/player/playlist_filter_styles.css new file mode 100644 index 0000000..3dcb373 --- /dev/null +++ b/templates/player/playlist_filter_styles.css @@ -0,0 +1,57 @@ +.playlist-search-toolbar { + display: flex; + align-items: center; + justify-content: flex-end; + gap: 10px; + margin: 0 0 8px; +} +.playlist-match-count { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; } +.playlist-search-field { + width: min(100%, 228px); + min-width: 0; + position: relative; + border: 1px solid var(--border-color); + border-radius: 7px; + background: var(--bg-elevated); + color: var(--text-secondary); +} +.playlist-search-field:focus-within { border-color: var(--accent); } +.playlist-search-field input { + box-sizing: border-box; width: 100%; min-width: 0; height: 32px; + border: 0; border-radius: inherit; background: transparent; + padding: 0 32px; color: var(--text-primary); outline: none; + font: inherit; font-size: 13px; +} +.playlist-search-field input:placeholder-shown { padding-right: 9px; } +.playlist-search-field input::-webkit-search-cancel-button { display: none; } +.playlist-search-field svg { + width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; + stroke-linecap: round; stroke-linejoin: round; +} +.playlist-search-field > svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); pointer-events: none; } +.playlist-search-clear { + position: absolute; inset: 0 0 0 auto; width: 32px; padding: 0; + display: grid; place-items: center; border: 0; border-radius: 6px; + color: var(--text-secondary); background: transparent; cursor: pointer; +} +.playlist-search-clear:is(:hover, :focus-visible) { color: var(--text-primary); background: var(--bg-active); } +.playlist-search-clear:focus-visible, .playlist-filter-row .track-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; } +.playlist-filter-row { + display: grid; grid-template-rows: 1fr; opacity: 1; + transition: grid-template-rows 145ms ease-out, opacity 120ms ease-out; +} +.playlist-filter-row.is-leaving { grid-template-rows: 0fr; opacity: 0; pointer-events: none; } +@starting-style { + .playlist-filter-row.is-entering { grid-template-rows: 0fr; opacity: 0; } +} +.playlist-filter-clip { min-height: 0; overflow: hidden; } +.playlist-search-empty { padding: 16px; color: var(--text-secondary); font-size: 13px; text-align: center; } +@media (max-width: 600px) { + .playlist-search-toolbar { gap: 7px; margin-bottom: 6px; } + .playlist-search-field { width: min(68%, 208px); } + .playlist-search-field input { height: 36px; font-size: 16px; } + .playlist-search-clear { width: 36px; } +} +@media (prefers-reduced-motion: reduce) { + .playlist-filter-row { transition: none; } +} diff --git a/templates/player/playlist_track_row.html b/templates/player/playlist_track_row.html new file mode 100644 index 0000000..5e2a82e --- /dev/null +++ b/templates/player/playlist_track_row.html @@ -0,0 +1,89 @@ +
+ + + + + + + +
+ +
+
+
+ {% include "player/track_artist_links.html" %} +
+
+
+ +
+ {% include "player/track_row_badges.html" %} + + + {% include "player/track_actions_button.html" %} +
+ +
diff --git a/templates/player/scripts.html b/templates/player/scripts.html index eca6179..627b4e4 100644 --- a/templates/player/scripts.html +++ b/templates/player/scripts.html @@ -578,6 +578,9 @@ document.addEventListener('alpine:init', () => { return; } this.cleanLastfmQuery(); + document.addEventListener('click', event => { + if (this.menuOpen && !event.target.closest?.('[data-account-menu]')) this.menuOpen = false; + }, true); this.load(); this.loadLastfm(); }, @@ -1040,37 +1043,6 @@ document.addEventListener('alpine:init', () => { this.seek(Math.max(0, Math.min(max, current + delta))); }, - seekFromClick(event) { - const bar = event.currentTarget; - this._setProgressFromClientX(event.clientX, bar); - }, - - _setProgressFromClientX(clientX, bar) { - const rect = bar.getBoundingClientRect(); - const pct = rect.width > 0 ? Math.max(0, Math.min(1, (clientX - rect.left) / rect.width)) : 0; - if (this.duration > 0) { - this.seek(pct * this.duration); - } - }, - - startProgressDrag(event) { - const bar = event.currentTarget; - this._setProgressFromClientX(event.clientX, bar); - bar.setPointerCapture?.(event.pointerId); - - const move = (e) => { - this._setProgressFromClientX(e.clientX, bar); - }; - const stop = () => { - window.removeEventListener('pointermove', move); - window.removeEventListener('pointerup', stop); - window.removeEventListener('pointercancel', stop); - }; - window.addEventListener('pointermove', move); - window.addEventListener('pointerup', stop); - window.addEventListener('pointercancel', stop); - }, - next() { if (this._shouldSendRemote()) { this._sendRemote('next', { @@ -1154,34 +1126,6 @@ document.addEventListener('alpine:init', () => { return Math.pow(pct, this._volumeCurve); }, - _setVolumeFromClientX(clientX, bar) { - const rect = bar.getBoundingClientRect(); - const pct = rect.width > 0 ? (clientX - rect.left) / rect.width : 0; - this.setVolume(this._volumeFromSliderPosition(pct)); - }, - - setVolumeFromClick(event) { - this._setVolumeFromClientX(event.clientX, event.currentTarget); - }, - - startVolumeDrag(event) { - const bar = event.currentTarget; - this._setVolumeFromClientX(event.clientX, bar); - bar.setPointerCapture?.(event.pointerId); - - const move = (e) => { - this._setVolumeFromClientX(e.clientX, bar); - }; - const stop = () => { - window.removeEventListener('pointermove', move); - window.removeEventListener('pointerup', stop); - window.removeEventListener('pointercancel', stop); - }; - window.addEventListener('pointermove', move); - window.addEventListener('pointerup', stop); - window.addEventListener('pointercancel', stop); - }, - toggleMute() { if (this.volume > 0) { this._prevVolume = this.volume; @@ -4648,10 +4592,8 @@ document.addEventListener('alpine:init', () => { playSearchTrack(idx) { const tracks = this.displaySearchResults.tracks; - const visible = Alpine.store('searchGroups').rows(tracks, 'search') - .filter(row => !row._searchGroupHidden); - const position = visible.findIndex(row => row._searchSourceIndex === idx); - if (position >= 0) Alpine.store('queue').playRelease(visible.map(row => tracks[row._searchSourceIndex]), position); + const groups = Alpine.store('searchGroups'); + groups.playRows(groups.rows(tracks, 'search'), tracks, idx); }, _setupScroll() { diff --git a/templates/player/search_group_scripts.html b/templates/player/search_group_scripts.html index e60f023..f3a0443 100644 --- a/templates/player/search_group_scripts.html +++ b/templates/player/search_group_scripts.html @@ -1,85 +1,145 @@ diff --git a/templates/player/shell.html b/templates/player/shell.html index bdc619b..3e34a23 100644 --- a/templates/player/shell.html +++ b/templates/player/shell.html @@ -10,9 +10,7 @@ {% if !guest %}