diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 28dce6779..4f8a9d939 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,11 +31,13 @@ AI-generated code **is accepted** under the following conditions: Pull requests are **manually reviewed** by maintainers which means that submitting any form of slop wastes our precious time that could otherwise go towards fixing bugs or implementing new features. +When communicating with maintainers or other users in issues, discussions, or pull requests, DO NOT respond to others with solely AI generated text. I and other maintainers spend REAL and VALUABLE time maintaining this project, so communicating in your own words is the bare minimum that I ask of you. + ## Pull requests Please include: -- A clear description of the change +- A clear description of the change in your own words - Screenshots or recordings for UI changes if applicable ## Translations diff --git a/src/i18n/locales/ca.json b/src/i18n/locales/ca.json index 4f03497d7..b830c0b12 100644 --- a/src/i18n/locales/ca.json +++ b/src/i18n/locales/ca.json @@ -524,7 +524,9 @@ "input_jellyfinSignInMethod": "Inicia sessió amb", "input_jellyfinSignInMethodPassword": "Contrasenya", "input_jellyfinSignInMethodQuickConnect": "Quick Connect", - "input_remoteUrlDescription": "S'utilitza en lloc de l'URL per a funcions externes, com ara enllaços compartits. Deixeu-ho en blanc a menys que el vostre servidor sigui accessible a una adreça diferent de fora de la vostra xarxa." + "input_remoteUrlDescription": "S'utilitza en lloc de l'URL per a funcions externes, com ara enllaços compartits. Deixeu-ho en blanc a menys que el vostre servidor sigui accessible a una adreça diferent de fora de la vostra xarxa.", + "input_enableAudiobooks": "Activa audiollibres", + "input_enableAudiobooksDescription": "Mostra contingut d'audiollibres de biblioteques de \"Llibres\"" }, "shareItem": { "description": "Descripció", diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 81f0b43b9..091e0a92b 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -346,6 +346,8 @@ "error_savePassword": "An error occurred when trying to save the password", "ignoreCors": "Ignore CORS ($t(common.restartRequired))", "ignoreSsl": "Ignore SSL ($t(common.restartRequired))", + "input_enableAudiobooks": "Enable Audiobooks", + "input_enableAudiobooksDescription": "Show audiobook content from \"Books\" libraries", "input_jellyfinQuickConnect": "Quick Connect", "input_jellyfinQuickConnectCode": "Enter this code in your Jellyfin web UI to authorize", "input_jellyfinQuickConnectCodeCopied": "Copied", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index df9e4be52..0bf6d8bf0 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -1123,7 +1123,9 @@ "input_jellyfinSignInMethod": "Iniciar sesión con", "input_jellyfinSignInMethodPassword": "Contraseña", "input_jellyfinSignInMethodQuickConnect": "Conexión rápida", - "input_remoteUrlDescription": "Usado en lugar de la URL para características externas, como enlaces compartidos. Dejar esto en blanco a menos que tu servidor sea alcanzable a través de una dirección diferente desde fuera de tu red." + "input_remoteUrlDescription": "Usado en lugar de la URL para características externas, como enlaces compartidos. Dejar esto en blanco a menos que tu servidor sea alcanzable a través de una dirección diferente desde fuera de tu red.", + "input_enableAudiobooks": "Activar audiolibros", + "input_enableAudiobooksDescription": "Muestra contenido de audiolibros desde las bibliotecas \"Libros\"" }, "addToPlaylist": { "success": "Añadido $t(entity.trackWithCount, {\"count\": {{message}} }) a $t(entity.playlistWithCount, {\"count\": {{numOfPlaylists}} })", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index ba36882fe..029ef16c5 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -1393,7 +1393,8 @@ "owner": "Propriétaire", "sampleRate": "Taux d'échantillonnage", "date": "Date", - "year": "Année" + "year": "Année", + "bitDepth": "Bits par échantillon" } }, "dragDropZone": { diff --git a/src/i18n/locales/pl.json b/src/i18n/locales/pl.json index 40c81aec4..20017a4ae 100644 --- a/src/i18n/locales/pl.json +++ b/src/i18n/locales/pl.json @@ -369,7 +369,9 @@ "input_jellyfinSignInMethod": "Zaloguj się za pomocą", "input_jellyfinSignInMethodPassword": "Hasła", "input_jellyfinSignInMethodQuickConnect": "Szybkiego łączenia", - "input_remoteUrlDescription": "Używany w miejscu URL dla zewnętrznych funkcji, takich jak udostępnione linki. Pozostaw puste, chyba że twój serwer jest dostępny pod innym adresem poza twoją siecią." + "input_remoteUrlDescription": "Używany w miejscu URL dla zewnętrznych funkcji, takich jak udostępnione linki. Pozostaw puste, chyba że twój serwer jest dostępny pod innym adresem poza twoją siecią.", + "input_enableAudiobooks": "Włącz audiobooki", + "input_enableAudiobooksDescription": "Pokazuj treść audiobooki z bibliotek \"Książki\"" }, "addToPlaylist": { "success": "Dodano $t(entity.trackWithCount, {\"count\": {{message}} }) do $t(entity.playlistWithCount, {\"count\": {{numOfPlaylists}} })", @@ -790,7 +792,7 @@ "previousAlbum": "Alt+kliknięcie aby odtworzyć poprzedni album" }, "setting": { - "crossfadeStyle_description": "Wybierz styl przenikania, który ma być używany do odtwarzania dźwięku", + "crossfadeStyle_description": "Wybierz styl przejścia, który ma być używany do odtwarzania dźwięku", "hotkey_skipBackward": "Przeskocz do tyłu", "audioDevice_description": "Wybierz urządzenie dźwiękowe używane do odtwarzania", "hotkey_playbackPause": "Wstrzymaj", @@ -835,7 +837,7 @@ "hotkey_toggleQueue": "Przełącz kolejkę", "hotkey_rate5": "Oceń na 5 gwiazdek", "hotkey_playbackPrevious": "Poprzedni utwór", - "crossfadeDuration_description": "Ustaw czas trwania efektu przenikania", + "crossfadeDuration_description": "Ustaw czas trwania efektu przejścia", "hotkey_toggleShuffle": "Przełącz kolejność losową", "discordRichPresence_description": "Włącz status odtwarzania w {{discord}} (rich presence). Dzięki temu będą wyświetlane informacje takie jak: {{icon}}, {{playing}} i {{paused}}", "audioDevice": "Urządzenia dźwiękowe", @@ -856,7 +858,7 @@ "globalMediaHotkeys_description": "Włącz lub wyłącz używanie systemowych skrótów klawiszowych do kontroli odtwarzania", "customFontPath": "Niestandardowa ścieżka czcionki", "followLyric": "Podążaj za tekstem", - "crossfadeDuration": "Czas trwania przenikania", + "crossfadeDuration": "Czas trwania przejścia", "discordIdleStatus": "Pokaż status w stanie bezczynności", "audioPlayer": "Odtwarzacz dźwięku", "hotkey_zoomOut": "Oddal", @@ -878,7 +880,7 @@ "playButtonBehavior_optionAddLast": "$t(player.addLast)", "minimizeToTray_description": "Zminimalizuj aplikację do zasobnika systemowego", "remotePassword": "Hasło dla serwera zdalnej kontroli", - "playbackStyle_optionCrossFade": "Przenikanie", + "playbackStyle_optionCrossFade": "Przejście", "playbackStyle": "Styl odtwarzania", "playbackStyle_description": "Wybierz styl odtwarzania dla odtwarzacza dźwięku", "mpvExecutablePath": "Ścieżka pliku wykonywalnego mpv", @@ -1016,7 +1018,7 @@ "artistBackground_description": "Dodaje obraz tła do stron wykonawców", "artistBackgroundBlur": "Rozmiar rozmazania obrazu tła wykonawców", "artistBackgroundBlur_description": "Wybiera poziom rozmazania obrazów tła wykonawców", - "crossfadeStyle": "Styl przenikania dźwięku", + "crossfadeStyle": "Styl przejścia dźwięku", "releaseChannel_optionBeta": "Beta", "releaseChannel_optionLatest": "Najnowsza", "releaseChannel": "Kanał wydań", @@ -1656,7 +1658,7 @@ }, "speakerProperties": { "bass": "Bas", - "crossfade": "Crossfade", + "crossfade": "Przejście", "ledState": "Dioda stanu", "loadFailed": "Nie udało się załadować właściwości", "loading": "Ładowanie…", diff --git a/src/i18n/locales/uk.json b/src/i18n/locales/uk.json index bd2d3c139..3fb45d63f 100644 --- a/src/i18n/locales/uk.json +++ b/src/i18n/locales/uk.json @@ -1,18 +1,18 @@ { "action": { - "addToFavorites": "Додати в $t(entity.favorite, {\"count\": 2})", + "addToFavorites": "Додати в «Улюблене»", "addOrRemoveFromSelection": "Додати до вибраного або вилучити з нього", "selectRangeOfItems": "Вибрати діапазон елементів", - "addToPlaylist": "Додати в $t(entity.playlist, {\"count\": 1})", + "addToPlaylist": "Додати до плейлиста", "clearQueue": "Очистити чергу", - "createPlaylist": "Створити $t(entity.playlist, {\"count\": 1})", - "createRadioStation": "Створити $t(entity.radioStation, {\"count\": 1})", - "deletePlaylist": "Видалити $t(entity.playlist, {\"count\": 1})", - "deleteRadioStation": "Видалити $t(entity.radioStation, {\"count\": 1})", + "createPlaylist": "Створити плейлист", + "createRadioStation": "Додати радіостанцію", + "deletePlaylist": "Видалити плейлист", + "deleteRadioStation": "Видалити радіостанцію", "selectAll": "Вибрати все", "deselectAll": "Скасувати вибір", "downloadStarted": "Розпочато завантаження {{count}} елементів", - "editPlaylist": "Редагувати $t(entity.playlist, {\"count\": 1})", + "editPlaylist": "Редагувати плейлист", "goToPage": "Перейти на сторінку", "moveToNext": "Перемістити далі", "moveToBottom": "Перемістити вниз", @@ -26,11 +26,11 @@ "shuffleAll": "Перемішати все", "shuffleSelected": "Перемішати вибране", "refresh": "$t(common.refresh)", - "removeFromFavorites": "Прибрати позначку «$t(entity.favorite, {\"count\": 2})»", - "removeFromPlaylist": "Вилучити з $t(entity.playlist, {\"count\": 1})", + "removeFromFavorites": "Вилучити з «Улюбленого»", + "removeFromPlaylist": "Вилучити з плейлиста", "removeFromQueue": "Вилучити з черги", - "setRating": "Установити оцінку", - "viewPlaylists": "Переглянути $t(entity.playlist, {\"count\": 2})", + "setRating": "Оцінити", + "viewPlaylists": "Переглянути плейлисти", "viewMore": "Показати більше", "openApplicationDirectory": "Відкрити папку програми", "openIn": { @@ -43,7 +43,7 @@ "goToCurrent": "Перейти до поточного елемента", "collapseAllFolders": "Згорнути всі папки", "expandAllFolders": "Розгорнути всі папки", - "createPlaylistFromQueue": "Створити $t(entity.playlist, {\"count\": 1}) з черги" + "createPlaylistFromQueue": "Створити плейлист з черги" }, "common": { "countSelected": "Вибрано: {{count}}", @@ -77,7 +77,7 @@ "configure": "Налаштувати", "confirm": "Підтвердити", "create": "Створити", - "currentSong": "Поточний $t(entity.track, {\"count\": 1})", + "currentSong": "Поточний трек", "decrease": "Зменшити", "delete": "Видалити", "descending": "За спаданням", @@ -127,7 +127,7 @@ "path": "Шлях", "playerMustBePaused": "Плеєр має бути призупинено", "preview": "Попередній перегляд", - "previousSong": "Попередній $t(entity.track, {\"count\": 1})", + "previousSong": "Попередній трек", "private": "Приватний", "public": "Публічний", "quit": "Вийти", @@ -231,7 +231,7 @@ "playlistWithCount_one": "{{count}} плейлист", "playlistWithCount_few": "{{count}} плейлисти", "playlistWithCount_many": "{{count}} плейлистів", - "smartPlaylist": "Розумний $t(entity.playlist, {\"count\": 1})", + "smartPlaylist": "Розумний плейлист", "track_one": "Трек", "track_few": "Треки", "track_many": "Треків", @@ -392,28 +392,30 @@ "input_jellyfinSignInMethod": "Увійти за допомогою", "input_jellyfinSignInMethodPassword": "Пароль", "input_jellyfinSignInMethodQuickConnect": "Швидке підключення", - "input_remoteUrlDescription": "Використовується замість URL-адреси для зовнішніх функцій, таких як спільні посилання. Залиште це поле порожнім, якщо ваш сервер не доступний за іншою адресою за межами вашої мережі." + "input_remoteUrlDescription": "Використовується замість URL-адреси для зовнішніх функцій, таких як спільні посилання. Залиште це поле порожнім, якщо ваш сервер не доступний за іншою адресою за межами вашої мережі.", + "input_enableAudiobooks": "Увімкнути аудіокниги", + "input_enableAudiobooksDescription": "Показати вміст аудіокниг із бібліотек розділу «Книги»" }, "largeFetchConfirmation": { "title": "Додати елементи до черги", "description": "Ця дія додасть усі елементи з поточного відфільтрованого подання" }, "addToPlaylist": { - "create": "Створити $t(entity.playlist, {\"count\": 1}) {{playlist}}", + "create": "Створити плейлист «{{playlist}}»", "input_playlists": "$t(entity.playlist, {\"count\": 2})", "input_skipDuplicates": "Пропускати дублікати", - "searchOrCreate": "Знайдіть $t(entity.playlist, {\"count\": 2}) або введіть назву, щоб створити новий", + "searchOrCreate": "Знайдіть плейлисти або введіть назву, щоб створити новий", "success": "Додано $t(entity.trackWithCount, {\"count\": {{message}} }). $t(entity.playlistWithCount, {\"count\": {{numOfPlaylists}} }) оновлено", - "title": "Додати в $t(entity.playlist, {\"count\": 1})", - "noneAdded": "$t(entity.playlist, {\"count\": 1}) «{{playlist}}»: не додано жодного треку" + "title": "Додати до плейлиста", + "noneAdded": "Плейлист «{{playlist}}»: не додано жодного треку" }, "createPlaylist": { "input_description": "$t(common.description)", "input_name": "$t(common.name)", "input_owner": "$t(common.owner)", "input_public": "Публічний", - "success": "$t(entity.playlist, {\"count\": 1}) успішно створено", - "title": "Створити $t(entity.playlist, {\"count\": 1})" + "success": "Плейлист успішно створено", + "title": "Створити плейлист" }, "createRadioStation": { "success": "Радіостанцію успішно створено", @@ -423,14 +425,14 @@ "input_streamUrl": "URL-адреса потоку" }, "deletePlaylist": { - "input_confirm": "Для підтвердження введіть назву ($t(entity.playlist, {\"count\": 1}))", - "success": "$t(entity.playlist, {\"count\": 1}) успішно видалено", - "title": "Видалити $t(entity.playlist, {\"count\": 1})" + "input_confirm": "Для підтвердження введіть назву плейлиста", + "success": "Плейлист успішно видалено", + "title": "Видалити плейлист" }, "editPlaylist": { "publicJellyfinNote": "З певної причини Jellyfin не повідомляє, чи є плейлист публічним. Якщо ви хочете, щоб він залишався публічним, залиште цей параметр вибраним", - "success": "$t(entity.playlist, {\"count\": 1}) успішно оновлено", - "title": "Редагувати $t(entity.playlist, {\"count\": 1})" + "success": "Плейлист успішно оновлено", + "title": "Редагувати плейлист" }, "lyricsExport": { "export": "Експортувати текст пісні", @@ -499,7 +501,7 @@ "description": "Усі елементи з поточної черги буде вилучено." }, "createPrefilledPlaylist": { - "title": "Створити $t(entity.playlist, {\"count\": 1}) з вибраних пісень" + "title": "Створити плейлист з вибраних пісень" } }, "player": { @@ -566,20 +568,20 @@ "groupingTypePrimary": "Основні типи релізів", "recentReleases": "Нові релізи", "viewDiscography": "Переглянути дискографію", - "relatedArtists": "Пов’язані $t(entity.artist, {\"count\": 2})", + "relatedArtists": "Пов’язані виконавці", "topSongs": "Найпопулярніші пісні", "topSongsCommunity": "Спільнота", "topSongsFrom": "Найпопулярніші пісні з {{title}}", "topSongsPersonal": "Особисте", "favoriteSongsFrom": "Улюблені пісні з {{title}}", "viewAll": "Переглянути все", - "viewAllTracks": "Переглянути всі $t(entity.track, {\"count\": 2})" + "viewAllTracks": "Переглянути всі треки" }, "albumArtistList": { "title": "$t(entity.albumArtist, {\"count\": 2})" }, "albumDetail": { - "moreFromArtist": "Ще від: $t(entity.artist, {\"count\": 1})", + "moreFromArtist": "Ще від цього виконавця", "moreFromGeneric": "Ще від {{item}}", "released": "Випущено" }, @@ -655,8 +657,8 @@ "playShuffled": "$t(player.shuffle)", "shareItem": "Поділитися елементом", "goTo": "Перейти до", - "goToAlbum": "Відкрити $t(entity.album, {\"count\": 1})", - "goToAlbumArtist": "Відкрити $t(entity.albumArtist, {\"count\": 1})", + "goToAlbum": "Відкрити альбом", + "goToAlbumArtist": "Перейти до виконавця альбому", "showDetails": "Відомості", "editMetadata": "Редагувати метадані" }, diff --git a/src/main/features/core/settings/index.ts b/src/main/features/core/settings/index.ts index 6dd166952..a0460aafb 100644 --- a/src/main/features/core/settings/index.ts +++ b/src/main/features/core/settings/index.ts @@ -1,4 +1,3 @@ -import type { TitleTheme } from '/@/shared/types/types'; import type { FSWatcher } from 'fs'; import { @@ -16,20 +15,21 @@ import { promises as fs, watch as fsWatch } from 'fs'; import path from 'path'; import log from '/@/main/logger'; +import { Platform, type TitleTheme } from '/@/shared/types/types'; const getFrame = () => { const isWindows = process.platform === 'win32'; const isMacOS = process.platform === 'darwin'; if (isWindows) { - return 'windows'; + return Platform.WINDOWS; } if (isMacOS) { - return 'macOS'; + return Platform.MACOS; } - return 'linux'; + return Platform.LINUX; }; const isDevelopment = process.env.NODE_ENV === 'development'; diff --git a/src/renderer/api/jellyfin/jellyfin-controller.ts b/src/renderer/api/jellyfin/jellyfin-controller.ts index 813783285..4fcc3e66c 100644 --- a/src/renderer/api/jellyfin/jellyfin-controller.ts +++ b/src/renderer/api/jellyfin/jellyfin-controller.ts @@ -28,6 +28,7 @@ import { Played, playlistListSortMap, ReplaceApiClientProps, + ServerListItem, ServerType, Song, SongListSort, @@ -215,6 +216,16 @@ const VERSION_INFO: VersionInfo = [ ], ]; +const isAudioItemType = (server: null | ServerListItem, type: string) => + type === 'Audio' || (server?.enableAudiobooks === true && type === 'AudioBook'); + +const isSupportedCollection = (server: null | ServerListItem, collectionType: string) => + collectionType === jfType._enum.collection.MUSIC || + (server?.enableAudiobooks === true && collectionType === jfType._enum.collection.BOOKS); + +const getSongItemTypes = (server: null | ServerListItem) => + server?.enableAudiobooks === true ? 'Audio,AudioBook' : 'Audio'; + const JF_FIELDS = { ALBUM_ARTIST_DETAIL: ['Genres', 'Overview', 'SortName', 'ProviderIds'], ALBUM_ARTIST_LIST: [ @@ -611,7 +622,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { EnableUserData: true, Fields: JF_FIELDS.SONG, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), ParentId: query.id, Recursive: true, SortBy: 'ParentIndexNumber,IndexNumber,SortName', @@ -800,7 +811,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { ArtistIds: query.artistId, Fields: JF_FIELDS.SONG, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), IsFavorite: true, Limit: query.limit, Recursive: true, @@ -847,7 +858,9 @@ export const JellyfinController: InternalControllerEndpoint = { throw new Error('Failed to get music folder list'); } - let items = musicFolderRes.body.Items.filter((item) => item.Type !== 'Audio'); + let items = musicFolderRes.body.Items.filter( + (item) => !isAudioItemType(apiClientProps.server, item.Type), + ); if (query.searchTerm) { items = filter(items, (item) => { @@ -856,7 +869,7 @@ export const JellyfinController: InternalControllerEndpoint = { } const folders = items - .filter((item) => item.Type !== 'Audio') + .filter((item) => !isAudioItemType(apiClientProps.server, item.Type)) .map((item) => jfNormalize.folder(item, apiClientProps.server)); const sortedFolders = orderBy(folders, [(v) => v.name.toLowerCase()], [sortOrder]); @@ -885,7 +898,9 @@ export const JellyfinController: InternalControllerEndpoint = { throw new Error('Failed to get music folder list'); } - let items = musicFolderRes.body.Items.filter((item) => item.Type !== 'Audio'); + let items = musicFolderRes.body.Items.filter( + (item) => !isAudioItemType(apiClientProps.server, item.Type), + ); if (query.searchTerm) { items = filter(items, (item) => { @@ -894,7 +909,7 @@ export const JellyfinController: InternalControllerEndpoint = { } const folders = items - .filter((item) => item.Type !== 'Audio') + .filter((item) => !isAudioItemType(apiClientProps.server, item.Type)) .map((item) => jfNormalize.folder( item as unknown as z.infer, @@ -973,12 +988,12 @@ export const JellyfinController: InternalControllerEndpoint = { const items = folderDetailRes.body.Items || []; let filteredFolders = items - .filter((item) => item.Type !== 'Audio') + .filter((item) => !isAudioItemType(apiClientProps.server, item.Type)) .map((item) => jfNormalize.folder(item, apiClientProps.server)); let filteredSongs = items .filter( (item) => - item.Type === 'Audio' && + isAudioItemType(apiClientProps.server, item.Type) && (item as unknown as z.infer).MediaSources, ) .map((item) => @@ -1120,8 +1135,8 @@ export const JellyfinController: InternalControllerEndpoint = { throw new Error('Failed to get genre list'); } - const musicFolders = res.body.Items.filter( - (folder) => folder.CollectionType === jfType._enum.collection.MUSIC, + const musicFolders = res.body.Items.filter((folder) => + isSupportedCollection(apiClientProps.server, folder.CollectionType), ); return { @@ -1207,7 +1222,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { // XXX: No fields are required for only IDs, which saves processing time between // the Jellyfin server query, network (MBs vs KBs), and in-app parsing. - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), UserId: apiClientProps.server?.userId, }, }); @@ -1235,7 +1250,7 @@ export const JellyfinController: InternalControllerEndpoint = { }, query: { Fields: JF_FIELDS.PLAYLIST_DETAIL, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), UserId: apiClientProps.server?.userId, }, }); @@ -1276,7 +1291,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { Fields: JF_FIELDS.SONG, GenreIds: query.genre ? query.genre : undefined, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), IsPlayed: query.played === Played.Never ? false @@ -1454,6 +1469,8 @@ export const JellyfinController: InternalControllerEndpoint = { let totalRecordCount = 0; const batchSize = 50; + const includeItemTypes = getSongItemTypes(apiClientProps.server); + // Handle albumIds fetches in batches to prevent HTTP 414 errors if (query.albumIds && query.albumIds.length > batchSize) { const albumIdBatches = chunk(query.albumIds, batchSize); @@ -1470,7 +1487,7 @@ export const JellyfinController: InternalControllerEndpoint = { ArtistIds: artistIdsFilter, Fields: JF_FIELDS.SONG, GenreIds: query.genreIds?.join(','), - IncludeItemTypes: 'Audio', + IncludeItemTypes: includeItemTypes, IsFavorite: query.favorite, Limit: query.limit === -1 ? undefined : query.limit, ParentId: getLibraryId(query.musicFolderId), @@ -1505,7 +1522,7 @@ export const JellyfinController: InternalControllerEndpoint = { ArtistIds: artistIdsFilter, Fields: JF_FIELDS.SONG, GenreIds: query.genreIds?.join(','), - IncludeItemTypes: 'Audio', + IncludeItemTypes: includeItemTypes, IsFavorite: query.favorite, Limit: query.limit === -1 ? undefined : query.limit, ParentId: getLibraryId(query.musicFolderId), @@ -1653,9 +1670,14 @@ export const JellyfinController: InternalControllerEndpoint = { return { boolTags: undefined, enumTags: undefined, excluded: { album: [], song: [] } }; } + const includeItemTypes = + query.type === LibraryItem.SONG + ? getSongItemTypes(apiClientProps.server) + : 'MusicAlbum'; + const res = await jfApiClient(apiClientProps).getFilterList({ query: { - IncludeItemTypes: query.type === LibraryItem.SONG ? 'Audio' : 'MusicAlbum', + IncludeItemTypes: includeItemTypes, ParentId: query.folder, UserId: apiClientProps.server?.userId ?? '', }, @@ -1668,7 +1690,7 @@ export const JellyfinController: InternalControllerEndpoint = { const studioRes = await jfApiClient(apiClientProps).getStudioList({ query: { EnableTotalRecordCount: true, - IncludeItemTypes: query.type === LibraryItem.SONG ? 'Audio' : 'MusicAlbum', + IncludeItemTypes: includeItemTypes, ParentId: query.folder, }, }); @@ -1717,7 +1739,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { ArtistIds: query.artistId, Fields: JF_FIELDS.SONG, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), Limit: query.limit, Recursive: true, SortBy: @@ -1840,7 +1862,7 @@ export const JellyfinController: InternalControllerEndpoint = { }, query: { Fields: JF_FIELDS.SONG, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), UserId: apiClientProps.server?.userId, }, }); @@ -2007,8 +2029,9 @@ export const JellyfinController: InternalControllerEndpoint = { jfApiClient(apiClientProps).scrobbleProgress({ body: { + EventName: query.event, ItemId: query.id, - NowPlayingQueue: nowPlayingQueue, + NowPlayingQueue: query.event === 'timeupdate' ? undefined : nowPlayingQueue, PositionTicks: position, }, }); @@ -2082,7 +2105,7 @@ export const JellyfinController: InternalControllerEndpoint = { query: { EnableTotalRecordCount: true, Fields: JF_FIELDS.SONG, - IncludeItemTypes: 'Audio', + IncludeItemTypes: getSongItemTypes(apiClientProps.server), Limit: query.songLimit, Recursive: true, SearchTerm: query.query, @@ -2146,8 +2169,8 @@ export const JellyfinController: InternalControllerEndpoint = { throw new Error('Failed to get music folders'); } - musicFolderIds = res.body.Items.filter( - (folder) => folder.CollectionType === jfType._enum.collection.MUSIC, + musicFolderIds = res.body.Items.filter((folder) => + isSupportedCollection(apiClientProps.server, folder.CollectionType), ).map((folder) => folder.Id); } diff --git a/src/renderer/components/item-image/item-image.tsx b/src/renderer/components/item-image/item-image.tsx index 6b7cd5cff..51cd80414 100644 --- a/src/renderer/components/item-image/item-image.tsx +++ b/src/renderer/components/item-image/item-image.tsx @@ -43,12 +43,14 @@ const BaseItemImage = ( id?: null | string; itemType: LibraryItem; serverId?: null | string; + size?: number; src?: null | string; thumbHash?: null | string; type?: keyof z.infer['imageRes']; }, ) => { - const { blurHash, dominantColor, explicitStatus, serverId, src, thumbHash, ...rest } = props; + const { blurHash, dominantColor, explicitStatus, serverId, size, src, thumbHash, ...rest } = + props; const { blurExplicitImages } = useGeneralSettings(); const imagePlaceholderPriority = useImagePlaceholderPriority(); const hashUrl = useImageHashUrl(thumbHash, blurHash, dominantColor, imagePlaceholderPriority); @@ -58,6 +60,7 @@ const BaseItemImage = ( imageUrl: src, itemType: props.itemType, serverId: serverId || undefined, + size, type: props.type, }); @@ -66,6 +69,7 @@ const BaseItemImage = ( imageUrl: src, itemType: props.itemType, serverId: serverId || undefined, + size, type: props.type, }); diff --git a/src/renderer/components/item-list/item-table-list/album-group-header.tsx b/src/renderer/components/item-list/item-table-list/album-group-header.tsx index 542572646..ffce196b5 100644 --- a/src/renderer/components/item-list/item-table-list/album-group-header.tsx +++ b/src/renderer/components/item-list/item-table-list/album-group-header.tsx @@ -174,9 +174,9 @@ export const AlbumGroupHeader = ({ enableViewport={false} id={song?.imageId} itemType={LibraryItem.SONG} + size={albumImageSize} src={song?.imageUrl} thumbHash={song?.thumbHash} - type="table" /> {isImageHovered && onPlay && (
diff --git a/src/renderer/features/albums/components/album-detail-header.tsx b/src/renderer/features/albums/components/album-detail-header.tsx index eb4d2fc63..f4b24932c 100644 --- a/src/renderer/features/albums/components/album-detail-header.tsx +++ b/src/renderer/features/albums/components/album-detail-header.tsx @@ -135,7 +135,7 @@ export const AlbumDetailHeader = forwardRef((_props, ref) => { album.originalDate && album.originalDate !== album.releaseDate; const originalYearDifferentFromRelease = - album.originalYear > 0 && + album.originalYear && album.releaseYear != null && album.originalYear !== album.releaseYear; @@ -155,7 +155,7 @@ export const AlbumDetailHeader = forwardRef((_props, ref) => { id: 'originalDate', value: `${formatPartialIsoDateUTC(album.originalDate)}`, }); - } else if (album.originalYear > 0 && originalYearDifferentFromRelease) { + } else if (album.originalYear && originalYearDifferentFromRelease) { items.push({ id: 'originalYear', value: `${album.originalYear}`, diff --git a/src/renderer/features/player/components/audio-players.tsx b/src/renderer/features/player/components/audio-players.tsx index 17e98fcc0..fede7c5a8 100644 --- a/src/renderer/features/player/components/audio-players.tsx +++ b/src/renderer/features/player/components/audio-players.tsx @@ -20,6 +20,7 @@ import { InitialTimestampRestoreHook, QueueRestoreTimestampHook, } from '/@/renderer/features/player/hooks/use-queue-restore'; +import { ResumePositionHook } from '/@/renderer/features/player/hooks/use-resume-position'; import { ScrobbleHook } from '/@/renderer/features/player/hooks/use-scrobble'; import { UpdateCurrentSongHook } from '/@/renderer/features/player/hooks/use-update-current-song'; import { useWebAudio } from '/@/renderer/features/player/hooks/use-webaudio'; @@ -147,6 +148,7 @@ export const AudioPlayers = () => { + diff --git a/src/renderer/features/player/hooks/use-resume-position.ts b/src/renderer/features/player/hooks/use-resume-position.ts new file mode 100644 index 000000000..dab60d830 --- /dev/null +++ b/src/renderer/features/player/hooks/use-resume-position.ts @@ -0,0 +1,42 @@ +import { usePlayerEvents } from '/@/renderer/features/player/audio-player/hooks/use-player-events'; +import { usePlayerActions, usePlayerStore } from '/@/renderer/store'; +import { PlayerStatus } from '/@/shared/types/types'; + +// Seeks to the server-stored resume position when a track starts playing. +// Only Jellyfin AudioBook items support resuming. The seek is delayed, as in +// use-queue-restore, so the engine has loaded the new track first. +export const useResumePosition = () => { + const { mediaSeekToTimestamp } = usePlayerActions(); + + usePlayerEvents( + { + onCurrentSongChange: (properties) => { + const song = properties.song; + const resumeSec = (song?.resumePositionMs ?? 0) / 1000; + + if (resumeSec <= 0) { + return; + } + + setTimeout(() => { + const state = usePlayerStore.getState(); + + if ( + state.getCurrentSong()?._uniqueId !== song?._uniqueId || + state.player.status !== PlayerStatus.PLAYING + ) { + return; + } + + mediaSeekToTimestamp(resumeSec); + }, 100); + }, + }, + [mediaSeekToTimestamp], + ); +}; + +export const ResumePositionHook = () => { + useResumePosition(); + return null; +}; diff --git a/src/renderer/features/player/hooks/use-scrobble.ts b/src/renderer/features/player/hooks/use-scrobble.ts index a3d8b58e4..fa99e6906 100644 --- a/src/renderer/features/player/hooks/use-scrobble.ts +++ b/src/renderer/features/player/hooks/use-scrobble.ts @@ -62,14 +62,14 @@ of the track (position before SCROBBLE_TRACK_BEGIN_SEC), e.g. seek-to-start or restart-from-near-zero. Song change and repeat still reset for a new play-through. Jellyfin progress APIs still use playback position (ticks), not listen time: - - Periodic timeupdate while playing + - Periodic timeupdate while playing resumable media - timeupdate on seek - pause / unpause Other events: - - When the song changes: sends 'stop' for the previous non-Jellyfin track; - sends 'start' when the new track is playing; clears submission flag and - listen accumulator for the new track. + - When the song changes: sends 'stop' for the previous track (not on Jellyfin + unless the song is resumable); sends 'start' when the new track is playing; + clears submission flag and listen accumulator for the new track. - When the song is restarted (near 0 after 10s+): clears submission flag and listen accumulator. @@ -251,6 +251,8 @@ export const useScrobble = () => { const currentSong = usePlayerStore.getState().getCurrentSong(); const mediaType = currentSong?._itemType.includes('song') ? 'song' : 'podcast'; const useTicks = currentSong?._serverType === ServerType.JELLYFIN; + const isJellyfinResumable = + currentSong?._serverType === ServerType.JELLYFIN && currentSong.isResumable; const currentStatus = usePlayerStore.getState().player.status; const currentTime = properties.timestamp; const previousTime = prev.timestamp; @@ -305,36 +307,34 @@ export const useScrobble = () => { } } - // Send progress events every 10 seconds - // if (hasPlaybackReport) { - // const timeSinceLastProgress = currentTime - lastProgressEventRef.current; - // if (timeSinceLastProgress >= 10) { - // sendScrobble.mutate( - // { - // apiClientProps: { serverId: serverId || '' }, - // query: { - // albumId: currentSong.albumId, - // event: 'timeupdate', - // id: currentSong.id, - // mediaType: mediaType, - // playbackRate, - // position: getPositionValue(currentTime, useTicks), - // submission: false, - // }, - // }, - // { - // onSuccess: () => { - // logFn.debug("Scrobbled a timeupdate event", { - // meta: { - // id: currentSong.id, - // }, - // }); - // }, - // }, - // ); - // lastProgressEventRef.current = currentTime; - // } - // } + // Send progress events every 10 seconds for resumable media + if (isJellyfinResumable) { + const timeSinceLastProgress = currentTime - lastProgressEventRef.current; + if (timeSinceLastProgress >= 10) { + sendScrobble.mutate( + { + apiClientProps: { serverId: currentSong._serverId || '' }, + query: { + albumId: currentSong.albumId, + event: 'timeupdate', + id: currentSong.id, + mediaType: mediaType, + playbackRate, + position: getPositionValue(currentTime, useTicks), + submission: false, + }, + }, + { + onSuccess: () => { + logger.debug('Scrobbled a timeupdate event', { + id: currentSong.id, + }); + }, + }, + ); + lastProgressEventRef.current = currentTime; + } + } // Check if we should submit scrobble based on listened time if (!isCurrentSongScrobbledRef.current) { @@ -443,34 +443,12 @@ export const useScrobble = () => { songChangeTimeoutRef.current = setTimeout(() => { const currentStatus = usePlayerStore.getState().player.status; - // Send start scrobble when song changes and the new song is playing - if (currentStatus === PlayerStatus.PLAYING && currentSong?.id) { - sendScrobble.mutate( - { - apiClientProps: { serverId: currentSong._serverId || '' }, - query: { - albumId: currentSong.albumId, - event: 'start', - id: currentSong.id, - mediaType: mediaType, - playbackRate: playbackRate, - position: 0, - submission: false, - }, - }, - { - onSuccess: () => { - logger.info('Scrobbled a start event', { - id: currentSong.id, - }); - }, - }, - ); - } - - // Jellyfin does not need a stop event when advancing to another song. - const skipStopScrobble = previousSong?._serverType === ServerType.JELLYFIN; + // Jellyfin does not need a stop event when advancing to another song, + // except for resumable media where the position is stored server-side. + const skipStopScrobble = + previousSong?._serverType === ServerType.JELLYFIN && !previousSong.isResumable; + // Send stop first to avoid Jellyfin clearing the now-playing report for the new song if (previousSong?.id && !skipStopScrobble) { sendScrobble.mutate( { @@ -497,6 +475,31 @@ export const useScrobble = () => { }, ); } + + // Send start scrobble when song changes and the new song is playing + if (currentStatus === PlayerStatus.PLAYING && currentSong?.id) { + sendScrobble.mutate( + { + apiClientProps: { serverId: currentSong._serverId || '' }, + query: { + albumId: currentSong.albumId, + event: 'start', + id: currentSong.id, + mediaType: mediaType, + playbackRate: playbackRate, + position: 0, + submission: false, + }, + }, + { + onSuccess: () => { + logger.info('Scrobbled a start event', { + id: currentSong.id, + }); + }, + }, + ); + } }, 2000); previousSongRef.current = currentSong; diff --git a/src/renderer/features/playlists/utils.ts b/src/renderer/features/playlists/utils.ts index e3910d658..cfaa51fed 100644 --- a/src/renderer/features/playlists/utils.ts +++ b/src/renderer/features/playlists/utils.ts @@ -41,7 +41,7 @@ export function playlistSongsToAlbums(songs: Song[]): PlaylistAlbumRow[] { missing: null, name: song.album ?? '', originalDate: null, - originalYear: 0, + originalYear: null, participants: song.participants, peak: null, playCount: null, diff --git a/src/renderer/features/servers/components/add-server-form.tsx b/src/renderer/features/servers/components/add-server-form.tsx index 760bf684d..93bc7aab0 100644 --- a/src/renderer/features/servers/components/add-server-form.tsx +++ b/src/renderer/features/servers/components/add-server-form.tsx @@ -118,6 +118,7 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => { const form = useForm({ initialValues: { auth: isLegacyAuth() ? AuthMode.LEGACY : undefined, + enableAudiobooks: undefined, name: (localSettings ? localSettings.env.SERVER_NAME : window.SERVER_NAME) || 'My Server', password: '', @@ -174,6 +175,10 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => { serverItem.preferInstantMix = form.values.preferInstantMix; } + if (form.values.enableAudiobooks !== undefined) { + serverItem.enableAudiobooks = form.values.enableAudiobooks; + } + addServer(serverItem); setCurrentServer(serverItem); closeAllModals(); @@ -239,6 +244,10 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => { serverItem.preferInstantMix = values.preferInstantMix; } + if (values.enableAudiobooks !== undefined) { + serverItem.enableAudiobooks = values.enableAudiobooks; + } + if (values.savePassword !== undefined) { serverItem.savePassword = values.savePassword; } @@ -438,17 +447,30 @@ export const AddServerForm = ({ onCancel }: AddServerFormProps) => { /> )} {form.values.type === ServerType.JELLYFIN && ( - + <> + + + )} {showQuickConnect && ( )} {form.values.type === ServerType.JELLYFIN && ( - + <> + + + )} {t('common.cancel')} diff --git a/src/renderer/features/settings/components/advanced/logger-settings.tsx b/src/renderer/features/settings/components/advanced/logger-settings.tsx index 0f9d45f1e..e2224c96a 100644 --- a/src/renderer/features/settings/components/advanced/logger-settings.tsx +++ b/src/renderer/features/settings/components/advanced/logger-settings.tsx @@ -80,6 +80,7 @@ export const LoggerSettings = memo(() => { rendererSettings: getRendererSettingsForExport(), server: currentServer ? { + enableAudiobooks: currentServer.enableAudiobooks, isAdmin: currentServer.isAdmin, isLocalUrl: isLocalUrl(currentServer.url), musicFolderId: currentServer.musicFolderId, diff --git a/src/renderer/features/shared/components/table-config.tsx b/src/renderer/features/shared/components/table-config.tsx index 641f8acbe..fbca4b1d1 100644 --- a/src/renderer/features/shared/components/table-config.tsx +++ b/src/renderer/features/shared/components/table-config.tsx @@ -82,7 +82,6 @@ export const TableConfig = ({ const albumGroupVerticalLayout = useSettingsStore( (state) => state.general.albumGroupVerticalLayout, ); - const imageResTable = useSettingsStore((state) => state.general.imageRes.table); const { setList, setSettings } = useSettingsStoreActions(); const [albumGroupOpen, setAlbumGroupOpen] = useState(false); @@ -142,14 +141,7 @@ export const TableConfig = ({ ), ); setSettings({ - general: { - albumGroupImageSize: size, - // Source table art must be at least as - // large as the displayed album image. - ...(size >= imageResTable - ? { imageRes: { table: size } } - : {}), - }, + general: { albumGroupImageSize: size }, }); }} rightSection={ @@ -392,7 +384,6 @@ export const TableConfig = ({ albumGroupImageSize, albumGroupShowFavoriteRating, albumGroupVerticalLayout, - imageResTable, setSettings, ]); diff --git a/src/renderer/features/sidebar/components/collapsed-sidebar.tsx b/src/renderer/features/sidebar/components/collapsed-sidebar.tsx index bfcc6d994..76c3c86a3 100644 --- a/src/renderer/features/sidebar/components/collapsed-sidebar.tsx +++ b/src/renderer/features/sidebar/components/collapsed-sidebar.tsx @@ -11,6 +11,7 @@ import { CollapsedSidebarButton } from '/@/renderer/features/sidebar/components/ import { CollapsedSidebarItem } from '/@/renderer/features/sidebar/components/collapsed-sidebar-item'; import { getCollectionTo } from '/@/renderer/features/sidebar/components/sidebar-collection-list'; import { SidebarIcon } from '/@/renderer/features/sidebar/components/sidebar-icon'; +import { CollapsedSidebarPlaylistList } from '/@/renderer/features/sidebar/components/sidebar-playlist-list'; import { AppMenu } from '/@/renderer/features/titlebar/components/app-menu'; import { AppRoute } from '/@/renderer/router/routes'; import { @@ -18,6 +19,7 @@ import { useCollections, useSidebarCollapsedNavigation, useSidebarItems, + useSidebarPlaylistList, useWindowSettings, } from '/@/renderer/store'; import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu'; @@ -36,6 +38,7 @@ export const CollapsedSidebar = () => { const { windowBarStyle } = useWindowSettings(); const sidebarCollapsedNavigation = useSidebarCollapsedNavigation(); const sidebarItems = useSidebarItems(); + const sidebarPlaylistList = useSidebarPlaylistList(); const { isScanning } = useScanStatus(); const translatedSidebarItemMap = useMemo( @@ -174,6 +177,7 @@ export const CollapsedSidebar = () => { /> ), )} + {sidebarPlaylistList && } ); diff --git a/src/renderer/features/sidebar/components/sidebar-playlist-list.module.css b/src/renderer/features/sidebar/components/sidebar-playlist-list.module.css index 7134c543e..11dd89ac1 100644 --- a/src/renderer/features/sidebar/components/sidebar-playlist-list.module.css +++ b/src/renderer/features/sidebar/components/sidebar-playlist-list.module.css @@ -146,3 +146,40 @@ min-width: 3rem; height: 3rem; } + +.collapsed-list { + display: flex; + flex-direction: column; + gap: var(--theme-spacing-xs); + padding: var(--theme-spacing-sm) 0; +} + +.row-icon-only { + justify-content: center; + padding: var(--theme-spacing-xs) 0; +} + +.icon-only-image { + position: relative; + width: 3rem; + height: 3rem; + border-radius: var(--theme-radius-md); + transition: transform 0.2s ease; +} + +.row-icon-only:hover .icon-only-image { + transform: scale(1.08); +} + +.icon-only-image-active { + outline: 2px solid var(--theme-colors-primary); + outline-offset: 2px; +} + +.collapsed-header { + padding: 0 0.3rem; +} + +.collapsed-header:hover > * { + color: var(--theme-colors-foreground); +} diff --git a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx index 0c5ed8fa5..d922fc328 100644 --- a/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx +++ b/src/renderer/features/sidebar/components/sidebar-playlist-list.tsx @@ -6,15 +6,22 @@ import { createContext, memo, MouseEvent, useCallback, useContext, useMemo, useS import { useTranslation } from 'react-i18next'; import { generatePath, Link } from 'react-router'; +import collapsedSidebarItemStyles from './collapsed-sidebar-item.module.css'; import styles from './sidebar-playlist-list.module.css'; import { ItemImage, useItemImageUrl } from '/@/renderer/components/item-image/item-image'; +import imageColumnStyles from '/@/renderer/components/item-list/item-table-list/columns/image-column.module.css'; import { ContextMenuController } from '/@/renderer/features/context-menu/context-menu-controller'; import { usePlayer } from '/@/renderer/features/player/context/player-context'; import { playlistsQueries } from '/@/renderer/features/playlists/api/playlists-api'; import { openCreatePlaylistModal } from '/@/renderer/features/playlists/components/create-playlist-form'; import { useIsMutatingSidebarPlaylistFolderMove } from '/@/renderer/features/playlists/mutations/sidebar-playlist-folder-move-mutation'; import { ItemRowPlayControls } from '/@/renderer/features/shared/components/item-row-play-controls'; +import { PlayButton } from '/@/renderer/features/shared/components/play-button'; +import { + LONG_PRESS_PLAY_BEHAVIOR, + PlayTooltip, +} from '/@/renderer/features/shared/components/play-button-group'; import { collectFolderPaths, PlaylistFolderDragExpandProvider, @@ -32,6 +39,7 @@ import { useCurrentServer, useCurrentServerId, usePermissions, + usePlayButtonBehavior, useSidebarPlaylistListFilterRegex, useSidebarPlaylistMode, useSidebarPlaylistSorting, @@ -42,10 +50,12 @@ import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { animationProps } from '/@/shared/components/animations/animation-props'; import { animationVariants } from '/@/shared/components/animations/animation-variants'; import { ButtonProps } from '/@/shared/components/button/button'; +import { Divider } from '/@/shared/components/divider/divider'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { LoadingOverlay } from '/@/shared/components/loading-overlay/loading-overlay'; import { Text } from '/@/shared/components/text/text'; +import { Tooltip } from '/@/shared/components/tooltip/tooltip'; import { useLocalStorage } from '/@/shared/hooks/use-local-storage'; import { LibraryItem, @@ -99,6 +109,8 @@ export const useSidebarPlaylistAddDragMonitor = () => { }; export interface PlaylistRowButtonProps extends Omit { + // Collapsed sidebar: image only, name in a tooltip, no play controls + iconOnly?: boolean; item: Playlist; name: string; onContextMenu: (e: MouseEvent, item: Playlist) => void; @@ -107,7 +119,7 @@ export interface PlaylistRowButtonProps extends Omit { + ({ iconOnly, item, name, onContextMenu, onReorder, to }: PlaylistRowButtonProps) => { const url = { pathname: generatePath(AppRoute.PLAYLISTS_DETAIL_SONGS, { playlistId: to }), state: { item }, @@ -255,6 +267,7 @@ export const PlaylistRowButton = memo( const serverId = useCurrentServerId(); const permissions = usePermissions(); + const playButtonBehavior = usePlayButtonBehavior(); const handlePlay = useCallback( (id: string, type: Play) => { @@ -276,9 +289,10 @@ export const PlaylistRowButton = memo( {...animationProps.fadeIn} animate={isDimmed ? 'hidden' : 'show'} className={clsx(styles.row, { - [styles.rowCompact]: isCompact, + [styles.rowCompact]: isCompact && !iconOnly, [styles.rowDraggedOver]: isDraggedOver && !isSmartPlaylist, - [styles.rowHover]: isHovered, + [styles.rowHover]: isHovered && !iconOnly, + [styles.rowIconOnly]: iconOnly, })} initial={false} onContextMenu={(e: MouseEvent) => { @@ -291,7 +305,42 @@ export const PlaylistRowButton = memo( to={url} variants={playlistRowDimVariants} > - {isCompact ? ( + {iconOnly ? ( + +
+ + {isHovered && ( +
+ + handlePlay(to, playButtonBehavior)} + onLongPress={() => + handlePlay( + to, + LONG_PRESS_PLAY_BEHAVIOR[playButtonBehavior], + ) + } + /> + +
+ )} +
+
+ ) : isCompact ? ( <> { - const player = usePlayer(); - const { t } = useTranslation(); +const handlePlaylistContextMenu = (e: MouseEvent, playlist: Playlist) => { + e.preventDefault(); + e.stopPropagation(); + ContextMenuController.call({ + cmd: { items: [playlist], type: LibraryItem.PLAYLIST }, + event: e, + }); +}; + +const useSidebarPlaylistItems = (scope: 'owned' | 'shared') => { const server = useCurrentServer(); const sidebarPlaylistSorting = useSidebarPlaylistSorting(); const filterRegex = useSidebarPlaylistListFilterRegex(); @@ -400,35 +456,14 @@ export const SidebarPlaylistList = () => { }), ); - const handlePlayPlaylist = useCallback( - (id: string, playType: Play) => { - player.addToQueueByFetch(server.id, [id], LibraryItem.PLAYLIST, playType); - }, - [player, server.id], - ); - - const handleContextMenu = useCallback( - (e: MouseEvent, playlist: Playlist) => { - e.preventDefault(); - e.stopPropagation(); - ContextMenuController.call({ - cmd: { items: [playlist], type: LibraryItem.PLAYLIST }, - event: e, - }); - }, - [], - ); - const [playlistOrder, setPlaylistOrder] = useLocalStorage({ defaultValue: [], - key: getPlaylistOrderKey(server.id, 'owned'), + key: getPlaylistOrderKey(server.id, scope), }); - const playlistItems = useMemo(() => { - const base = { handlePlay: handlePlayPlaylist }; - + const items = useMemo(() => { if (!server?.type || !server?.username || !playlistsQuery.data?.items) { - return { ...base, items: playlistsQuery.data?.items }; + return playlistsQuery.data?.items; } let regex: null | RegExp = null; @@ -440,35 +475,35 @@ export const SidebarPlaylistList = () => { } } - const ownedPlaylistItems: Array = []; + const scopedPlaylistItems: Array = []; for (const playlist of playlistsQuery.data?.items ?? []) { - if (!playlist.owner || playlist.owner === server.username) { + const isOwned = !playlist.owner || playlist.owner === server.username; + if (isOwned === (scope === 'owned')) { // Filter out playlists that match the regex if (regex && regex.test(playlist.name)) { continue; } - ownedPlaylistItems.push(playlist); + scopedPlaylistItems.push(playlist); } } - if (!ownedPlaylistItems || !sidebarPlaylistSorting || !playlistOrder) { - return { ...base, items: ownedPlaylistItems }; + if (!scopedPlaylistItems || !sidebarPlaylistSorting || !playlistOrder) { + return scopedPlaylistItems; } // Apply saved order, include only playlists that still exist - const idMap = new Map(ownedPlaylistItems.map((it) => [it.id, it])); + const idMap = new Map(scopedPlaylistItems.map((it) => [it.id, it])); const ordered = playlistOrder .map((id) => idMap.get(id)) .filter((it): it is Playlist => it !== undefined); // Append any new items that weren't in saved order - const remaining = ownedPlaylistItems.filter((it) => !playlistOrder.includes(it.id)); - const newPlaylistItems = [...ordered, ...remaining]; - return { ...base, items: newPlaylistItems }; + const remaining = scopedPlaylistItems.filter((it) => !playlistOrder.includes(it.id)); + return [...ordered, ...remaining]; }, [ - handlePlayPlaylist, playlistsQuery.data?.items, + scope, server.type, server.username, sidebarPlaylistSorting, @@ -481,9 +516,9 @@ export const SidebarPlaylistList = () => { targetId: string, edge: 'bottom' | 'top' | null, ) => { - if (!playlistItems?.items || !edge) return; + if (!items || !edge) return; - const currentIds = playlistItems.items.map((p) => p.id); + const currentIds = items.map((p) => p.id); const targetIndex = currentIds.indexOf(targetId); if (targetIndex === -1) return; @@ -510,6 +545,15 @@ export const SidebarPlaylistList = () => { setPlaylistOrder(reorderedIds); }; + return { handleReorder, items }; +}; + +export const SidebarPlaylistList = () => { + const { t } = useTranslation(); + const server = useCurrentServer(); + const playlistItems = useSidebarPlaylistItems('owned'); + const { handleReorder } = playlistItems; + const handleCreatePlaylistModal = (e: MouseEvent) => { openCreatePlaylistModal(server, e); }; @@ -630,7 +674,7 @@ export const SidebarPlaylistList = () => { allPlaylists={playlistItems?.items ?? []} expandedSet={expandedSet} navigation={navigation} - onContextMenu={handleContextMenu} + onContextMenu={handlePlaylistContextMenu} onReorder={handleReorder} onToggleFolder={toggle} /> @@ -641,136 +685,9 @@ export const SidebarPlaylistList = () => { }; export const SidebarSharedPlaylistList = () => { - const player = usePlayer(); const { t } = useTranslation(); - const server = useCurrentServer(); - const sidebarPlaylistSorting = useSidebarPlaylistSorting(); - const filterRegex = useSidebarPlaylistListFilterRegex(); - - const playlistsQuery = useQuery( - playlistsQueries.list({ - query: { - sortBy: PlaylistListSort.NAME, - sortOrder: SortOrder.ASC, - startIndex: 0, - }, - serverId: server?.id, - }), - ); - - const handlePlayPlaylist = useCallback( - (id: string, playType: Play) => { - if (!server?.id) return; - player.addToQueueByFetch(server.id, [id], LibraryItem.PLAYLIST, playType); - }, - [player, server.id], - ); - - const handleContextMenu = useCallback( - (e: MouseEvent, playlist: Playlist) => { - e.preventDefault(); - e.stopPropagation(); - ContextMenuController.call({ - cmd: { - items: [playlist], - type: LibraryItem.PLAYLIST, - }, - event: e, - }); - }, - [], - ); - - const [playlistOrder, setPlaylistOrder] = useLocalStorage({ - defaultValue: [], - key: getPlaylistOrderKey(server.id, 'shared'), - }); - - const playlistItems = useMemo(() => { - const base = { handlePlay: handlePlayPlaylist }; - - if (!server?.type || !server?.username || !playlistsQuery.data?.items) { - return { ...base, items: playlistsQuery.data?.items }; - } - - let regex: null | RegExp = null; - if (filterRegex) { - try { - regex = new RegExp(filterRegex, 'i'); - } catch { - // Invalid regex, ignore filtering - } - } - - const sharedPlaylistItems: Array = []; - - for (const playlist of playlistsQuery.data?.items ?? []) { - if (playlist.owner && playlist.owner !== server.username) { - // Filter out playlists that match the regex - if (regex && regex.test(playlist.name)) { - continue; - } - sharedPlaylistItems.push(playlist); - } - } - - if (!sharedPlaylistItems || !sidebarPlaylistSorting || !playlistOrder) { - return { ...base, items: sharedPlaylistItems }; - } - - // Apply saved order, include only playlists that still exist - const idMap = new Map(sharedPlaylistItems.map((it) => [it.id, it])); - const ordered = playlistOrder - .map((id) => idMap.get(id)) - .filter((it): it is Playlist => it !== undefined); - - // Append any new items that weren't in saved order - const remaining = sharedPlaylistItems.filter((it) => !playlistOrder.includes(it.id)); - const newPlaylistItems = [...ordered, ...remaining]; - return { ...base, items: newPlaylistItems }; - }, [ - handlePlayPlaylist, - playlistsQuery.data?.items, - server.type, - server.username, - sidebarPlaylistSorting, - playlistOrder, - filterRegex, - ]); - - const handleReorder = ( - sourceIds: string[], - targetId: string, - edge: 'bottom' | 'top' | null, - ) => { - if (!playlistItems?.items || !edge) return; - - const currentIds = playlistItems.items.map((p) => p.id); - const targetIndex = currentIds.indexOf(targetId); - if (targetIndex === -1) return; - - const idsWithoutSources = currentIds.filter((id) => !sourceIds.includes(id)); - - const sourcesBeforeTarget = sourceIds.filter((id) => { - const sourceIndex = currentIds.indexOf(id); - return sourceIndex !== -1 && sourceIndex < targetIndex; - }).length; - - const insertIndexInFiltered = - edge === 'top' - ? targetIndex - sourcesBeforeTarget - : targetIndex - sourcesBeforeTarget + 1; - - const insertIndex = Math.max(0, Math.min(insertIndexInFiltered, idsWithoutSources.length)); - - const reorderedIds = [ - ...idsWithoutSources.slice(0, insertIndex), - ...sourceIds, - ...idsWithoutSources.slice(insertIndex), - ]; - - setPlaylistOrder(reorderedIds); - }; + const playlistItems = useSidebarPlaylistItems('shared'); + const { handleReorder } = playlistItems; const folderViewState = usePlaylistFolderViewState(playlistItems?.items ?? []); const navigation = usePlaylistNavigationState(); @@ -819,7 +736,7 @@ export const SidebarSharedPlaylistList = () => { allPlaylists={playlistItems?.items ?? []} expandedSet={expandedSet} navigation={navigation} - onContextMenu={handleContextMenu} + onContextMenu={handlePlaylistContextMenu} onReorder={handleReorder} onToggleFolder={toggle} /> @@ -828,3 +745,75 @@ export const SidebarSharedPlaylistList = () => { ); }; + +export const CollapsedSidebarPlaylistList = () => { + const { t } = useTranslation(); + const server = useCurrentServer(); + const [isOpen, setIsOpen] = useState(true); + const isAddDragActive = useSidebarPlaylistAddDragMonitor(); + const owned = useSidebarPlaylistItems('owned'); + const shared = useSidebarPlaylistItems('shared'); + + return ( + +
+ + + + {t('page.sidebar.playlists')} + + + + setIsOpen((open) => !open)} + size="xs" + tooltip={{ label: t(isOpen ? 'common.collapse' : 'common.expand') }} + variant="subtle" + /> + openCreatePlaylistModal(server, e)} + size="xs" + tooltip={{ label: t('action.createPlaylist') }} + variant="subtle" + /> + + {isOpen && ( + <> + {owned.items?.map((item) => ( + + ))} + {shared.items && shared.items.length > 0 && } + {shared.items?.map((item) => ( + + ))} + + )} +
+
+ ); +}; diff --git a/src/renderer/features/sidebar/components/sidebar.tsx b/src/renderer/features/sidebar/components/sidebar.tsx index 777b19e6b..e66b95935 100644 --- a/src/renderer/features/sidebar/components/sidebar.tsx +++ b/src/renderer/features/sidebar/components/sidebar.tsx @@ -40,6 +40,7 @@ import { import { Accordion } from '/@/shared/components/accordion/accordion'; import { ActionIcon } from '/@/shared/components/action-icon/action-icon'; import { Center } from '/@/shared/components/center/center'; +import { Divider } from '/@/shared/components/divider/divider'; import { Group } from '/@/shared/components/group/group'; import { Icon } from '/@/shared/components/icon/icon'; import { ImageUnloader } from '/@/shared/components/image/image'; @@ -55,6 +56,7 @@ const SidebarPlaylistSection = () => { return ( + diff --git a/src/renderer/features/visualizer/components/butternchurn/visualizer.tsx b/src/renderer/features/visualizer/components/butternchurn/visualizer.tsx index a52ae28f2..e099d6524 100644 --- a/src/renderer/features/visualizer/components/butternchurn/visualizer.tsx +++ b/src/renderer/features/visualizer/components/butternchurn/visualizer.tsx @@ -242,14 +242,14 @@ const VisualizerInner = () => { visualizerRef.current = undefined; } } - - return () => { - // Cleanup on unmount or when webAudio changes - cleanupVisualizer(); - }; // eslint-disable-next-line react-hooks/exhaustive-deps }, [webAudio, playbackType, librariesLoaded, resumeInitGeneration]); + useEffect(() => { + // Cleanup on unmount or when webAudio changes + cleanupVisualizer(); + }, [webAudio, playbackType]); + // Kill visualizer after 5 seconds of pause useEffect(() => { if (isPlaying) { diff --git a/src/renderer/store/auth.store.ts b/src/renderer/store/auth.store.ts index 2a5365778..b6c520033 100644 --- a/src/renderer/store/auth.store.ts +++ b/src/renderer/store/auth.store.ts @@ -136,6 +136,7 @@ export const useCurrentServer = () => } return { + enableAudiobooks: state.currentServer?.enableAudiobooks, features: state.currentServer?.features, id: state.currentServer?.id, isAdmin: state.currentServer?.isAdmin, diff --git a/src/shared/api/jellyfin/jellyfin-normalize.ts b/src/shared/api/jellyfin/jellyfin-normalize.ts index 2cbe20cf2..31d4cba1e 100644 --- a/src/shared/api/jellyfin/jellyfin-normalize.ts +++ b/src/shared/api/jellyfin/jellyfin-normalize.ts @@ -82,13 +82,13 @@ const getBlurHash = ( const jellyfinPremiereFields = (item: { PremiereDate?: string; ProductionYear?: number; -}): { originalYear: number; releaseDate: null | string; releaseYear: null | number } => { +}): { originalYear: null | number; releaseDate: null | string; releaseYear: null | number } => { const premiere = parsePartialIsoDateFromApi(item.PremiereDate ?? null); const prodYear = coerceYear(item.ProductionYear); - const releaseYear: null | number = - premiere.year > 0 ? premiere.year : prodYear > 0 ? prodYear : null; - const releaseDate = premiere.date ?? (prodYear > 0 ? String(prodYear) : null); - const originalYear = premiere.year > 0 ? premiere.year : prodYear; + const fallbackYear = prodYear && prodYear > 0 ? prodYear : null; + const releaseYear: null | number = premiere.year > 0 ? premiere.year : fallbackYear; + const releaseDate = premiere.date ?? (fallbackYear !== null ? String(fallbackYear) : null); + const originalYear = premiere.year > 0 ? premiere.year : fallbackYear; return { originalYear, releaseDate, releaseYear }; }; @@ -169,7 +169,7 @@ const normalizeSong = ( compilation: null, container, createdAt: item.DateCreated, - date: releaseDate || String(releaseYear), + date: releaseDate || (releaseYear !== null ? String(releaseYear) : null), discNumber: (item.ParentIndexNumber && item.ParentIndexNumber) || 1, discSubtitle: null, duration: item.RunTimeTicks / TICKS_PER_MS, @@ -204,6 +204,7 @@ const normalizeSong = ( id: item.Id, imageId: getSongImageId(item), imageUrl: null, + isResumable: item.Type === 'AudioBook', lastPlayedAt: null, libraryId: null, libraryName: null, @@ -224,6 +225,9 @@ const normalizeSong = ( playlistItemId: item.PlaylistItemId, releaseDate, releaseYear, + resumePositionMs: item.UserData + ? item.UserData.PlaybackPositionTicks / TICKS_PER_MS + : undefined, sampleRate, size, sortName: item.SortName || item.Name, diff --git a/src/shared/api/jellyfin/jellyfin-types.ts b/src/shared/api/jellyfin/jellyfin-types.ts index cc5235acb..5ab6917fc 100644 --- a/src/shared/api/jellyfin/jellyfin-types.ts +++ b/src/shared/api/jellyfin/jellyfin-types.ts @@ -82,6 +82,7 @@ const jfImage = { } as const; const jfCollection = { + BOOKS: 'books', MUSIC: 'music', PLAYLISTS: 'playlists', } as const; diff --git a/src/shared/api/navidrome/navidrome-normalize.ts b/src/shared/api/navidrome/navidrome-normalize.ts index f878a228f..be19f1860 100644 --- a/src/shared/api/navidrome/navidrome-normalize.ts +++ b/src/shared/api/navidrome/navidrome-normalize.ts @@ -44,7 +44,7 @@ const normalizeNavidromeReleaseDate = (item: { date?: string; minYear?: number; releaseDate?: string; -}): { date: null | string; year: number } => { +}): { date: null | string; year: null | number } => { const fromRelease = parsePartialIsoDate(item.releaseDate); if (fromRelease.date) { return fromRelease; @@ -56,11 +56,11 @@ const normalizeNavidromeReleaseDate = (item: { } const y = coerceYear(item.minYear); - if (y > 0) { + if (y) { return { date: String(y), year: y }; } - return { date: null, year: 0 }; + return { date: null, year: null }; }; const normalizeNavidromeOriginalDate = (item: { @@ -69,7 +69,7 @@ const normalizeNavidromeOriginalDate = (item: { minYear?: number; originalDate?: string; releaseDate?: string; -}): { date: null | string; year: number } => { +}): { date: null | string; year: null | number } => { const fromOriginal = parsePartialIsoDate(item.originalDate); if (fromOriginal.date) { return fromOriginal; @@ -86,11 +86,39 @@ const normalizeNavidromeOriginalDate = (item: { } const y = coerceYear(item.minOriginalYear ?? item.minYear); - if (y > 0) { + if (y) { return { date: String(y), year: y }; } - return { date: null, year: 0 }; + return { date: null, year: null }; +}; + +const normalizeNavidromeSongReleaseDate = (item: { + date?: string; + releaseDate?: string; + releaseYear?: number; + year?: number; +}): { date: null | string; year: null | number } => { + const fromRelease = parsePartialIsoDate(item.releaseDate); + const releaseYear = coerceYear(item.releaseYear); + + if (releaseYear && releaseYear > 0) { + return { date: fromRelease.date ?? String(releaseYear), year: releaseYear }; + } + if (fromRelease.date) { + return fromRelease; + } + + const fromDate = parsePartialIsoDate(item.date); + const year = coerceYear(item.year); + if (year) { + return { date: fromDate.date ?? String(year), year }; + } + if (fromDate.date) { + return fromDate; + } + + return { date: null, year: null }; }; const getArtists = ( @@ -211,25 +239,18 @@ const normalizeSong = ( } const fromSongDate = parsePartialIsoDate(item.date); - const fromSongRelease = parsePartialIsoDate(item.releaseDate); const fromSongOriginal = parsePartialIsoDate(item.originalDate); const songYear = coerceYear(item.year); - const songReleaseYear = coerceYear(item.releaseYear); const songOriginalYear = coerceYear(item.originalYear); - const releaseYear = - songReleaseYear > 0 - ? songReleaseYear - : fromSongRelease.year > 0 - ? fromSongRelease.year - : null; - const releaseDate = - fromSongRelease.date ?? (songReleaseYear > 0 ? String(songReleaseYear) : null); - const date = fromSongDate.date ?? (songYear > 0 ? String(songYear) : null); - const year = songYear > 0 ? songYear : fromSongDate.year > 0 ? fromSongDate.year : null; + const date = fromSongDate.date ?? (songYear && songYear > 0 ? String(songYear) : null); + const year = + songYear && songYear > 0 ? songYear : fromSongDate.year > 0 ? fromSongDate.year : null; + const { date: releaseDate, year: releaseYear } = normalizeNavidromeSongReleaseDate(item); const originalDate = - fromSongOriginal.date ?? (songOriginalYear > 0 ? String(songOriginalYear) : null); + fromSongOriginal.date ?? + (songOriginalYear && songOriginalYear > 0 ? String(songOriginalYear) : null); const originalYear = - songOriginalYear > 0 + songOriginalYear && songOriginalYear > 0 ? songOriginalYear : fromSongOriginal.year > 0 ? fromSongOriginal.year @@ -419,7 +440,7 @@ const normalizeAlbum = ( ratedAt: item.ratedAt || null, releaseDate: releaseDate.date, releaseType: item.mbzAlbumType || null, - releaseYear: releaseDate.year > 0 ? releaseDate.year : null, + releaseYear: releaseDate.year, size: item.size, songCount: item.songCount, songs: item.songs ? item.songs.map((song) => normalizeSong(song, server)) : undefined, diff --git a/src/shared/api/partial-iso-date.ts b/src/shared/api/partial-iso-date.ts index af15a5b2b..441612835 100644 --- a/src/shared/api/partial-iso-date.ts +++ b/src/shared/api/partial-iso-date.ts @@ -1,8 +1,8 @@ const PARTIAL_ISO = /^\d{4}(-\d{2}(-\d{2})?)?$/; -export const coerceYear = (value: null | number | undefined): number => { +export const coerceYear = (value: null | number | undefined): null | number => { if (typeof value !== 'number' || !Number.isFinite(value)) { - return 0; + return null; } return value; diff --git a/src/shared/api/subsonic/subsonic-normalize.ts b/src/shared/api/subsonic/subsonic-normalize.ts index f2e3cfd76..5d9b1575a 100644 --- a/src/shared/api/subsonic/subsonic-normalize.ts +++ b/src/shared/api/subsonic/subsonic-normalize.ts @@ -153,7 +153,7 @@ const subsonicReleaseFields = (item: { } const y = coerceYear(item.year); - if (y > 0) { + if (y) { return { releaseDate: String(y), releaseYear: y }; } @@ -163,7 +163,7 @@ const subsonicTrackYearField = (item: { year?: number; }): { date: null | string; year: null | number } => { const y = coerceYear(item.year); - if (y > 0) { + if (y) { return { date: String(y), year: y }; } @@ -376,7 +376,7 @@ const normalizeAlbum = ( missing: null, name: item.name, originalDate: releaseDate, - originalYear: releaseYear ?? 0, + originalYear: releaseYear, participants: getParticipants(item), peak: null, playCount: null, diff --git a/src/shared/components/text-scrolling/text-scrolling.module.css b/src/shared/components/text-scrolling/text-scrolling.module.css index 011ba4747..b51ae2ad6 100644 --- a/src/shared/components/text-scrolling/text-scrolling.module.css +++ b/src/shared/components/text-scrolling/text-scrolling.module.css @@ -1,4 +1,6 @@ .scrolling-text-container { + width: 100%; + min-width: 0; max-width: 100%; overflow: hidden; } @@ -9,6 +11,7 @@ display: flex; align-items: center; width: max-content; + margin: 0 auto; } .track div { diff --git a/src/shared/components/text-scrolling/text-scrolling.tsx b/src/shared/components/text-scrolling/text-scrolling.tsx index 150d88fb9..562806ad6 100644 --- a/src/shared/components/text-scrolling/text-scrolling.tsx +++ b/src/shared/components/text-scrolling/text-scrolling.tsx @@ -35,22 +35,43 @@ export const BaseTextScrolling = ({ children, gap, pause, speed, ...rest }: Text const checkOverflow = () => { const container = containerRef.current; const text = textRef.current; + const track = trackRef.current; if (!container || !text) { return; } const overflow = text.scrollWidth - container.clientWidth; - const textWidth = text.scrollWidth; + + // A title that fits must never inherit a previous title's scroll + // position: clear any running animation and snap back to origin. + if (overflow <= 0 && track) { + track.getAnimations().forEach((animation) => animation.cancel()); + track.style.transform = ''; + } setIsOverflowing(overflow > 0); - setScrollDistance(textWidth); + setScrollDistance(text.scrollWidth); }; checkOverflow(); + + // Webfonts (e.g. the 900-weight title face) change text width after + // first paint; re-check once they settle so short titles are not + // stuck in a stale overflowing state. + let fontsDone = false; + document.fonts?.ready.then(() => { + if (!fontsDone) { + checkOverflow(); + } + }); + window.addEventListener('resize', checkOverflow); - return () => window.removeEventListener('resize', checkOverflow); + return () => { + fontsDone = true; + window.removeEventListener('resize', checkOverflow); + }; }, [children]); useEffect(() => { @@ -117,10 +138,15 @@ export const BaseTextScrolling = ({ children, gap, pause, speed, ...rest }: Text }; }, [isOverflowing, scrollDistance, gap, pause, speed]); + // Remount the track per title so scroll state (overflow flag, distance, + // transform) from a previous title can never leak into the next one. + const trackKey = typeof children === 'string' ? children : 'text-scrolling-track'; + return (
diff --git a/src/shared/types/domain-types.ts b/src/shared/types/domain-types.ts index cb3f6da18..7686e5cca 100644 --- a/src/shared/types/domain-types.ts +++ b/src/shared/types/domain-types.ts @@ -91,6 +91,7 @@ export interface SavedCollection { export type ServerListItem = { auth?: AuthMode; + enableAudiobooks?: boolean; features?: ServerFeatures; id: string; isAdmin?: boolean; @@ -206,7 +207,7 @@ export type Album = { missing: boolean | null; name: string; originalDate: null | PartialIsoDateString; - originalYear: number; + originalYear: null | number; participants: null | Record; peak: GainInfo | null; playCount: null | number; @@ -429,6 +430,7 @@ export type Song = { id: string; imageId: null | string; imageUrl: null | string; + isResumable?: boolean; lastPlayedAt: null | string; libraryId: null | number; libraryName: null | string; @@ -449,6 +451,7 @@ export type Song = { playlistItemId?: string; releaseDate: null | PartialIsoDateString; releaseYear: null | number; + resumePositionMs?: number; sampleRate: null | number; size: number; sortName: string; @@ -1469,7 +1472,7 @@ export type ScrobbleArgs = BaseEndpointArgs & { export type ScrobbleQuery = { albumId?: string; - event?: 'pause' | 'start' | 'stop' | 'unpause'; + event?: 'pause' | 'start' | 'stop' | 'timeupdate' | 'unpause'; id: string; mediaType: 'podcast' | 'song'; playbackRate: number;