Compare commits

..

19 Commits

Author SHA1 Message Date
jeffvli 0c7c0e488d temp 2 2025-09-07 12:24:21 -07:00
jeffvli a7430dae31 temp 2025-09-07 12:24:21 -07:00
jeffvli 98e8bda45d progress on subsonic api 2025-09-07 12:24:20 -07:00
jeffvli 96221c8fa7 fix various imports 2025-09-07 12:23:01 -07:00
jeffvli 8c7cac369a add experimental request logger 2025-09-07 12:21:07 -07:00
jeffvli f1c011f677 temp progress 2025-09-07 12:21:06 -07:00
jeffvli 351464c52d add missing i18n path resolution to main/preload 2025-09-07 12:21:06 -07:00
jeffvli da8ba31a88 scaffold new OS controller 2025-09-07 12:21:06 -07:00
jeffvli d8a8880e48 add console logger utility 2025-09-07 12:21:06 -07:00
jeffvli fe36535aee improve domain types to better match OS, update normalizer functions 2025-09-07 12:21:06 -07:00
jeffvli 67eec51e5f add new date format utility function 2025-09-07 12:21:06 -07:00
jeffvli a7f21db563 add new api controller, rework and rename types 2025-09-07 12:21:06 -07:00
jeffvli 6c360c3c19 add autogen opensubsonic schema 2025-09-07 12:21:06 -07:00
jeffvli 4d7779eae1 rename preload types file 2025-09-07 12:18:33 -07:00
jeffvli 71b307e4a6 add new api controller types 2025-09-07 12:18:33 -07:00
jeffvli a3a67d20a9 fix imports 2025-09-07 12:18:33 -07:00
jeffvli 1c22461ee4 move all domain types to separate files 2025-09-07 12:18:33 -07:00
jeffvli 7785874605 add i18n path to node tsconfig 2025-09-07 12:18:33 -07:00
jeffvli 9147b041f3 begin reorganizing domain types 2025-09-07 12:18:33 -07:00
271 changed files with 15781 additions and 7283 deletions
-233
View File
@@ -1,233 +0,0 @@
name: Publish Beta (Manual)
on:
workflow_dispatch:
inputs:
version:
description: 'Semantic version number (e.g., 1.0.0) - beta suffix will be added automatically'
required: false
type: string
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Validate and set version with beta suffix
id: version
shell: pwsh
run: |
$inputVersion = "${{ github.event.inputs.version }}"
Write-Host "Input version: $inputVersion"
if ($inputVersion -eq "" -or $inputVersion -eq "null") {
# No input version provided, auto-increment patch version
Write-Host "No version provided, auto-incrementing patch version..."
# Get current version from package.json
$currentVersion = (Get-Content package.json | ConvertFrom-Json).version
Write-Host "Current version: $currentVersion"
# Remove any existing suffix (like -beta) to get clean semantic version
$cleanVersion = $currentVersion -replace '-.*$', ''
# Extract major, minor, patch components
$versionParts = $cleanVersion.Split('.')
if ($versionParts.Length -ne 3) {
Write-Error "Current version format is invalid: $cleanVersion"
exit 1
}
$major = [int]$versionParts[0]
$minor = [int]$versionParts[1]
$patch = [int]$versionParts[2]
# Increment patch version
$newPatch = $patch + 1
$inputVersion = "$major.$minor.$newPatch"
Write-Host "Auto-generated version: $inputVersion"
} else {
# Validate semantic version format (major.minor.patch)
$versionPattern = '^\d+\.\d+\.\d+$'
if ($inputVersion -notmatch $versionPattern) {
Write-Error "Invalid version format. Expected semantic version (e.g., 1.0.0), got: $inputVersion"
exit 1
}
}
# Add beta suffix
$versionWithBeta = "$inputVersion-beta"
Write-Host "Setting version to: $versionWithBeta"
# Update package.json
$packageJson = Get-Content package.json | ConvertFrom-Json
$packageJson.version = $versionWithBeta
$packageJson | ConvertTo-Json -Depth 10 | Set-Content package.json
Write-Host "Updated package.json version to: $versionWithBeta"
# Set output for other jobs
echo "version=$versionWithBeta" >> $env:GITHUB_OUTPUT
- name: Delete existing releases and tags
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the version that was set in the previous step
$versionWithBeta = "${{ steps.version.outputs.version }}"
Write-Host "Checking for existing releases with tag: $versionWithBeta"
# Find and delete any releases with isPrerelease "true"
Write-Host "Deleting existing prereleases..."
Write-Host "Searching for releases with isPrerelease 'true'..."
$betaReleases = gh release list --limit 100 --json tagName,isPrerelease,name | ConvertFrom-Json | Where-Object { $_.isPrerelease -eq $true }
if ($betaReleases) {
Write-Host "Found $($betaReleases.Count) release(s) with isPrerelease 'true':"
foreach ($release in $betaReleases) {
Write-Host " - Tag: $($release.tagName), Title: $($release.name)"
gh release delete $release.tagName --yes --cleanup-tag
Write-Host " Deleted release with tag: $($release.tagName)"
}
} else {
Write-Host "No releases found with isPrerelease 'true'"
}
publish:
needs: prepare
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
with:
version: 9
- name: Install dependencies
run: pnpm install
- name: Set version from prepare job
shell: pwsh
run: |
$versionWithBeta = "${{ needs.prepare.outputs.version }}"
Write-Host "Setting version from prepare job: $versionWithBeta"
# Update package.json with the version from prepare job
$packageJson = Get-Content package.json | ConvertFrom-Json
$packageJson.version = $versionWithBeta
$packageJson | ConvertTo-Json -Depth 10 | Set-Content package.json
Write-Host "Updated package.json version to: $versionWithBeta"
- name: Build and Publish releases (Windows)
if: matrix.os == 'windows-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EP_PRE_RELEASE: true
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:win
pnpm run publish:win
on_retry_command: pnpm cache delete
- name: Build and Publish releases (macOS)
if: matrix.os == 'macos-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EP_PRE_RELEASE: true
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:mac
pnpm run publish:mac
on_retry_command: pnpm cache delete
- name: Build and Publish releases (Linux)
if: matrix.os == 'ubuntu-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EP_PRE_RELEASE: true
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:linux
pnpm run publish:linux
on_retry_command: pnpm cache delete
- name: Build and Publish releases (Linux ARM64)
if: matrix.os == 'ubuntu-latest'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EP_PRE_RELEASE: true
uses: nick-invision/retry@v2.8.2
with:
timeout_minutes: 30
max_attempts: 3
retry_on: error
command: |
pnpm run package:linux-arm64
pnpm run publish:linux-arm64
on_retry_command: pnpm cache delete
rename-release:
needs: [prepare, publish]
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v1
- name: Rename release title to Beta
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Get the version from the prepare job
$versionWithBeta = "${{ needs.prepare.outputs.version }}"
$tagVersion = "v" + $versionWithBeta
Write-Host "Renaming release title for tag: $tagVersion"
# Check if release exists
$releaseExists = gh release view $tagVersion 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "Found release with tag $tagVersion, renaming title to 'Beta'..."
# Get current release notes
$releaseNotes = gh release view $tagVersion --json body --jq '.body'
# Update the release with new title
gh release edit $tagVersion --title "Beta" --notes "$releaseNotes"
Write-Host "Successfully renamed release title to 'Beta'"
} else {
Write-Host "No release found with tag $tagVersion"
}
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
uses: pnpm/action-setup@v4
with:
version: 9
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
uses: pnpm/action-setup@v4
with:
version: 9
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
uses: pnpm/action-setup@v4
with:
version: 9
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v1
- name: Install Node and PNPM
uses: pnpm/action-setup@v4.1.0
uses: pnpm/action-setup@v4
with:
version: 9
+1 -1
View File
@@ -42,6 +42,6 @@ jobs:
stale-issue-label: 'stale'
exempt-issue-labels: 'keep,security'
exempt-issue-labels: 'enhancement,keep,security'
stale-pr-label: 'stale'
exempt-pr-labels: 'keep,security'
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@v1
- name: Install Node.js and PNPM
uses: pnpm/action-setup@v4.1.0
uses: pnpm/action-setup@v4
with:
version: 9
-3
View File
@@ -17,8 +17,6 @@ win:
- nsis
icon: assets/icons/icon.png
nsis:
allowToChangeInstallationDirectory: true
oneClick: false
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
@@ -49,4 +47,3 @@ publish:
provider: github
owner: jeffvli
repo: feishin
generateUpdatesFilesForAllChannels: true
+2
View File
@@ -30,6 +30,7 @@ const config: UserConfig = {
],
resolve: {
alias: {
'/@/i18n': resolve('src/i18n'),
'/@/main': resolve('src/main'),
'/@/shared': resolve('src/shared'),
},
@@ -39,6 +40,7 @@ const config: UserConfig = {
plugins: [externalizeDepsPlugin()],
resolve: {
alias: {
'/@/i18n': resolve('src/i18n'),
'/@/preload': resolve('src/preload'),
'/@/shared': resolve('src/shared'),
},
+1 -1
View File
@@ -6,7 +6,7 @@ import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
import eslintPluginReactRefresh from 'eslint-plugin-react-refresh';
export default tseslint.config(
{ ignores: ['**/node_modules', '**/dist', '**/out'] },
{ ignores: ['**/node_modules', '**/dist', '**/out', '**/*-schema.d.ts'] },
tseslint.configs.recommended,
perfectionist.configs['recommended-natural'],
eslintPluginReact.configs.flat.recommended,
+14 -10
View File
@@ -1,6 +1,6 @@
{
"name": "feishin",
"version": "0.20.1",
"version": "0.20.0",
"description": "A modern self-hosted music player.",
"keywords": [
"subsonic",
@@ -27,12 +27,14 @@
"dev": "electron-vite dev",
"dev:remote": "vite dev --config remote.vite.config.ts",
"dev:watch": "electron-vite dev --watch",
"generate-api": "pnpm run generate-api:subsonic",
"generate-api:subsonic": "openapi-typescript https://opensubsonic.netlify.app/docs/openapi/openapi.json -o ./src/shared/api/subsonic/subsonic-schema.d.ts",
"i18next": "i18next -c src/i18n/i18next-parser.config.js",
"postinstall": "electron-builder install-app-deps",
"lint": "pnpm run lint-code && pnpm run lint-styles",
"lint-code": "eslint --max-warnings=0 --cache .",
"lint-code": "eslint --cache .",
"lint-code:fix": "eslint --cache --fix .",
"lint-styles": "stylelint --max-warnings=0 'src/**/*.{css,scss}'",
"lint-styles": "stylelint 'src/**/*.{css,scss}'",
"lint-styles:fix": "stylelint 'src/**/*.{css,scss}' --fix",
"lint:fix": "pnpm run lint-code:fix && pnpm run lint-styles:fix",
"package": "pnpm run build && electron-builder",
@@ -71,14 +73,14 @@
"@mantine/hooks": "^8.2.8",
"@mantine/modals": "^8.2.8",
"@mantine/notifications": "^8.2.8",
"@tanstack/react-query": "^4.32.1",
"@tanstack/react-query-devtools": "^4.32.1",
"@tanstack/react-query-persist-client": "^4.32.1",
"@tanstack/react-query": "^5.83.0",
"@tanstack/react-query-devtools": "^5.83.0",
"@tanstack/react-query-persist-client": "^5.83.0",
"@ts-rest/core": "^3.23.0",
"@xhayper/discord-rpc": "^1.3.0",
"audiomotion-analyzer": "^4.5.0",
"auto-text-size": "^0.2.3",
"axios": "^1.12.0",
"axios": "^1.6.0",
"cheerio": "^1.0.0",
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
@@ -103,6 +105,7 @@
"mpris-service": "^2.1.2",
"nanoid": "^3.3.3",
"node-mpv": "github:jeffvli/Node-MPV#32b4d64395289ad710c41d481d2707a7acfc228f",
"openapi-fetch": "^0.14.0",
"overlayscrollbars": "^2.11.1",
"overlayscrollbars-react": "^0.5.6",
"qs": "^6.14.0",
@@ -135,6 +138,7 @@
"@types/lodash": "^4.17.18",
"@types/md5": "^2.3.5",
"@types/node": "^22.15.32",
"@types/qs": "^6.14.0",
"@types/react": "^18.3.23",
"@types/react-dom": "^18.3.7",
"@types/react-window": "^1.8.5",
@@ -155,6 +159,7 @@
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"i18next-parser": "^9.0.2",
"openapi-typescript": "^7.8.0",
"postcss-preset-mantine": "^1.17.0",
"prettier": "^3.5.3",
"prettier-plugin-packagejson": "^2.5.14",
@@ -164,11 +169,10 @@
"stylelint-config-recess-order": "^7.1.0",
"stylelint-config-standard": "^38.0.0",
"typescript": "^5.8.3",
"vite": "^6.3.6",
"vite": "^6.3.5",
"vite-plugin-conditional-import": "^0.1.7",
"vite-plugin-dynamic-import": "^1.6.0",
"vite-plugin-ejs": "^1.7.0",
"vite-plugin-pwa": "^1.0.3"
"vite-plugin-ejs": "^1.7.0"
},
"pnpm": {
"onlyBuiltDependencies": [
+392 -2342
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -1,5 +1,7 @@
module.exports = {
plugins: {
'postcss-preset-mantine': {},
'postcss-preset-mantine': {
mixins: {},
},
},
};
+2 -7
View File
@@ -75,9 +75,7 @@
"download": "descarregar",
"showDetails": "informació",
"numberSelected": "{{count}} seleccionat",
"shareItem": "comparteix l'element",
"goToAlbumArtist": "Ves a $t(entity.albumArtist_one)",
"goToAlbum": "ves a $t(entity.album_one)"
"shareItem": "comparteix l'element"
},
"genreList": {
"title": "$t(entity.genre_other)",
@@ -643,10 +641,7 @@
"discordDisplayType": "tipus de pantalla d'activitat de {{discord}}",
"discordDisplayType_description": "canvia què escolteu al vostre estat",
"discordDisplayType_songname": "nom de la cançó",
"discordDisplayType_artistname": "nom de l'artista",
"hotkey_navigateHome": "ves a l'inici",
"preventSleepOnPlayback": "evitar entrar en repòs durant la reproducció",
"preventSleepOnPlayback_description": "evita que la pantalla s'adormi mentre la música es reprodueix"
"discordDisplayType_artistname": "nom de l'artista"
},
"table": {
"column": {
+2 -7
View File
@@ -277,10 +277,7 @@
"discordDisplayType": "typ zobrazení stavu {{discord}}",
"discordDisplayType_description": "změní, co posloucháte, ve vašem stavu",
"discordDisplayType_songname": "název skladby",
"discordDisplayType_artistname": "jména umělců",
"hotkey_navigateHome": "přejít domů",
"preventSleepOnPlayback": "zabránit uspání při přehrávání",
"preventSleepOnPlayback_description": "zabránit uspání displeje během přehrávání hudby"
"discordDisplayType_artistname": "jména umělců"
},
"action": {
"editPlaylist": "upravit $t(entity.playlist_one)",
@@ -628,9 +625,7 @@
"playSimilarSongs": "$t(player.playSimilarSongs)",
"download": "stáhnout",
"playShuffled": "$t(player.shuffle)",
"moveToNext": "$t(action.moveToNext)",
"goToAlbum": "přejít na $t(entity.album_one)",
"goToAlbumArtist": "přejít na $t(entity.albumArtist_one)"
"moveToNext": "$t(action.moveToNext)"
},
"home": {
"mostPlayed": "nejpřehrávanější",
+6 -17
View File
@@ -227,7 +227,11 @@
"songCount": "song count",
"title": "title",
"toYear": "to year",
"trackNumber": "track"
"trackNumber": "track",
"createdAt": "created at",
"updatedAt": "updated at",
"type": "type",
"email": "email"
},
"form": {
"addServer": {
@@ -237,8 +241,6 @@
"input_legacyAuthentication": "enable legacy authentication",
"input_name": "server name",
"input_password": "password",
"input_preferInstantMix": "prefer instant mix",
"input_preferInstantMixDescription": "only use instant mix to get similar songs. useful if you have plugins that modify this behavior",
"input_savePassword": "save password",
"input_url": "url",
"input_username": "username",
@@ -411,7 +413,6 @@
"mostPlayed": "most played",
"newlyAdded": "newly added releases",
"recentlyPlayed": "recently played",
"recentlyReleased": "recently released",
"title": "$t(common.home)"
},
"itemDetail": {
@@ -497,10 +498,6 @@
"albumBackgroundBlur_description": "adjusts the amount of blur applied to the album background image",
"applicationHotkeys": "application hotkeys",
"applicationHotkeys_description": "configure application hotkeys. toggle the checkbox to set as a global hotkey (desktop only)",
"artistBackground": "artist background image",
"artistBackground_description": "adds a background image for artist pages containing the artist art",
"artistBackgroundBlur": "artist background image blur size",
"artistBackgroundBlur_description": "adjusts the amount of blur applied to the artist background image",
"artistConfiguration": "album artist page configuration",
"artistConfiguration_description": "configure what items are shown, and in what order, on the album artist page",
"audioDevice": "audio device",
@@ -530,10 +527,6 @@
"customFontPath": "custom font path",
"customFontPath_description": "sets the path to the custom font to use for the application",
"disableAutomaticUpdates": "disable automatic updates",
"releaseChannel_optionLatest": "latest",
"releaseChannel_optionBeta": "beta",
"releaseChannel": "release channel",
"releaseChannel_description": "choose between stable releases or beta releases for automatic updates",
"disableLibraryUpdateOnStartup": "disable checking for new versions on startup",
"discordApplicationId": "{{discord}} application id",
"discordApplicationId_description": "the application id for {{discord}} rich presence (defaults to {{defaultId}})",
@@ -546,17 +539,13 @@
"discordRichPresence": "{{discord}} rich presence",
"discordRichPresence_description": "enable playback status in {{discord}} rich presence. Image keys are: {{icon}}, {{playing}}, and {{paused}}",
"discordServeImage": "serve {{discord}} images from server",
"discordServeImage_description": "share cover art for {{discord}} rich presence from server itself, only available for jellyfin and navidrome. {{discord}} uses a bot to fetch images, so your server must be reachable from the public internet.",
"discordServeImage_description": "share cover art for {{discord}} rich presence from server itself, only available for jellyfin and navidrome",
"discordUpdateInterval": "{{discord}} rich presence update interval",
"discordUpdateInterval_description": "the time in seconds between each update (minimum 15 seconds)",
"discordDisplayType": "{{discord}} presence display type",
"discordDisplayType_description": "changes what you are listening to in your status",
"discordDisplayType_songname": "song name",
"discordDisplayType_artistname": "artist name(s)",
"discordLinkType": "{{discord}} presence links",
"discordLinkType_description": "adds external links to {{lastfm}} or {{musicbrainz}} to the song and artist fields in {{discord}} rich presence. {{musicbrainz}} is the most accurate but requires tags and doesn't provide artist links while {{lastfm}} should always provide a link. makes no extra network requests",
"discordLinkType_none": "$t(common.none)",
"discordLinkType_mbz_lastfm": "{{musicbrainz}} with {{lastfm}} fallback",
"doubleClickBehavior": "queue all searched tracks when double clicking",
"doubleClickBehavior_description": "if true, all matching tracks in a track search will be queued. otherwise, only the clicked one will be queued",
"enableRemote": "enable remote control server",
+5 -10
View File
@@ -243,7 +243,7 @@
"artists": "$t(entity.artist_other)",
"albumArtists": "$t(entity.albumArtist_other)",
"shared": "partagé $t(entity.playlist_other)",
"myLibrary": "Bibliothèque"
"myLibrary": "ma bibliothèque"
},
"fullscreenPlayer": {
"config": {
@@ -331,9 +331,7 @@
"showDetails": "obtenir des informations",
"download": "télécharger",
"playShuffled": "$t(player.shuffle)",
"moveToNext": "$t(action.moveToNext)",
"goToAlbumArtist": "aller à l'$t(entity.albumArtist_one)",
"goToAlbum": "aller à l'$t(entity.album_one)"
"moveToNext": "$t(action.moveToNext)"
},
"albumArtistList": {
"title": "$t(entity.albumArtist_other)"
@@ -501,7 +499,7 @@
"sidebarCollapsedNavigation_description": "affiche ou cache la navigation dans la barre latérale réduite",
"sidebarConfiguration": "configuration de la barre latérale",
"sidebarConfiguration_description": "sélectionnez les éléments et l'ordre dans lequel ils seront affichés dans la barre latérale",
"sidebarPlaylistList": "liste des listes de lecture de la barre latérale",
"sidebarPlaylistList": "liste de listes de lecture de la barre latérale",
"sidebarCollapsedNavigation": "navigation de la barre latéral (réduite)",
"skipDuration": "durée de l'avance rapide",
"sidePlayQueueStyle_optionAttached": "attaché",
@@ -548,7 +546,7 @@
"clearQueryCache": "vide le cache de feishin",
"clearCache": "vider le cache navigateur",
"buttonSize_description": "la taille des boutons de la barre de lecture",
"clearQueryCache_description": "un 'soft clear' de Feishin. cela actualisera les liste de lecture, les métadonnées des titres, et réinitialisera les paroles enregistrées. les paramètres, identifiants du serveur et images mises en cache seront conservés",
"clearQueryCache_description": "un 'soft clear' de Feishin. Cela actualisera les liste de lecture, les métadonnées des titres, et réinitialisera les paroles enregistrées. Les paramètres, identifiants du serveur et images mises en cache seront conservés",
"clearCache_description": "un 'hard clear' de feishin. en plus de vider le cache de feishin, vide le cache du navigateur (images sauvegardées et autres ressources). les identifiants serveurs et paramètres sont conservés",
"buttonSize": "taille des boutons du lecteur",
"clearCacheSuccess": "le cache a été vidé",
@@ -629,10 +627,7 @@
"discordDisplayType": "type d'affichage du status {{discord}}",
"discordDisplayType_description": "change ce que vous écoutez dans votre statut",
"discordDisplayType_songname": "nom du morceau",
"discordDisplayType_artistname": "nom(s) dartiste",
"hotkey_navigateHome": "aller à l'accueil",
"preventSleepOnPlayback_description": "Empêche la mise en veille du lecteur lorsque la musique est en cours de lecture",
"preventSleepOnPlayback": "Empêche la mise en veille lors de la lecture"
"discordDisplayType_artistname": "nom(s) dartiste"
},
"form": {
"deletePlaylist": {
+10 -31
View File
@@ -114,14 +114,12 @@
"codec": "codec",
"mbid": "MusicBrainz ID",
"preview": "anteprima",
"reload": "aggiorna",
"reload": "ricarica",
"share": "condividi",
"tags": "tags",
"trackGain": "normalizzazione (gain) del brano",
"trackPeak": "picco di volume del brano",
"translation": "traduzione",
"bitDepth": "bit depth (profondità di bit)",
"sampleRate": "sample rate (frequenza di campionamento)"
"translation": "traduzione"
},
"player": {
"repeat_all": "ripeti coda",
@@ -233,7 +231,7 @@
"hotkey_toggleShuffle": "attiva/disattiva mescolamento",
"theme": "tema",
"playbackStyle_description": "selezione lo stile di riproduzione da usare per il player audio",
"discordRichPresence_description": "abilita lo stato di riproduzione nello stato attività di {{discord}}. Le chiavi immagine sono: {{icon}}, {{playing}} e {{paused}}",
"discordRichPresence_description": "abilita lo status del playback nello stato attività di {{discord}}. Le chiavi immagine sono: {{icon}}, {{playing}} e {{paused}}",
"mpvExecutablePath": "percorso eseguibile mpv",
"audioDevice": "device audio",
"hotkey_rate2": "voto 2 stelle",
@@ -268,7 +266,7 @@
"customFontPath": "percorso font personalizzato",
"followLyric": "segui testo corrente",
"crossfadeDuration": "durata dissolvenza",
"discordIdleStatus": "mostra lo stato attività di Discord quando non stai riproducendo",
"discordIdleStatus": "visualizza lo stato attività in stato inattivo",
"audioPlayer": "player audio",
"hotkey_zoomOut": "rimpicciolisci layout",
"hotkey_rate0": "rimuovi voto",
@@ -333,12 +331,12 @@
"customCssNotice": "Attenzione: sebbene ci sia una certa sanitizzazione (vengono bloccati url() e content:), luso di CSS personalizzati può comunque comportare dei rischi modificando linterfaccia.",
"customCss": "css personalizzato",
"customCss_description": "contenuto CSS personalizzato. Nota: le proprietà content e gli URL remoti non sono consentiti. Di seguito è mostrata unanteprima del tuo contenuto. Sono presenti anche altri campi non impostati da te a causa della sanitizzazione.",
"discordPausedStatus": "mostra lo stato attività di Discord quando la riproduzione è in pausa",
"discordPausedStatus": "mostra rich presence di Discord quando la riproduzione è in pausa",
"discordPausedStatus_description": "quando abilitato, verrà mostrato lo stato del lettore in standby/pausa (nessun brano in riproduzione)",
"discordListening": "mostra stato come in ascolto",
"discordListening_description": "mostra lo stato come in ascolto invece che in riproduzione",
"discordServeImage": "recupera le immagini di {{discord}} dal server",
"discordServeImage_description": "condividi la copertina per lo stato attività di {{discord}} direttamente dal server, disponibile solo per Jellyfin e Navidrome",
"discordServeImage_description": "condividi la copertina per la rich presence di {{discord}} direttamente dal server, disponibile solo per Jellyfin e Navidrome",
"doubleClickBehavior": "aggiungi alla coda tutte le tracce cercate, con un doppio clic",
"doubleClickBehavior_description": "se attivato, tutte le tracce corrispondenti alla ricerca verranno aggiunte alla coda. altrimenti, verrà aggiunta alla coda solo la traccia selezionata",
"externalLinks": "mostra link esterni",
@@ -395,16 +393,7 @@
"webAudio_description": "usa audio web. abilita funzionalità avanzate come ReplayGain. disabilita se riscontri problemi",
"preservePitch": "mantieni tono (pitch)",
"preservePitch_description": "mantiene il tono (pitch) durante la modifica della velocità di riproduzione",
"volumeWidth_description": "larghezza del cursore del volume",
"discordDisplayType_description": "modifica cosa stai ascoltando nel tuo stato",
"discordDisplayType_songname": "titolo traccia",
"discordDisplayType_artistname": "nome artisti",
"hotkey_navigateHome": "vai alla schermata iniziale",
"notify": "abilita notifiche delle tracce",
"notify_description": "mostra una notifica quando cambia la traccia riprodotta",
"preventSleepOnPlayback": "non sospendere in riproduzione",
"preventSleepOnPlayback_description": "non sospendere il sistema quando la riproduzione è attiva",
"discordDisplayType": "stile dello stato su {{discord}}"
"volumeWidth_description": "larghezza del cursore del volume"
},
"error": {
"remotePortWarning": "riavvia il server per applicare la nuova porta",
@@ -429,8 +418,7 @@
"badAlbum": "stai visualizzando questa pagina perché questa canzone non fa parte di un album. probabilmente vedi questo messaggio perché hai una canzone posizionata direttamente nella cartella principale della tua libreria musicale. jellyfin raggruppa le tracce solo se si trovano allinterno di una cartella.",
"badValue": "opzione non valida \"{{value}}\". valore inesistente",
"networkError": "si è verificato un errore di rete",
"openError": "impossibile aprire il file",
"notificationDenied": "i permessi per le notifiche non sono stati concessi. questa configurazione non ha effetto"
"openError": "impossibile aprire il file"
},
"filter": {
"mostPlayed": "più riprodotti",
@@ -525,9 +513,7 @@
"openBrowserDevtools": "apri devtools browser",
"quit": "$t(common.quit)",
"goBack": "torna indietro",
"goForward": "vai avanti",
"privateModeOff": "disabilita modalità privata",
"privateModeOn": "abilita modalità privata"
"goForward": "vai avanti"
},
"contextMenu": {
"addToPlaylist": "$t(action.addToPlaylist)",
@@ -551,9 +537,7 @@
"playSimilarSongs": "$t(player.playSimilarSongs)",
"playShuffled": "$t(player.shuffle)",
"shareItem": "condividi elemento",
"showDetails": "mostra info",
"goToAlbum": "vai a $t(entity.album_one)",
"goToAlbumArtist": "vai a $t(entity.albumArtist_one)"
"showDetails": "mostra info"
},
"home": {
"mostPlayed": "più riprodotti",
@@ -690,11 +674,6 @@
"success": "link di condivisione copiato negli appunti (o clicca qui per aprirlo)",
"expireInvalid": "la scadenza deve essere nel futuro",
"createFailed": "condivisione fallita (è abilitata la condivisione?)"
},
"privateMode": {
"enabled": "la modalità privata è abilitata: lo stato di riproduzione viene ora nascosto alle integrazioni esterne",
"disabled": "la modalità privata è disabilitata: lo stato di riproduzione è ora visibile alle integrazioni esterne abilitate",
"title": "modalità privata"
}
},
"table": {
+2 -239
View File
@@ -93,7 +93,7 @@
"path": "cesta",
"playerMustBePaused": "prehrávač musí byť pozastavený",
"preview": "náhľad",
"previousSong": "predchádzajúca $t(entity.track_one)",
"previousSong": "predchádzajúci $t(entity.track_one)",
"quit": "ukončiť",
"random": "náhodne",
"rating": "hodnotenie",
@@ -589,243 +589,6 @@
"globalMediaHotkeys_description": "povoliť alebo zakázať použitie vašich klávesových skratiek médií na ovládanie prehrávania",
"homeConfiguration": "konfigurácia domovskej stránky",
"homeConfiguration_description": "konfigurovať, aké položky sú zobrazené a v akom poradí na domovskej stránke",
"homeFeature": "carousel odporúčania na domovskej stránke",
"homeFeature_description": "povoľuje zobrazenie veľkoformátového odporúčaného carouselu na domovskej stránke",
"hotkey_browserBack": "naspäť v prehliadači",
"hotkey_browserForward": "dopredu v prehliadači",
"hotkey_favoriteCurrentSong": "obľúbené $t(common.currentSong)",
"hotkey_favoritePreviousSong": "obľúbené $t(common.previousSong)",
"hotkey_globalSearch": "globálne vyhľadávanie",
"hotkey_localSearch": "vyhľadávanie na stránke",
"hotkey_navigateHome": "navigovať domov",
"hotkey_playbackNext": "nasledujúca skladba",
"hotkey_playbackPause": "pozastaviť",
"hotkey_playbackPlay": "prehrať",
"hotkey_playbackPlayPause": "hrať / pozastaviť",
"hotkey_playbackPrevious": "predchádzajúca skladba",
"hotkey_playbackStop": "zastaviť",
"hotkey_rate0": "bez hodnotenia",
"hotkey_rate1": "hodnotené 1 hviezdou",
"hotkey_rate2": "hodnotené 2 hviezdami",
"hotkey_rate3": "hodnotené 3 hviezdami",
"hotkey_rate4": "hodotené 4 hviezdami",
"hotkey_rate5": "hodnotené 5 hviezdami",
"hotkey_skipBackward": "preskočiť dozadu",
"hotkey_skipForward": "preskočiť dopredu",
"hotkey_toggleCurrentSongFavorite": "prepnúť $t(common.currentSong) obľúbené",
"hotkey_toggleFullScreenPlayer": "prepnúť prehrávač na celú obrazovku",
"hotkey_togglePreviousSongFavorite": "prepnúť $t(common.previousSong) obľúbené",
"hotkey_toggleQueue": "prepnúť frontu",
"hotkey_toggleRepeat": "prepnúť opakovanie",
"hotkey_toggleShuffle": "prepnúť náhodné prehrávanie",
"hotkey_unfavoriteCurrentSong": "odobrať z obľúbených $t(common.currentSong)",
"hotkey_unfavoritePreviousSong": "odobrať z obľúbených $t(common.previousSong)",
"hotkey_volumeDown": "znížiť hlasitosť",
"hotkey_volumeMute": "stíšiť hlasitosť",
"hotkey_volumeUp": "zvýšiť hlasitosť",
"hotkey_zoomIn": "priblížiť",
"hotkey_zoomOut": "vzdialiť",
"imageAspectRatio": "použiť pôvodný pomer strán obalu albumu",
"language": "jazyk",
"language_description": "nastaví jazyk aplikácie ($t(common.restartRequired))",
"lastfm": "zobraziť last.fm odkazy",
"lastfm_description": "zobraziť last.fm odkazy na stránky interpreta/albumu",
"lastfmApiKey": "{{lastfm}} API kľúč",
"lastfmApiKey_description": "API kľúč pre {{lastfm}}. vyžaduje sa obálky albumov",
"lyricFetch": "stiahnuť texty skladieb z internetu",
"lyricFetch_description": "stiahnuť texty skladieb z rôznych internetových zdrojov",
"lyricFetchProvider": "poskytovatelia pre sťahovanie textov skladieb",
"lyricFetchProvider_description": "vybrať poskytovateľov pre sťahovanie textov skladieb. poradie poskytovateľov určuje poradie, v ktorom sa budú používať",
"lyricOffset": "posunutie textu skladieb (ms)",
"lyricOffset_description": "posunutie textu voči skladbe vyjadrené v milisekundách",
"notify": "povoliť notifikácie o skladbách",
"notify_description": "zobraziť notifikácie pri zmene aktuálnej skladby",
"minimizeToTray": "minimalizovať do lišty",
"minimizeToTray_description": "minimalizovať aplikáciu do systémovej lišty",
"minimumScrobblePercentage": "minimálna dĺžka pre skroblovanie (percentá)",
"minimumScrobblePercentage_description": "minimálna časť skladby v percentách, ktorá musí byť prehraná pred tým, než je skroblovaná",
"minimumScrobbleSeconds": "minimálna dĺžka skroblovania (sekundy)",
"minimumScrobbleSeconds_description": "minimálna dĺžka časti skladby, ktorá musí byť prehraná pred tým, než je skladba skroblovaná",
"mpvExecutablePath": "cesta k spustiteľnému súboru mpv",
"mpvExecutablePath_description": "nastavuje cestu k spustiteľnému súboru mpv. ak je prázdna, použije sa predvolená cesta",
"mpvExtraParameters": "parametre mpv",
"mpvExtraParameters_help": "jeden na riadok",
"musicbrainz": "zobraziť linky na musicbrainz",
"musicbrainz_description": "zobrazí linky na stránky interpreta/albumu na musicbrainz, ak je vyplnené mbid",
"neteaseTranslation": "Povoliť NetEasy preklady",
"neteaseTranslation_description": "Ak sú povolené, aplikácia stiahne a zobrazí preložené texty skladieb z NetEasy, ak sú dostupné.",
"passwordStore": "ukladanie hesiel/utajených údajov",
"passwordStore_description": "aký spôsob ukladania hesiel/utajených údajov použiť. ak máte problém s ukladaním hesiel, skúste zmeniť nastavenie.",
"playbackStyle": "štýl prehrávania",
"playbackStyle_description": "vyberte štýl prehrávania pre prehrávač skladieb",
"playbackStyle_optionCrossFade": "crossfade",
"playbackStyle_optionNormal": "normálny",
"playButtonBehavior": "správanie sa tlačidla prehrávania",
"playButtonBehavior_description": "nastaví predvolené správanie sa tlačidla prehrávania pri pridávaní skladieb do fronty",
"playButtonBehavior_optionAddLast": "$t(player.addLast)",
"playButtonBehavior_optionAddNext": "$t(player.addNext)",
"playButtonBehavior_optionPlay": "$t(player.play)",
"playButtonBehavior_optionPlayShuffled": "$t(player.shuffle)",
"playerAlbumArtResolution": "rozlíšenie obrázka albumu",
"playerAlbumArtResolution_description": "rozlíšenie zobrazenia náhľadu veľkých obrázkov albumov. pri väčšom rozlíšení budú krajšie, ale môže sa spomaliť ich načítavanie. predvolené je 0, čo znamená automatické",
"playerbarOpenDrawer": "zobrazenie na celú obrazovku panelom prehrávača",
"playerbarOpenDrawer_description": "umožní kliknutím na panel prehrávača prepnúť zobrazenie prehrávača na celú obrazovku",
"remotePassword": "heslo servera vzdialeného ovládania",
"remotePassword_description": "nastaví heslo pre server diaľkového ovládania. Jeho obsah je odosielaný bez zabezpečenia, preto by ste si mali zvoliť jedinečné heslo, ktoré pre vás nie je dôležité",
"remotePort": "port servera diaľkového ovládania",
"remotePort_description": "nastaví port servera diaľkového ovládania",
"remoteUsername": "používateľské meno servera diaľkového ovládania",
"remoteUsername_description": "nasstaví používateľské meno servera diaľkového ovládania. v prípade, ak sú používateľské meno aj heslo prázdne, je overovanie pri prihlásení vypnuté",
"replayGainClipping": "clipping {{ReplayGain}}",
"replayGainClipping_description": "Zabraňuje clipping-u spôsobenému {{ReplayGain}} automatickým znížením zosilenia",
"replayGainFallback": "fallback {{ReplayGain}}",
"replayGainFallback_description": "zosilenie v db, ktoré sa aplikuje, ak súbor nemá {{ReplayGain}} štítky",
"replayGainMode": "{{ReplayGain}} režim",
"replayGainMode_description": "pozmení zosilenie hlasitosti podľa hodnôt {{ReplayGain}} uložených v metadátach súboru",
"replayGainMode_optionAlbum": "$t(entity.album_one)",
"replayGainMode_optionNone": "$t(common.none)",
"replayGainMode_optionTrack": "$t(entity.track_one)",
"replayGainPreamp": "predzosilenie {{ReplayGain}} dB",
"replayGainPreamp_description": "pozmení predzosilenie použité na hodnoty {{ReplayGain}}",
"sampleRate": "vzorkovacia frekvencia",
"sidePlayQueueStyle_optionAttached": "pripojené",
"sidePlayQueueStyle_optionDetached": "odpojené",
"skipDuration": "dĺžka preskočenia",
"skipDuration_description": "určuje časovú dĺžku posunu pri stlačení tlačidla preskočiť na lište prehrávača",
"skipPlaylistPage": "preskočiť stránku playlistu",
"skipPlaylistPage_description": "pri navigácii v playliste, idete na výber stránky playlistu namiesto predvolenej stránky",
"startMinimized": "spistiť mnimalizované",
"startMinimized_description": "spustí aplikáciu minimalizovanú do systémovej lišty",
"preventSleepOnPlayback": "zabrániť spánku pri prehrávaní",
"preventSleepOnPlayback_description": "pri prehávaní hudby zabráni obrazovke v prechode do spánku",
"theme": "téma",
"theme_description": "nastaví tému aplikácie",
"themeDark": "téma (tmavá)",
"themeDark_description": "nastaví tmavú tému aplikácie",
"themeLight": "téma (svetlá)",
"themeLight_description": "nastaví svetlú tému aplikácie",
"transcodeNote": "zmena sa prejaví po 1 (web) - 2 (mpv) skladbách",
"transcode": "povoliť prekódovanie",
"transcode_description": "umožňuje prekódovanie do rôznych formátov",
"transcodeBitrate": "bitová frekvencia prekódovania",
"transcodeBitrate_description": "určuje bitovú frekvenciu, pri ktorej sa použije prekódovanie. 0 znamená ponechať rozhodnutie na server",
"transcodeFormat": "formát prekódovania",
"transcodeFormat_description": "učuje výstupný formát prekódovania. ak chcete ponechať rozhodnutie na server, nechajte políčko prázdne",
"translationApiProvider": "api poskytovateľa prekladu",
"translationApiProvider_description": "api poskytovateľa prekladu",
"translationApiKey": "api kľúč prekladu",
"translationApiKey_description": "api kľúč pre preklad (Podporuje iba koncové body globálnych služieb)",
"translationTargetLanguage": "cieľový jazyk prekladu",
"translationTargetLanguage_description": "cieľový jazyk, do ktorého sa prekladá",
"trayEnabled": "zobraziť lištu",
"trayEnabled_description": "zobraziť/skryť ikonu/ponuku lišty. ak nie je povolené, taktiež vypne minimalizovanie/zavretie do lišty",
"useSystemTheme": "použiť systémovú tému",
"useSystemTheme_description": "prispôsobiť výber svetlej, či tmavej témy aktuálnej systémovej téme",
"volumeWheelStep": "krok zmeny hlasitosti",
"volumeWheelStep_description": "veľkosť zmeny hlasitosti pri otočení kolieskom myši o jeden krok na ovládači hlasitosti",
"volumeWidth": "šírka posuvného ovládača hlasitosti",
"volumeWidth_description": "šírka ovládača hlasitosti",
"webAudio": "používať webový výstup",
"webAudio_description": "bude sa používať webový výstup, čím povolíte pokročilé funkcie ako replaygain. v prípade problémov voľbu vypnite",
"preservePitch": "zachovať výšku",
"preservePitch_description": "pri zmene rýchlosti prehrávania zostane výška zachovaná",
"windowBarStyle": "štýl okna",
"windowBarStyle_description": "vyberte štýl okna",
"zoom": "percento priblíženia",
"zoom_description": "nastaví percento priblíženia pre aplikáciu",
"sampleRate_description": "vyberte výstupnú vzorkovaciu frekvenciu, ktorá sa použije v prípade, ak je vybraná vzorkovacia frekvencia iná ako je u aktuálnej skladby. pri hodnote menšej ako 8000 sa použije predvolená frekvencia",
"savePlayQueue": "uložiť frontu prehrávania",
"savePlayQueue_description": "uloží frontu prehrávania pri ukončení aplikácie a obnoví ju opäť po jej otvorení",
"scrobble": "skroblovať",
"scrobble_description": "scroblovať vaše prehrávanie na medálny server",
"showSkipButton": "zobraziť tlačítka preskočenia",
"showSkipButton_description": "zobrazí alebo skryje tlačítka preskočenia na lište prehrávača",
"showSkipButtons": "zobraziť tlačítka preskočenia",
"showSkipButtons_description": "zobraziť alebo skryť tlačítka preskočenia na lište prehrávača",
"sidebarCollapsedNavigation": "navigácia bočnej lišty (zasunutá)",
"sidebarCollapsedNavigation_description": "zobraziť alebo skryť navigovanie na zasunutej bočnej lište",
"sidebarConfiguration": "nastavenie bočnej lišty",
"sidebarConfiguration_description": "zvoľte položky a ich poradie, v akom sa zabrazia na bočnej lište",
"sidebarPlaylistList": "playlist bočnej lišty",
"sidebarPlaylistList_description": "zobraziť alebo skryť playlist na bočnej lište",
"sidePlayQueueStyle": "štýl bočnej fronty prehrávania",
"sidePlayQueueStyle_description": "nastaví štýl bočnej fronty prehrávania"
},
"table": {
"column": {
"album": "album",
"albumArtist": "interpret albumu",
"albumCount": "$t(entity.album_other)",
"artist": "$t(entity.artist_one)",
"biography": "životopis",
"bitrate": "bitrate",
"bpm": "bpm",
"channels": "$t(common.channel_other)",
"codec": "$t(common.codec)",
"comment": "komentár",
"dateAdded": "dátum pridania",
"discNumber": "disk",
"favorite": "obľúbené",
"genre": "$t(entity.genre_one)",
"lastPlayed": "posledne hraný",
"path": "cesta",
"playCount": "prehratí",
"rating": "hodnotenie",
"releaseDate": "dátum vydania",
"releaseYear": "rok",
"size": "$t(common.size)",
"songCount": "$t(entity.track_other)",
"title": "názov",
"trackNumber": "skladba"
},
"config": {
"general": {
"autoFitColumns": "automatická šírka stĺpcov",
"followCurrentSong": "nasledovať aktuálnu skladbu",
"displayType": "typ zobrazenia",
"gap": "$t(common.gap)",
"itemGap": "medzera položky (px)",
"itemSize": "veľkosť položky (px)",
"size": "$t(common.size)",
"tableColumns": "stĺpce tabuľky"
},
"label": {
"actions": "$t(common.action_other)",
"album": "$t(entity.album_one)",
"albumArtist": "$t(entity.albumArtist_one)",
"artist": "$t(entity.artist_one)",
"biography": "$t(common.biography)",
"bitrate": "$t(common.bitrate)",
"bpm": "$t(common.bpm)",
"channels": "$t(common.channel_other)",
"codec": "$t(common.codec)",
"dateAdded": "dátum pridania",
"discNumber": "číslo disku",
"duration": "$t(common.duration)",
"favorite": "$t(common.favorite)",
"genre": "$t(entity.genre_one)",
"lastPlayed": "posledne prehraté",
"note": "$t(common.note)",
"owner": "$t(common.owner)",
"path": "$t(common.path)",
"playCount": "počet prehraní",
"rating": "$t(common.rating)",
"releaseDate": "dátum vydania",
"rowIndex": "číslo riadku",
"size": "$t(common.size)",
"songCount": "$t(entity.track_other)",
"title": "$t(common.title)",
"titleCombined": "$t(common.title) (kombinovaný)",
"trackNumber": "číslo skladby",
"year": "$t(common.year)"
},
"view": {
"card": "karta",
"grid": "mriežka",
"list": "zoznam",
"poster": "plagát",
"table": "tabuľka"
}
}
"homeFeature": "carousel odporúčania na domovskej stránke"
}
}
+3 -19
View File
@@ -286,11 +286,6 @@
"updateServer": {
"success": "sunucu başarıyla güncellendi",
"title": "sunucuyu güncelle"
},
"privateMode": {
"enabled": "gizli mod etkinleştirildi, oynatma durumu artık harici eklentilerden gizlendi",
"disabled": "gizli mod devre dışı bırakıldı, oynatma durumu artık etkinleştirilmiş harici eklentiler tarafından görülebilir",
"title": "gizli mod"
}
},
"page": {
@@ -327,9 +322,7 @@
"addFavorite": "$t(action.addToFavorites)",
"playShuffled": "$t(player.shuffle)",
"shareItem": "öğeyi paylaş",
"showDetails": "bilgi al",
"goToAlbum": "$t(entity.album_one) sayfasına git",
"goToAlbumArtist": "$t(entity.albumArtist_one) sayfasına git"
"showDetails": "bilgi al"
},
"manageServers": {
"url": "URL",
@@ -443,9 +436,7 @@
"quit": "$t(common.quit)",
"selectServer": "sunucu seç",
"settings": "$t(common.setting_other)",
"version": "{{version}} sürümü",
"privateModeOff": "gizli modu kapat",
"privateModeOn": "gizli modu aç"
"version": "{{version}} sürümü"
}
},
"player": {
@@ -722,14 +713,7 @@
"themeLight": "tema (açık)",
"themeLight_description": "uygulama için kullanılacak açık temayı ayarlar",
"transcodeNote": "1 (web) - 2 (mpv) şarkıdan sonra etkili olur",
"transcode": "kod dönüştürmeyi etkinleştir",
"discordDisplayType": "{{discord}} varlık gösterge türü",
"discordDisplayType_description": "durumunuzda dinlediğiniz şarkı olarak değiştirir",
"discordDisplayType_songname": "şarkı ismi",
"discordDisplayType_artistname": "Sanatçı adı(ları)",
"hotkey_navigateHome": "ana sayfaya git",
"preventSleepOnPlayback": "oynatma sırasında uykuyu önle",
"preventSleepOnPlayback_description": "müzik çalarken ekranın uyku moduna geçmesini önle"
"transcode": "kod dönüştürmeyi etkinleştir"
},
"table": {
"column": {
+9 -9
View File
@@ -3,8 +3,8 @@
"editPlaylist": "编辑$t(entity.playlist_one)",
"moveToTop": "移至顶部",
"clearQueue": "清空播放队列",
"addToFavorites": "添加到 $t(entity.favorite_other)",
"addToPlaylist": "添加到 $t(entity.playlist_one)",
"addToFavorites": "添加到$t(entity.favorite_other)",
"addToPlaylist": "添加到$t(entity.playlist_one)",
"createPlaylist": "创建$t(entity.playlist_one)",
"removeFromPlaylist": "从$t(entity.playlist_one)移除",
"viewPlaylists": "查看$t(entity.playlist_other)",
@@ -127,13 +127,13 @@
"playlist_other": "播放列表",
"artist_other": "艺术家",
"folderWithCount_other": "{{count}} 个文件夹",
"track_other": "曲",
"track_other": "曲",
"favorite_other": "收藏",
"artistWithCount_other": "{{count}} 位艺术家",
"folder_other": "文件夹",
"smartPlaylist": "智能$t(entity.playlist_one)",
"genreWithCount_other": "{{count}} 种流派",
"trackWithCount_other": "{{count}} 首曲",
"trackWithCount_other": "{{count}} 首曲",
"play_other": "{{count}} 次播放",
"song_other": "歌曲"
},
@@ -167,7 +167,7 @@
"skip_forward": "向前跳过",
"playbackSpeed": "播放速度",
"pause": "暂停",
"playSimilarSongs": "播放类似的曲",
"playSimilarSongs": "播放类似的曲",
"viewQueue": "查看播放队列"
},
"setting": {
@@ -205,7 +205,7 @@
"enableRemote_description": "启用远程控制服务器,以允许其他设备控制此应用",
"remotePort_description": "设置远程服务器端口",
"hotkey_skipBackward": "向后跳过",
"replayGainMode_description": "根据文件元数据中存储的 {{ReplayGain}} 值调整音量增益",
"replayGainMode_description": "根据乐曲元数据中存储的{{ReplayGain}}值调整音量增益",
"volumeWheelStep_description": "在音量滑块上滚动鼠标滚轮时要更改的音量大小",
"theme_description": "设置应用的主题",
"hotkey_playbackPause": "暂停",
@@ -290,7 +290,7 @@
"playbackStyle_optionNormal": "正常",
"windowBarStyle": "窗口顶栏风格",
"floatingQueueArea": "显示浮动队列悬停区域",
"replayGainFallback_description": "如果文件没有 {{ReplayGain}} 标签,则在数据库中应用增益",
"replayGainFallback_description": "乐曲没有{{ReplayGain}}标签应用增益(以分贝为单位)",
"hotkey_toggleRepeat": "切换循环",
"lyricOffset_description": "将歌词偏移指定的毫秒数",
"sidebarConfiguration_description": "选择侧边栏包含的项目与顺序",
@@ -464,7 +464,7 @@
"albumArtist": "$t(entity.albumArtist_one)",
"releaseYear": "发布年份",
"biography": "个人简介",
"songCount": "曲数量",
"songCount": "曲数量",
"random": "随机",
"lastPlayed": "上次播放过",
"toYear": "从年份",
@@ -599,7 +599,7 @@
"trackList": {
"title": "$t(entity.track_other)",
"genreTracks": "\"{{genre}}\" $t(entity.track_other)",
"artistTracks": "{{artist}} 的曲目"
"artistTracks": "{{artist}}的曲目"
},
"albumArtistList": {
"title": "$t(entity.albumArtist_other)"
@@ -1,55 +0,0 @@
import { createSocket } from 'dgram';
import { ipcMain } from 'electron';
import { DiscoveredServerItem, ServerType } from '/@/shared/types/types';
type JellyfinResponse = {
Address: string;
Id: string;
Name: string;
};
function discoverAll(reply: (server: DiscoveredServerItem) => void) {
return Promise.all([discoverJellyfin(reply)]);
}
function discoverJellyfin(reply: (server: DiscoveredServerItem) => void) {
const sock = createSocket('udp4');
sock.on('message', (msg) => {
try {
const response: JellyfinResponse = JSON.parse(msg.toString('utf-8'));
reply({
name: response.Name,
type: ServerType.JELLYFIN,
url: response.Address,
});
} catch (e) {
// Got a spurious response, ignore?
console.error(e);
}
});
sock.bind(() => {
sock.setBroadcast(true);
// Send a broadcast packet to both loopback and default route, allowing discovery of same-machine instances
sock.send('who is JellyfinServer?', 7359, '127.255.255.255');
sock.send('who is JellyfinServer?', 7359, '255.255.255.255');
});
return new Promise<void>((resolve) => {
setTimeout(() => {
sock.close();
resolve();
}, 3000);
});
}
ipcMain.on('autodiscover-ping', (ev) => {
if (ev.ports.length === 0) throw new Error('Expected a port to stream autodiscovery results');
const port = ev.ports[0];
discoverAll((result) => port.postMessage(result))
.then(() => port.close())
.catch((err) => console.error(err));
});
-1
View File
@@ -1,4 +1,3 @@
import './autodiscover';
import './lyrics';
import './player';
import './remote';
+3 -2
View File
@@ -1,13 +1,14 @@
import axios, { AxiosResponse } from 'axios';
import { load } from 'cheerio';
import { orderSearchResults } from './shared';
import {
InternetProviderLyricResponse,
InternetProviderLyricSearchResponse,
LyricSearchQuery,
LyricSource,
} from '.';
import { orderSearchResults } from './shared';
} from '/@/shared/types/domain/lyric-domain-types';
const SEARCH_URL = 'https://genius.com/api/search/song';
+6 -29
View File
@@ -17,35 +17,12 @@ import {
getSearchResults as searchNetease,
} from './netease';
import { Song } from '/@/shared/types/domain-types';
export enum LyricSource {
GENIUS = 'Genius',
LRCLIB = 'lrclib.net',
NETEASE = 'NetEase',
}
export type FullLyricsMetadata = Omit<InternetProviderLyricResponse, 'id' | 'lyrics' | 'source'> & {
lyrics: LyricsResponse;
remote: boolean;
source: string;
};
export type InternetProviderLyricResponse = {
artist: string;
id: string;
lyrics: string;
name: string;
source: LyricSource;
};
export type InternetProviderLyricSearchResponse = {
artist: string;
id: string;
name: string;
score?: number;
source: LyricSource;
};
import {
InternetProviderLyricResponse,
InternetProviderLyricSearchResponse,
LyricSource,
} from '/@/shared/types/domain/lyric-domain-types';
import { Song } from '/@/shared/types/domain/song-domain-types';
export type LyricGetQuery = {
remoteSongId: string;
+3 -2
View File
@@ -1,13 +1,14 @@
// Credits to https://github.com/tranxuanthang/lrcget for API implementation
import axios, { AxiosResponse } from 'axios';
import { orderSearchResults } from './shared';
import {
InternetProviderLyricResponse,
InternetProviderLyricSearchResponse,
LyricSearchQuery,
LyricSource,
} from '.';
import { orderSearchResults } from './shared';
} from '/@/shared/types/domain/lyric-domain-types';
const FETCH_URL = 'https://lrclib.net/api/get';
const SEEARCH_URL = 'https://lrclib.net/api/search';
+28 -27
View File
@@ -1,43 +1,20 @@
import axios, { AxiosResponse } from 'axios';
import { store } from '../settings';
import { orderSearchResults } from './shared';
import {
InternetProviderLyricResponse,
InternetProviderLyricSearchResponse,
LyricSearchQuery,
LyricSource,
} from '.';
import { store } from '../settings';
import { orderSearchResults } from './shared';
} from '/@/shared/types/domain/lyric-domain-types';
const SEARCH_URL = 'https://music.163.com/api/search/get';
const LYRICS_URL = 'https://music.163.com/api/song/lyric';
// Adapted from https://github.com/NyaomiDEV/Sunamu/blob/master/src/main/lyricproviders/netease.ts
export interface Result {
hasMore: boolean;
songCount: number;
songs: Song[];
}
export interface Song {
album: Album;
alias: string[];
artists: Artist[];
copyrightId: number;
duration: number;
fee: number;
ftype: number;
id: number;
mark: number;
mvid: number;
name: string;
rtype: number;
rUrl: null;
status: number;
transNames?: string[];
}
interface Album {
artist: Artist;
copyrightId: number;
@@ -69,6 +46,30 @@ interface NetEaseResponse {
result: Result;
}
interface Result {
hasMore: boolean;
songCount: number;
songs: Song[];
}
interface Song {
album: Album;
alias: string[];
artists: Artist[];
copyrightId: number;
duration: number;
fee: number;
ftype: number;
id: number;
mark: number;
mvid: number;
name: string;
rtype: number;
rUrl: null;
status: number;
transNames?: string[];
}
export async function getLyricsBySongId(songId: string): Promise<null | string> {
let result: AxiosResponse<any, any>;
try {
+2 -4
View File
@@ -1,9 +1,7 @@
import Fuse from 'fuse.js';
import {
InternetProviderLyricSearchResponse,
LyricSearchQuery,
} from '/@/shared/types/domain-types';
import { InternetProviderLyricSearchResponse } from '/@/shared/types/domain/lyric-domain-types';
import { LyricSearchQuery } from '/@/shared/types/domain/lyric-domain-types';
export const orderSearchResults = (args: {
params: LyricSearchQuery;
+2 -2
View File
@@ -11,8 +11,8 @@ import manifest from './manifest.json';
import { getMainWindow } from '/@/main/index';
import { isLinux } from '/@/main/utils';
import { QueueSong } from '/@/shared/types/domain-types';
import { ClientEvent, ServerEvent } from '/@/shared/types/remote-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { ClientEvent, ServerEvent } from '/@/shared/types/domain/remote-types';
import { PlayerRepeat, PlayerStatus, SongState } from '/@/shared/types/types';
let mprisPlayer: any | undefined;
+2 -6
View File
@@ -2,7 +2,7 @@ import { ipcMain } from 'electron';
import Player from 'mpris-service';
import { getMainWindow } from '/@/main/index';
import { QueueSong } from '/@/shared/types/domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { PlayerRepeat, PlayerStatus } from '/@/shared/types/types';
const mprisPlayer = Player({
@@ -107,10 +107,6 @@ mprisPlayer.on('seek', (event: number) => {
});
});
mprisPlayer.on('raise', () => {
getMainWindow()?.show();
});
ipcMain.on('update-position', (_event, arg: number) => {
mprisPlayer.getPosition = () => arg * 1e6;
});
@@ -172,7 +168,7 @@ ipcMain.on('update-song', (_event, song: QueueSong | undefined) => {
'xesam:contentCreated': song.releaseDate,
'xesam:discNumber': song.discNumber ? song.discNumber : null,
'xesam:genre': song.genres?.length ? song.genres.map((genre: any) => genre.name) : null,
'xesam:lastUsed': song.lastPlayedAt,
'xesam:lastUsed': song.userLastPlayedDate,
'xesam:title': song.name || null,
'xesam:trackNumber': song.trackNumber ? song.trackNumber : null,
'xesam:useCount':
+1 -8
View File
@@ -44,10 +44,6 @@ export default class AppUpdater {
log.transports.file.level = 'info';
autoUpdater.logger = autoUpdaterLogInterface;
autoUpdater.checkForUpdatesAndNotify();
if (store.get('release_channel') === 'beta') {
autoUpdater.channel = 'beta';
}
}
}
@@ -493,10 +489,7 @@ async function createWindow(first = true): Promise<void> {
const menuBuilder = new MenuBuilder(mainWindow);
menuBuilder.buildMenu();
if (process.platform !== 'darwin') {
Menu.setApplicationMenu(null);
}
Menu.setApplicationMenu(null);
// Open URLs in the user's browser
mainWindow.webContents.setWindowOpenHandler((edata) => {
-23
View File
@@ -1,23 +0,0 @@
import { ipcRenderer } from 'electron';
import { DiscoveredServerItem } from '../shared/types/types';
const discover = (onReply: (server: DiscoveredServerItem) => void): Promise<void> => {
const { port1: local, port2: remote } = new MessageChannel();
ipcRenderer.postMessage('autodiscover-ping', {}, [remote]);
local.onmessage = (ev) => {
onReply(ev.data);
};
return new Promise<void>((resolve) => {
local.addEventListener('close', () => resolve());
});
};
export const autodiscover = {
discover,
};
export type AutoDiscover = typeof autodiscover;
-2
View File
@@ -1,7 +1,6 @@
import { electronAPI } from '@electron-toolkit/preload';
import { contextBridge } from 'electron';
import { autodiscover } from './autodiscover';
import { browser } from './browser';
import { discordRpc } from './discord-rpc';
import { ipc } from './ipc';
@@ -14,7 +13,6 @@ import { utils } from './utils';
// Custom APIs for renderer
const api = {
autodiscover,
browser,
discordRpc,
ipc,
+1 -1
View File
@@ -7,7 +7,7 @@ import {
LyricSource,
} from '../main/features/core/lyrics';
import { QueueSong } from '/@/shared/types/domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
const getRemoteLyricsBySong = (song: QueueSong) => {
const result = ipcRenderer.invoke('lyric-by-song', song);
+1 -1
View File
@@ -1,6 +1,6 @@
import { ipcRenderer, IpcRendererEvent } from 'electron';
import { PlayerData } from '/@/shared/types/domain-types';
import { PlayerData } from '/@/shared/types/domain/player-domain-types';
const initialize = (data: { extraParameters?: string[]; properties?: Record<string, any> }) => {
return ipcRenderer.invoke('player-initialize', data);
+1 -1
View File
@@ -1,6 +1,6 @@
import { ipcRenderer, IpcRendererEvent } from 'electron';
import { QueueSong } from '/@/shared/types/domain-types';
import { QueueSong, QueueSong } from '/@/shared/types/domain/player-domain-types';
import { PlayerStatus } from '/@/shared/types/types';
const requestFavorite = (
+172
View File
@@ -0,0 +1,172 @@
import {
ApiController,
ApiControllerError,
ApiControllerFn,
} from '/@/shared/types/adapter/api-controller-types';
import { ServerListItem } from '/@/shared/types/domain/server-domain-types';
import { logger } from '/@/shared/utils/logger';
export interface LoggingOptions {
logErrors?: boolean;
logPerformance?: boolean;
logRequests?: boolean;
logResponses?: boolean;
maxRequestSize?: number;
maxResponseSize?: number;
}
type LoggedApiControllerFn<TRequest, TResponse> = (
request: TRequest,
server: ServerListItem,
options?: any,
) => Promise<[ApiControllerError, null] | [null, TResponse]>;
export function createLoggedApiController(
controller: ApiController,
options: LoggingOptions = {},
): ApiController {
const loggedController: any = {};
// Log utility functions
loggedController._utility = createLoggedUtility(controller._utility);
// Log all controller methods
for (const [sectionKey, section] of Object.entries(controller)) {
if (sectionKey === '_utility') continue;
loggedController[sectionKey] = {};
for (const [methodKey, method] of Object.entries(section as Record<string, any>)) {
if (typeof method === 'function') {
const functionName = `${sectionKey}.${methodKey}`;
if (methodKey === 'authenticate' || methodKey === 'getType') {
// Special handling for non-standard API functions
loggedController[sectionKey][methodKey] = (...args: any[]) => {
logger.info(`[API] ${functionName} called`, {
args: JSON.stringify(args, null, 2),
});
return method(...args);
};
} else {
loggedController[sectionKey][methodKey] = createLoggedFunction(
method as ApiControllerFn<any, any>,
functionName,
options,
);
}
} else {
loggedController[sectionKey][methodKey] = method;
}
}
}
return loggedController as ApiController;
}
function createLoggedFunction<TRequest, TResponse>(
originalFn: ApiControllerFn<TRequest, TResponse> | undefined,
functionName: string,
options: LoggingOptions = {},
): LoggedApiControllerFn<TRequest, TResponse> | undefined {
if (!originalFn) {
return undefined;
}
return async (request: TRequest, requestOptions?: any) => {
const startTime = Date.now();
const requestId = Math.random().toString(36).substring(2, 15);
const {
logErrors = true,
logPerformance = true,
logRequests = true,
logResponses = true,
maxRequestSize = 1000,
maxResponseSize = 1000,
} = options;
if (logRequests) {
const requestStr = JSON.stringify(request, null, 2);
const truncatedRequest =
requestStr.length > maxRequestSize
? requestStr.substring(0, maxRequestSize) + '...'
: requestStr;
logger.info(`[API] ${functionName} called`, {
request: truncatedRequest,
requestId,
});
}
try {
const result = await originalFn(request, requestOptions);
const duration = Date.now() - startTime;
if (result[0]) {
// Error response
if (logErrors) {
const error = result[0] as ApiControllerError;
logger.error(`[API] ${functionName} failed`, {
duration: logPerformance ? `${duration}ms` : undefined,
error: {
code: error.code,
message: error.message,
},
requestId,
});
}
} else {
// Success response
if (logResponses) {
const response = result[1];
const responseStr = JSON.stringify(response);
const truncatedResponse =
responseStr.length > maxResponseSize
? responseStr.substring(0, maxResponseSize) + '...'
: responseStr;
logger.info(`[API] ${functionName} succeeded`, {
duration: logPerformance ? `${duration}ms` : undefined,
requestId,
response: truncatedResponse,
responseSize: responseStr.length,
responseType: typeof response,
});
}
}
return result;
} catch (error) {
const duration = Date.now() - startTime;
if (logErrors) {
logger.error(`[API] ${functionName} threw exception`, {
duration: logPerformance ? `${duration}ms` : undefined,
error: error instanceof Error ? error.message : String(error),
requestId,
stack: error instanceof Error ? error.stack : undefined,
});
}
throw error;
}
};
}
function createLoggedUtility<T extends Record<string, any>>(utility: T): T {
const loggedUtility: any = {};
for (const [key, value] of Object.entries(utility)) {
if (typeof value === 'function') {
loggedUtility[key] = (...args: any[]) => {
logger.debug(`[API] _utility.${key} called`, {
args: JSON.stringify(args, null, 2),
});
return value(...args);
};
} else {
loggedUtility[key] = value;
}
}
return loggedUtility as T;
}
+75
View File
@@ -0,0 +1,75 @@
import { createLoggedApiController } from '/@/renderer/api/api-controller-logger';
import { useAuthStore } from '/@/renderer/store';
import {
createApiClient as subsonicApiClient,
authenticate as subsonicAuthenticate,
controller as subsonicController,
middleware as subsonicMiddleware,
} from '/@/shared/api/subsonic/subsonic-controller';
import { ApiController } from '/@/shared/types/adapter/api-controller-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
export const serverApiMap = {
[ServerType.JELLYFIN]: {
apiClient: null,
authenticate: null,
controller: {},
middleware: null,
},
[ServerType.NAVIDROME]: {
apiClient: null,
authenticate: null,
controller: {},
middleware: null,
},
[ServerType.SUBSONIC]: {
apiClient: subsonicApiClient,
authenticate: subsonicAuthenticate,
controller: subsonicController,
middleware: subsonicMiddleware,
},
};
const getApiByServer = (serverId: string): ApiController => {
const servers = useAuthStore.getState().serverList;
const server = servers[serverId];
if (!server) {
throw new Error('No server or api client selected');
}
const { apiClient, controller, middleware } = serverApiMap[server.type];
if (!apiClient) {
throw new Error('No api client found');
}
const client = apiClient(server, middleware);
return createLoggedApiController(controller(client, server));
};
const getAppApi = () => {
const servers = useAuthStore.getState().serverList;
return Object.entries(servers).reduce(
(acc, [id]) => {
acc[id] = getApiByServer(id);
return acc;
},
{} as Record<string, ApiController>,
);
};
export const api = {
authenticate: (serverType: ServerType) => {
const { authenticate } = serverApiMap[serverType];
if (!serverType || !authenticate) {
throw new Error();
}
return authenticate;
},
controller: getAppApi(),
};
+3 -5
View File
@@ -4,11 +4,9 @@ import { NavidromeController } from '/@/renderer/api/navidrome/navidrome-control
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
import { useAuthStore } from '/@/renderer/store';
import { toast } from '/@/shared/components/toast/toast';
import {
AuthenticationResponse,
ControllerEndpoint,
ServerType,
} from '/@/shared/types/domain-types';
import { ControllerEndpoint } from '/@/shared/types/domain/api-domain-types';
import { AuthenticationResponse } from '/@/shared/types/domain/auth-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
type ApiController = {
jellyfin: ControllerEndpoint;
+1 -1
View File
@@ -11,7 +11,7 @@ import { authenticationFailure } from '/@/renderer/api/utils';
import { useAuthStore } from '/@/renderer/store';
import { jfType } from '/@/shared/api/jellyfin/jellyfin-types';
import { getClientType } from '/@/shared/api/utils';
import { ServerListItem } from '/@/shared/types/domain-types';
import { ServerListItem } from '/@/shared/types/domain/server-domain-types';
const c = initContract();
@@ -6,19 +6,13 @@ import { JFSongListSort, JFSortOrder } from '/@/shared/api/jellyfin.types';
import { jfNormalize } from '/@/shared/api/jellyfin/jellyfin-normalize';
import { jfType } from '/@/shared/api/jellyfin/jellyfin-types';
import { getFeatures, hasFeature, VersionInfo } from '/@/shared/api/utils';
import {
albumArtistListSortMap,
albumListSortMap,
ControllerEndpoint,
genreListSortMap,
LibraryItem,
Played,
playlistListSortMap,
Song,
songListSortMap,
sortOrderMap,
} from '/@/shared/types/domain-types';
import { ServerFeature } from '/@/shared/types/features-types';
import { albumListSortMap } from '/@/shared/types/domain/album-domain-types';
import { ControllerEndpoint } from '/@/shared/types/domain/api-domain-types';
import { albumArtistListSortMap } from '/@/shared/types/domain/artist-domain-types';
import { Played } from '/@/shared/types/domain/player-domain-types';
import { ServerFeature } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, sortOrderMap } from '/@/shared/types/domain/shared-domain-types';
import { Song, songListSortMap } from '/@/shared/types/domain/song-domain-types';
const formatCommaDelimitedString = (value: string[]) => {
return value.join(',');
@@ -326,7 +320,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query.searchTerm,
SortBy: albumListSortMap.jellyfin[query.sortBy] || 'SortName',
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
...query._custom?.jellyfin,
Years: yearsFilter,
},
@@ -338,14 +332,14 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.album(item, apiClientProps.server)),
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: res.body.TotalRecordCount,
};
},
getAlbumListCount: async ({ apiClientProps, query }) =>
JellyfinController.getAlbumList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getArtistList: async (args) => {
const { apiClientProps, query } = args;
@@ -360,7 +354,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query.searchTerm,
SortBy: albumArtistListSortMap.jellyfin[query.sortBy] || 'SortName,Name',
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
UserId: apiClientProps.server?.userId || undefined,
},
});
@@ -373,14 +367,14 @@ export const JellyfinController: ControllerEndpoint = {
items: res.body.Items.map((item) =>
jfNormalize.albumArtist(item, apiClientProps.server),
),
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: res.body.TotalRecordCount,
};
},
getArtistListCount: async ({ apiClientProps, query }) =>
JellyfinController.getArtistList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getDownloadUrl: (args) => {
const { apiClientProps, query } = args;
@@ -402,7 +396,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query?.searchTerm,
SortBy: genreListSortMap.jellyfin[query.sortBy] || 'SortName',
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
UserId: apiClientProps.server?.userId,
},
});
@@ -413,7 +407,7 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.genre(item, apiClientProps.server)),
startIndex: query.startIndex || 0,
offset: query.offset || 0,
totalRecordCount: res.body?.TotalRecordCount || 0,
};
},
@@ -462,7 +456,7 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: musicFolders.map(jfNormalize.musicFolder),
startIndex: 0,
offset: 0,
totalRecordCount: musicFolders?.length || 0,
};
},
@@ -509,7 +503,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query.searchTerm,
SortBy: playlistListSortMap.jellyfin[query.sortBy],
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
},
});
@@ -519,14 +513,14 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.playlist(item, apiClientProps.server)),
startIndex: 0,
offset: 0,
totalRecordCount: res.body.TotalRecordCount,
};
},
getPlaylistListCount: async ({ apiClientProps, query }) =>
JellyfinController.getPlaylistList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getPlaylistSongList: async (args) => {
const { apiClientProps, query } = args;
@@ -542,6 +536,10 @@ export const JellyfinController: ControllerEndpoint = {
query: {
Fields: 'Genres, DateCreated, MediaSources, UserData, ParentId, People, Tags',
IncludeItemTypes: 'Audio',
Limit: query.limit,
SortBy: query.sortBy ? songListSortMap.jellyfin[query.sortBy] : undefined,
SortOrder: query.sortOrder ? sortOrderMap.jellyfin[query.sortOrder] : undefined,
StartIndex: query.startIndex,
UserId: apiClientProps.server?.userId,
},
});
@@ -552,7 +550,7 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.song(item, apiClientProps.server, '')),
startIndex: 0,
offset: query.startIndex,
totalRecordCount: res.body.TotalRecordCount,
};
},
@@ -602,7 +600,7 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.song(item, apiClientProps.server, '')),
startIndex: 0,
offset: 0,
totalRecordCount: res.body.Items.length || 0,
};
},
@@ -627,34 +625,30 @@ export const JellyfinController: ControllerEndpoint = {
getSimilarSongs: async (args) => {
const { apiClientProps, query } = args;
if (apiClientProps.server?.preferInstantMix !== true) {
// Prefer getSimilarSongs, where possible, and not overridden.
// InstantMix can be overridden by plugins, so this may be preferred by the user.
// Otherwise, similarSongs may have a better output than InstantMix, if sufficient
// data exists from the server.
const res = await jfApiClient(apiClientProps).getSimilarSongs({
params: {
itemId: query.songId,
},
query: {
Fields: 'Genres, DateCreated, MediaSources, ParentId',
Limit: query.count,
UserId: apiClientProps.server?.userId || undefined,
},
});
// Prefer getSimilarSongs, where possible. Fallback to InstantMix
// where no similar songs were found.
const res = await jfApiClient(apiClientProps).getSimilarSongs({
params: {
itemId: query.songId,
},
query: {
Fields: 'Genres, DateCreated, MediaSources, ParentId',
Limit: query.count,
UserId: apiClientProps.server?.userId || undefined,
},
});
if (res.status === 200 && res.body.Items.length) {
const results = res.body.Items.reduce<Song[]>((acc, song) => {
if (song.Id !== query.songId) {
acc.push(jfNormalize.song(song, apiClientProps.server, ''));
}
return acc;
}, []);
if (results.length > 0) {
return results;
if (res.status === 200 && res.body.Items.length) {
const results = res.body.Items.reduce<Song[]>((acc, song) => {
if (song.Id !== query.songId) {
acc.push(jfNormalize.song(song, apiClientProps.server, ''));
}
return acc;
}, []);
if (results.length > 0) {
return results;
}
}
@@ -746,7 +740,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query.searchTerm,
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
...query._custom?.jellyfin,
Years: yearsFilter,
},
@@ -781,7 +775,7 @@ export const JellyfinController: ControllerEndpoint = {
SearchTerm: query.searchTerm,
SortBy: songListSortMap.jellyfin[query.sortBy] || 'Album,SortName',
SortOrder: sortOrderMap.jellyfin[query.sortOrder],
StartIndex: query.startIndex,
StartIndex: query.offset,
...query._custom?.jellyfin,
Years: yearsFilter,
},
@@ -810,14 +804,14 @@ export const JellyfinController: ControllerEndpoint = {
items: items.map((item) =>
jfNormalize.song(item, apiClientProps.server, '', query.imageSize),
),
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount,
};
},
getSongListCount: async ({ apiClientProps, query }) =>
JellyfinController.getSongList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getTags: async (args) => {
const { apiClientProps, query } = args;
@@ -873,7 +867,7 @@ export const JellyfinController: ControllerEndpoint = {
return {
items: res.body.Items.map((item) => jfNormalize.song(item, apiClientProps.server, '')),
startIndex: 0,
offset: 0,
totalRecordCount: res.body.TotalRecordCount,
};
},
+1 -1
View File
@@ -11,7 +11,7 @@ import { useAuthStore } from '/@/renderer/store';
import { ndType } from '/@/shared/api/navidrome/navidrome-types';
import { resultWithHeaders } from '/@/shared/api/utils';
import { toast } from '/@/shared/components/toast/toast';
import { ServerListItem } from '/@/shared/types/domain-types';
import { ServerListItem } from '/@/shared/types/domain/server-domain-types';
const localSettings = isElectron() ? window.api.localSettings : null;
@@ -3,28 +3,28 @@ import { ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
import { SubsonicController } from '/@/renderer/api/subsonic/subsonic-controller';
import { NDSongListSort } from '/@/shared/api/navidrome.types';
import { ndNormalize } from '/@/shared/api/navidrome/navidrome-normalize';
import { ssNormalize } from '/@/shared/api/subsonic/subsonic-normalize';
import { ndType } from '/@/shared/api/navidrome/navidrome-types';
import { normalize } from '/@/shared/api/subsonic/subsonic-normalize';
import { SubsonicExtensions } from '/@/shared/api/subsonic/subsonic-types';
import { getFeatures, hasFeature, VersionInfo } from '/@/shared/api/utils';
import { albumListSortMap } from '/@/shared/types/domain/album-domain-types';
import { ControllerEndpoint } from '/@/shared/types/domain/api-domain-types';
import { albumArtistListSortMap } from '/@/shared/types/domain/artist-domain-types';
import { AuthenticationResponse } from '/@/shared/types/domain/auth-domain-types';
import {
albumArtistListSortMap,
albumListSortMap,
AuthenticationResponse,
ControllerEndpoint,
genreListSortMap,
playlistListSortMap,
PlaylistSongListArgs,
PlaylistSongListRequest,
PlaylistSongListResponse,
} from '/@/shared/types/domain/playlist-domain-types';
import {
ServerFeature,
ServerFeatures,
ServerListItem,
Song,
songListSortMap,
sortOrderMap,
userListSortMap,
} from '/@/shared/types/domain-types';
import { ServerFeature } from '/@/shared/types/features-types';
} from '/@/shared/types/domain/server-domain-types';
import { sortOrderMap } from '/@/shared/types/domain/shared-domain-types';
import { Song, songListSortMap } from '/@/shared/types/domain/song-domain-types';
const VERSION_INFO: VersionInfo = [
['0.56.0', { [ServerFeature.TRACK_ALBUM_ARTIST_SEARCH]: [1] }],
['0.55.0', { [ServerFeature.BFR]: [1], [ServerFeature.TAGS]: [1] }],
['0.55.0', { [ServerFeature.BFR]: [1] }],
['0.49.3', { [ServerFeature.SHARING_ALBUM_SONG]: [1] }],
['0.48.0', { [ServerFeature.PLAYLISTS_SMART]: [1] }],
];
@@ -55,9 +55,6 @@ const excludeMissing = (server: null | ServerListItem) => {
return undefined;
};
const getArtistSongKey = (server: null | ServerListItem) =>
hasFeature(server, ServerFeature.TRACK_ALBUM_ARTIST_SEARCH) ? 'artists_id' : 'album_artist_id';
export const NavidromeController: ControllerEndpoint = {
addToPlaylist: async (args) => {
const { apiClientProps, body, query } = args;
@@ -271,19 +268,15 @@ export const NavidromeController: ControllerEndpoint = {
getAlbumList: async (args) => {
const { apiClientProps, query } = args;
const genres = hasFeature(apiClientProps.server, ServerFeature.BFR)
? query.genres
: query.genres?.[0];
const res = await ndApiClient(apiClientProps).getAlbumList({
query: {
_end: query.startIndex + (query.limit || 0),
_end: query.offset + (query.limit || 0),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: albumListSortMap.navidrome[query.sortBy],
_start: query.startIndex,
_start: query.offset,
artist_id: query.artistIds?.[0],
compilation: query.compilation,
genre_id: genres,
genre_id: query.genres?.[0],
name: query.searchTerm,
...query._custom?.navidrome,
starred: query.favorite,
@@ -297,24 +290,24 @@ export const NavidromeController: ControllerEndpoint = {
return {
items: res.body.data.map((album) => ndNormalize.album(album, apiClientProps.server)),
startIndex: query?.startIndex || 0,
offset: query?.offset || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
getAlbumListCount: async ({ apiClientProps, query }) =>
NavidromeController.getAlbumList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getArtistList: async (args) => {
const { apiClientProps, query } = args;
const res = await ndApiClient(apiClientProps).getAlbumArtistList({
query: {
_end: query.startIndex + (query.limit || 0),
_end: query.offset + (query.limit || 0),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: albumArtistListSortMap.navidrome[query.sortBy],
_start: query.startIndex,
_start: query.offset,
name: query.searchTerm,
...query._custom?.navidrome,
role: query.role || undefined,
@@ -339,14 +332,14 @@ export const NavidromeController: ControllerEndpoint = {
apiClientProps.server,
),
),
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
getArtistListCount: async ({ apiClientProps, query }) =>
NavidromeController.getArtistList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getDownloadUrl: SubsonicController.getDownloadUrl,
getGenreList: async (args) => {
@@ -354,10 +347,10 @@ export const NavidromeController: ControllerEndpoint = {
const res = await ndApiClient(apiClientProps).getGenreList({
query: {
_end: query.startIndex + (query.limit || 0),
_end: query.offset + (query.limit || 0),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: genreListSortMap.navidrome[query.sortBy],
_start: query.startIndex,
_start: query.offset,
name: query.searchTerm,
},
});
@@ -368,7 +361,7 @@ export const NavidromeController: ControllerEndpoint = {
return {
items: res.body.data.map((genre) => ndNormalize.genre(genre)),
startIndex: query.startIndex || 0,
offset: query.offset || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
@@ -404,10 +397,10 @@ export const NavidromeController: ControllerEndpoint = {
const res = await ndApiClient(apiClientProps).getPlaylistList({
query: {
_end: query.startIndex + (query.limit || 0),
_end: query.offset + (query.limit || 0),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: query.sortBy ? playlistListSortMap.navidrome[query.sortBy] : undefined,
_start: query.startIndex,
_start: query.offset,
q: query.searchTerm,
...customQuery,
},
@@ -419,16 +412,18 @@ export const NavidromeController: ControllerEndpoint = {
return {
items: res.body.data.map((item) => ndNormalize.playlist(item, apiClientProps.server)),
startIndex: query?.startIndex || 0,
offset: query?.offset || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
getPlaylistListCount: async ({ apiClientProps, query }) =>
NavidromeController.getPlaylistList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getPlaylistSongList: async (args: PlaylistSongListArgs): Promise<PlaylistSongListResponse> => {
getPlaylistSongList: async (
args: PlaylistSongListRequest,
): Promise<PlaylistSongListResponse> => {
const { apiClientProps, query } = args;
const res = await ndApiClient(apiClientProps).getPlaylistSongList({
@@ -436,9 +431,12 @@ export const NavidromeController: ControllerEndpoint = {
id: query.id,
},
query: {
_end: -1,
_order: 'ASC',
_start: 0,
_end: query.startIndex + (query.limit || -1),
_order: query.sortOrder ? sortOrderMap.navidrome[query.sortOrder] : 'ASC',
_sort: query.sortBy
? songListSortMap.navidrome[query.sortBy]
: ndType._enum.songList.ID,
_start: query.startIndex,
...excludeMissing(apiClientProps.server),
},
});
@@ -449,7 +447,7 @@ export const NavidromeController: ControllerEndpoint = {
return {
items: res.body.data.map((item) => ndNormalize.song(item, apiClientProps.server)),
startIndex: 0,
offset: query?.startIndex || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
@@ -470,20 +468,38 @@ export const NavidromeController: ControllerEndpoint = {
ping.body.serverVersion = '0.55.0';
}
const navidromeFeatures = getFeatures(VERSION_INFO, ping.body.serverVersion!);
const subsonicArgs = await SubsonicController.getServerInfo(args);
const navidromeFeatures: Record<string, number[]> = getFeatures(
VERSION_INFO,
ping.body.serverVersion!,
);
const features = {
...navidromeFeatures,
...subsonicArgs.features,
if (ping.body.openSubsonic) {
const res = await ssApiClient(apiClientProps).getServerInfo();
if (res.status !== 200) {
throw new Error('Failed to get server extensions');
}
// The type here isn't necessarily an array (even though it's supposed to be). This is
// an implementation detail of Navidrome 0.50. Do a type check to make sure it's actually
// an array, and not an empty object.
if (Array.isArray(res.body.openSubsonicExtensions)) {
for (const extension of res.body.openSubsonicExtensions) {
navidromeFeatures[extension.name] = extension.versions;
}
}
}
const features: ServerFeatures = {
bfr: navidromeFeatures[ServerFeature.BFR],
lyricsMultipleStructured: navidromeFeatures[SubsonicExtensions.SONG_LYRICS],
playlistsSmart: navidromeFeatures[ServerFeature.PLAYLISTS_SMART],
publicPlaylist: [1],
sharingAlbumSong: navidromeFeatures[ServerFeature.SHARING_ALBUM_SONG],
tags: navidromeFeatures[ServerFeature.BFR],
};
return {
features,
id: apiClientProps.server?.id,
version: ping.body.serverVersion!,
};
return { features, id: apiClientProps.server?.id, version: ping.body.serverVersion! };
},
getSimilarSongs: async (args) => {
const { apiClientProps, query } = args;
@@ -503,7 +519,7 @@ export const NavidromeController: ControllerEndpoint = {
if (res.status === 200 && res.body.similarSongs?.song) {
const similar = res.body.similarSongs.song.reduce<Song[]>((acc, song) => {
if (song.id !== query.songId) {
acc.push(ssNormalize.song(song, apiClientProps.server));
acc.push(normalize.song(song, apiClientProps.server));
}
return acc;
@@ -520,7 +536,7 @@ export const NavidromeController: ControllerEndpoint = {
_order: 'ASC',
_sort: NDSongListSort.RANDOM,
_start: 0,
[getArtistSongKey(apiClientProps.server)]: query.albumArtistIds,
album_artist_id: query.albumArtistIds,
...excludeMissing(apiClientProps.server),
},
});
@@ -557,13 +573,14 @@ export const NavidromeController: ControllerEndpoint = {
const res = await ndApiClient(apiClientProps).getSongList({
query: {
_end: query.startIndex + (query.limit || -1),
_end: query.offset + (query.limit || -1),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: songListSortMap.navidrome[query.sortBy],
_start: query.startIndex,
_start: query.offset,
album_artist_id: query.albumArtistIds,
album_id: query.albumIds,
artist_id: query.artistIds,
genre_id: query.genreIds,
[getArtistSongKey(apiClientProps.server)]: query.artistIds ?? query.albumArtistIds,
starred: query.favorite,
title: query.searchTerm,
...query._custom?.navidrome,
@@ -579,14 +596,14 @@ export const NavidromeController: ControllerEndpoint = {
items: res.body.data.map((song) =>
ndNormalize.song(song, apiClientProps.server, query.imageSize),
),
startIndex: query?.startIndex || 0,
offset: query?.offset || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
getSongListCount: async ({ apiClientProps, query }) =>
NavidromeController.getSongList({
apiClientProps,
query: { ...query, limit: 1, startIndex: 0 },
query: { ...query, limit: 1, offset: 0 },
}).then((result) => result!.totalRecordCount!),
getStructuredLyrics: SubsonicController.getStructuredLyrics,
getTags: async (args) => {
@@ -635,10 +652,10 @@ export const NavidromeController: ControllerEndpoint = {
const res = await ndApiClient(apiClientProps).getUserList({
query: {
_end: query.startIndex + (query.limit || 0),
_end: query.offset + (query.limit || 0),
_order: sortOrderMap.navidrome[query.sortOrder],
_sort: userListSortMap.navidrome[query.sortBy],
_start: query.startIndex,
_start: query.offset,
...query._custom?.navidrome,
},
});
@@ -649,7 +666,7 @@ export const NavidromeController: ControllerEndpoint = {
return {
items: res.body.data.map((user) => ndNormalize.user(user)),
startIndex: query?.startIndex || 0,
offset: query?.offset || 0,
totalRecordCount: Number(res.body.headers.get('x-total-count') || 0),
};
},
+41 -12
View File
@@ -1,26 +1,31 @@
import type {
import { QueryFunctionContext } from '@tanstack/react-query';
import { AlbumDetailQuery, AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import {
AlbumArtistDetailQuery,
AlbumArtistListQuery,
AlbumDetailQuery,
AlbumListQuery,
ArtistListQuery,
GenreListQuery,
} from '/@/shared/types/domain/artist-domain-types';
import { GenreListQuery } from '/@/shared/types/domain/genre-domain-types';
import {
LyricSearchQuery,
LyricSource,
LyricsQuery,
} from '/@/shared/types/domain/lyric-domain-types';
import {
PlaylistDetailQuery,
PlaylistListQuery,
PlaylistSongListQuery,
} from '/@/shared/types/domain/playlist-domain-types';
import { SearchQuery } from '/@/shared/types/domain/search-domain-types';
import {
RandomSongListQuery,
SearchQuery,
SimilarSongsQuery,
SongDetailQuery,
SongListQuery,
TopSongListQuery,
UserListQuery,
} from '/@/shared/types/domain-types';
import { QueryFunctionContext } from '@tanstack/react-query';
import { LyricSource } from '/@/shared/types/domain-types';
} from '/@/shared/types/domain/song-domain-types';
import { UserListQuery } from '/@/shared/types/domain/user-domain-types';
export const splitPaginatedQuery = (key: any) => {
const { limit, startIndex, ...filter } = key || {};
@@ -190,6 +195,21 @@ export const queryKeys: Record<
if (id) return [serverId, 'playlists', id, 'detail'] as const;
return [serverId, 'playlists', 'detail'] as const;
},
detailSongList: (serverId: string, id: string, query?: PlaylistSongListQuery) => {
const { filter, pagination } = splitPaginatedQuery(query);
if (query && id && pagination) {
return [serverId, 'playlists', id, 'detailSongList', filter, pagination] as const;
}
if (query && id) {
return [serverId, 'playlists', id, 'detailSongList', filter] as const;
}
if (id) return [serverId, 'playlists', id, 'detailSongList'] as const;
return [serverId, 'playlists', 'detailSongList'] as const;
},
list: (serverId: string, query?: PlaylistListQuery) => {
const { filter, pagination } = splitPaginatedQuery(query);
if (query && pagination) {
@@ -203,7 +223,16 @@ export const queryKeys: Record<
return [serverId, 'playlists', 'list'] as const;
},
root: (serverId: string) => [serverId, 'playlists'] as const,
songList: (serverId: string, id?: string) => {
songList: (serverId: string, id?: string, query?: PlaylistSongListQuery) => {
const { filter, pagination } = splitPaginatedQuery(query);
if (query && id && pagination) {
return [serverId, 'playlists', id, 'songList', filter, pagination] as const;
}
if (query && id) {
return [serverId, 'playlists', id, 'songList', filter] as const;
}
if (id) return [serverId, 'playlists', id, 'songList'] as const;
return [serverId, 'playlists', 'songList'] as const;
},
+1 -1
View File
@@ -7,7 +7,7 @@ import { z } from 'zod';
import i18n from '/@/i18n/i18n';
import { ssType } from '/@/shared/api/subsonic/subsonic-types';
import { toast } from '/@/shared/components/toast/toast';
import { ServerListItem } from '/@/shared/types/domain-types';
import { ServerListItem } from '/@/shared/types/domain/server-domain-types';
const c = initContract();
@@ -8,25 +8,18 @@ import { z } from 'zod';
import { contract, ssApiClient } from '/@/renderer/api/subsonic/subsonic-api';
import { randomString } from '/@/renderer/utils';
import { ssNormalize } from '/@/shared/api/subsonic/subsonic-normalize';
import { normalize } from '/@/shared/api/subsonic/subsonic-normalize';
import {
AlbumListSortType,
ssType,
SubsonicExtensions,
} from '/@/shared/api/subsonic/subsonic-types';
import {
AlbumListSort,
ControllerEndpoint,
GenreListSort,
LibraryItem,
PlaylistListSort,
Song,
sortAlbumArtistList,
sortAlbumList,
SortOrder,
sortSongList,
} from '/@/shared/types/domain-types';
import { ServerFeatures } from '/@/shared/types/features-types';
import { AlbumListSort, sortAlbumList } from '/@/shared/types/domain/album-domain-types';
import { ControllerEndpoint } from '/@/shared/types/domain/api-domain-types';
import { sortAlbumArtistList } from '/@/shared/types/domain/artist-domain-types';
import { ServerFeatures } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { Song, sortSongList } from '/@/shared/types/domain/song-domain-types';
const ALBUM_LIST_SORT_MAPPING: Record<AlbumListSort, AlbumListSortType | undefined> = {
[AlbumListSort.ALBUM_ARTIST]: AlbumListSortType.ALPHABETICAL_BY_ARTIST,
@@ -41,7 +34,7 @@ const ALBUM_LIST_SORT_MAPPING: Record<AlbumListSort, AlbumListSortType | undefin
[AlbumListSort.RATING]: undefined,
[AlbumListSort.RECENTLY_ADDED]: AlbumListSortType.NEWEST,
[AlbumListSort.RECENTLY_PLAYED]: AlbumListSortType.RECENT,
[AlbumListSort.RELEASE_DATE]: AlbumListSortType.BY_YEAR,
[AlbumListSort.RELEASE_DATE]: undefined,
[AlbumListSort.SONG_COUNT]: undefined,
[AlbumListSort.YEAR]: AlbumListSortType.BY_YEAR,
};
@@ -205,11 +198,11 @@ export const SubsonicController: ControllerEndpoint = {
}
return {
...ssNormalize.albumArtist(artist, apiClientProps.server, 300),
albums: artist.album?.map((album) => ssNormalize.album(album, apiClientProps.server)),
...normalize.albumArtist(artist, apiClientProps.server, 300),
albums: artist.album?.map((album) => normalize.album(album, apiClientProps.server)),
similarArtists:
artistInfo?.similarArtist?.map((artist) =>
ssNormalize.albumArtist(artist, apiClientProps.server, 300),
normalize.albumArtist(artist, apiClientProps.server, 300),
) || null,
};
},
@@ -229,7 +222,7 @@ export const SubsonicController: ControllerEndpoint = {
const artists = (res.body.artists?.index || []).flatMap((index) => index.artist);
let results = artists.map((artist) =>
ssNormalize.albumArtist(artist, apiClientProps.server, 300),
normalize.albumArtist(artist, apiClientProps.server, 300),
);
if (query.searchTerm) {
@@ -265,7 +258,7 @@ export const SubsonicController: ControllerEndpoint = {
throw new Error('Failed to get album detail');
}
return ssNormalize.album(res.body.album, apiClientProps.server);
return normalize.album(res.body.album, apiClientProps.server);
},
getAlbumList: async (args) => {
const { apiClientProps, query } = args;
@@ -274,7 +267,7 @@ export const SubsonicController: ControllerEndpoint = {
const res = await ssApiClient(apiClientProps).search3({
query: {
albumCount: query.limit,
albumOffset: query.startIndex,
albumOffset: query.offset,
artistCount: 0,
artistOffset: 0,
query: query.searchTerm || '',
@@ -289,12 +282,12 @@ export const SubsonicController: ControllerEndpoint = {
const results =
res.body.searchResult3?.album?.map((album) =>
ssNormalize.album(album, apiClientProps.server),
normalize.album(album, apiClientProps.server),
) || [];
return {
items: results,
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: null,
};
}
@@ -324,11 +317,11 @@ export const SubsonicController: ControllerEndpoint = {
return artist.body.artist.album ?? [];
});
const items = albums.map((album) => ssNormalize.album(album, apiClientProps.server));
const items = albums.map((album) => normalize.album(album, apiClientProps.server));
return {
items: sortAlbumList(items, query.sortBy, query.sortOrder),
startIndex: 0,
offset: 0,
totalRecordCount: albums.length,
};
}
@@ -346,12 +339,12 @@ export const SubsonicController: ControllerEndpoint = {
const results =
res.body.starred?.album?.map((album) =>
ssNormalize.album(album, apiClientProps.server),
normalize.album(album, apiClientProps.server),
) || [];
return {
items: sortAlbumList(results, query.sortBy, query.sortOrder),
startIndex: 0,
offset: 0,
totalRecordCount: res.body.starred?.album?.length || 0,
};
}
@@ -381,7 +374,7 @@ export const SubsonicController: ControllerEndpoint = {
}
if (type === AlbumListSortType.BY_YEAR && !fromYear && !toYear) {
if (query.sortOrder === SortOrder.ASC) {
if (query.sortOrder === ListSortOrder.ASC) {
fromYear = 0;
toYear = dayjs().year();
} else {
@@ -395,7 +388,7 @@ export const SubsonicController: ControllerEndpoint = {
fromYear,
genre: query.genres?.length ? query.genres[0] : undefined,
musicFolderId: query.musicFolderId,
offset: query.startIndex,
offset: query.offset,
size: query.limit,
toYear,
type,
@@ -409,9 +402,9 @@ export const SubsonicController: ControllerEndpoint = {
return {
items:
res.body.albumList2.album?.map((album) =>
ssNormalize.album(album, apiClientProps.server, 300),
normalize.album(album, apiClientProps.server, 300),
) || [],
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: null,
};
},
@@ -579,7 +572,7 @@ export const SubsonicController: ControllerEndpoint = {
}
let results = artists.map((artist) =>
ssNormalize.albumArtist(artist, apiClientProps.server, 300),
normalize.albumArtist(artist, apiClientProps.server, 300),
);
if (query.searchTerm) {
@@ -596,7 +589,7 @@ export const SubsonicController: ControllerEndpoint = {
return {
items: results,
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: results?.length || 0,
};
},
@@ -640,11 +633,11 @@ export const SubsonicController: ControllerEndpoint = {
break;
}
const genres = results.map(ssNormalize.genre);
const genres = results.map(normalize.genre);
return {
items: genres,
startIndex: 0,
offset: 0,
totalRecordCount: genres.length,
};
},
@@ -662,7 +655,7 @@ export const SubsonicController: ControllerEndpoint = {
id: folder.id.toString(),
name: folder.name,
})),
startIndex: 0,
offset: 0,
totalRecordCount: res.body.musicFolders.musicFolder.length,
};
},
@@ -679,7 +672,7 @@ export const SubsonicController: ControllerEndpoint = {
throw new Error('Failed to get playlist detail');
}
return ssNormalize.playlist(res.body.playlist, apiClientProps.server);
return normalize.playlist(res.body.playlist, apiClientProps.server);
},
getPlaylistList: async ({ apiClientProps, query }) => {
const sortOrder = query.sortOrder.toLowerCase() as 'asc' | 'desc';
@@ -724,8 +717,8 @@ export const SubsonicController: ControllerEndpoint = {
}
return {
items: results.map((playlist) => ssNormalize.playlist(playlist, apiClientProps.server)),
startIndex: 0,
items: results.map((playlist) => normalize.playlist(playlist, apiClientProps.server)),
offset: 0,
totalRecordCount: results.length,
};
},
@@ -759,14 +752,18 @@ export const SubsonicController: ControllerEndpoint = {
throw new Error('Failed to get playlist song list');
}
const items =
res.body.playlist.entry?.map((song) => ssNormalize.song(song, apiClientProps.server)) ||
let results =
res.body.playlist.entry?.map((song) => normalize.song(song, apiClientProps.server)) ||
[];
if (query.sortBy && query.sortOrder) {
results = sortSongList(results, query.sortBy, query.sortOrder);
}
return {
items,
startIndex: 0,
totalRecordCount: items.length,
items: results,
offset: 0,
totalRecordCount: results?.length || 0,
};
},
getRandomSongList: async (args) => {
@@ -789,8 +786,8 @@ export const SubsonicController: ControllerEndpoint = {
const results = res.body.randomSongs?.song || [];
return {
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)),
startIndex: 0,
items: results.map((song) => normalize.song(song, apiClientProps.server)),
offset: 0,
totalRecordCount: res.body.randomSongs?.song?.length || 0,
};
},
@@ -874,7 +871,7 @@ export const SubsonicController: ControllerEndpoint = {
return res.body.similarSongs.song.reduce<Song[]>((acc, song) => {
if (song.id !== query.songId) {
acc.push(ssNormalize.song(song, apiClientProps.server));
acc.push(normalize.song(song, apiClientProps.server));
}
return acc;
@@ -893,7 +890,7 @@ export const SubsonicController: ControllerEndpoint = {
throw new Error('Failed to get song detail');
}
return ssNormalize.song(res.body.song, apiClientProps.server);
return normalize.song(res.body.song, apiClientProps.server);
},
getSongList: async ({ apiClientProps, query }) => {
const fromAlbumPromises: Promise<ServerInferResponses<typeof contract.getAlbum>>[] = [];
@@ -908,7 +905,7 @@ export const SubsonicController: ControllerEndpoint = {
artistOffset: 0,
query: query.searchTerm || '',
songCount: query.limit,
songOffset: query.startIndex,
songOffset: query.offset,
},
});
@@ -919,9 +916,9 @@ export const SubsonicController: ControllerEndpoint = {
return {
items:
res.body.searchResult3?.song?.map((song) =>
ssNormalize.song(song, apiClientProps.server),
normalize.song(song, apiClientProps.server),
) || [],
startIndex: query.startIndex,
offset: query.offset,
totalRecordCount: null,
};
}
@@ -932,7 +929,7 @@ export const SubsonicController: ControllerEndpoint = {
count: query.limit,
genre: query.genreIds[0],
musicFolderId: query.musicFolderId,
offset: query.startIndex,
offset: query.offset,
},
});
@@ -943,8 +940,8 @@ export const SubsonicController: ControllerEndpoint = {
const results = res.body.songsByGenre?.song || [];
return {
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)) || [],
startIndex: 0,
items: results.map((song) => normalize.song(song, apiClientProps.server)) || [],
offset: 0,
totalRecordCount: null,
};
}
@@ -962,12 +959,12 @@ export const SubsonicController: ControllerEndpoint = {
const results =
(res.body.starred?.song || []).map((song) =>
ssNormalize.song(song, apiClientProps.server),
normalize.song(song, apiClientProps.server),
) || [];
return {
items: sortSongList(results, query.sortBy, query.sortOrder),
startIndex: 0,
offset: 0,
totalRecordCount: (res.body.starred?.song || []).length || 0,
};
}
@@ -1036,8 +1033,8 @@ export const SubsonicController: ControllerEndpoint = {
}
return {
items: results.map((song) => ssNormalize.song(song, apiClientProps.server)),
startIndex: 0,
items: results.map((song) => normalize.song(song, apiClientProps.server)),
offset: 0,
totalRecordCount: results.length,
};
}
@@ -1050,7 +1047,7 @@ export const SubsonicController: ControllerEndpoint = {
artistOffset: 0,
query: query.searchTerm || '',
songCount: query.limit,
songOffset: query.startIndex,
songOffset: query.offset,
},
});
@@ -1061,9 +1058,9 @@ export const SubsonicController: ControllerEndpoint = {
return {
items:
res.body.searchResult3?.song?.map((song) =>
ssNormalize.song(song, apiClientProps.server),
normalize.song(song, apiClientProps.server),
) || [],
startIndex: 0,
offset: 0,
totalRecordCount: null,
};
},
@@ -1298,9 +1295,9 @@ export const SubsonicController: ControllerEndpoint = {
return {
items:
res.body.topSongs?.song?.map((song) =>
ssNormalize.song(song, apiClientProps.server),
normalize.song(song, apiClientProps.server),
) || [],
startIndex: 0,
offset: 0,
totalRecordCount: res.body.topSongs?.song?.length || 0,
};
},
@@ -1368,13 +1365,13 @@ export const SubsonicController: ControllerEndpoint = {
return {
albumArtists: (res.body.searchResult3?.artist || [])?.map((artist) =>
ssNormalize.albumArtist(artist, apiClientProps.server),
normalize.albumArtist(artist, apiClientProps.server),
),
albums: (res.body.searchResult3?.album || []).map((album) =>
ssNormalize.album(album, apiClientProps.server),
normalize.album(album, apiClientProps.server),
),
songs: (res.body.searchResult3?.song || []).map((song) =>
ssNormalize.song(song, apiClientProps.server),
normalize.song(song, apiClientProps.server),
),
};
},
+1 -10
View File
@@ -190,16 +190,7 @@ export const App = () => {
return (
<MantineProvider defaultColorScheme={mode as 'dark' | 'light'} theme={theme}>
<Notifications
containerWidth="300px"
position="bottom-center"
styles={{
root: {
marginBottom: 90,
},
}}
zIndex={50000}
/>
<Notifications containerWidth="300px" position="bottom-center" zIndex={50000} />
<PlayQueueHandlerContext.Provider value={providerValue}>
<WebAudioContext.Provider value={webAudioProvider}>
<AppRouter />
+22 -20
View File
@@ -1,4 +1,3 @@
import type { Song } from '/@/shared/types/domain-types';
import type { CrossfadeStyle } from '/@/shared/types/types';
import type { ReactPlayerProps } from 'react-player';
@@ -20,9 +19,11 @@ import {
gaplessHandler,
} from '/@/renderer/components/audio-player/utils/list-handlers';
import { useWebAudio } from '/@/renderer/features/player/hooks/use-webaudio';
import { getServerById, TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store';
import { TranscodingConfig, usePlaybackSettings, useSpeed } from '/@/renderer/store';
import { useSettingsStore, useSettingsStoreActions } from '/@/renderer/store/settings.store';
import { toast } from '/@/shared/components/toast/toast';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { Song } from '/@/shared/types/domain/song-domain-types';
import { PlaybackStyle, PlayerStatus } from '/@/shared/types/types';
export type AudioPlayerProgress = {
@@ -57,27 +58,28 @@ const getDuration = (ref: any) => {
const EMPTY_SOURCE =
'data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU2LjM2LjEwMAAAAAAAAAAAAAAA//OEAAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAEAAABIADAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDV1dXV1dXV1dXV1dXV1dXV1dXV1dXV1dXV6urq6urq6urq6urq6urq6urq6urq6urq6v////////////////////////////////8AAAAATGF2YzU2LjQxAAAAAAAAAAAAAAAAJAAAAAAAAAAAASDs90hvAAAAAAAAAAAAAAAAAAAA//MUZAAAAAGkAAAAAAAAA0gAAAAATEFN//MUZAMAAAGkAAAAAAAAA0gAAAAARTMu//MUZAYAAAGkAAAAAAAAA0gAAAAAOTku//MUZAkAAAGkAAAAAAAAA0gAAAAANVVV';
const useSongUrl = (transcode: TranscodingConfig, current: boolean, song?: Song): null | string => {
const useSongUrl = (
transcode: TranscodingConfig,
current: boolean,
song?: QueueSong,
): null | string => {
const prior = useRef(['', '']);
return useMemo(() => {
if (song?.serverId) {
if (song?._serverId) {
// If we are the current track, we do not want a transcoding
// reconfiguration to force a restart.
if (current && prior.current[0] === song.uniqueId) {
return prior.current[1];
if (current && prior.current[0] === song._uniqueId) {
return prior.current[1] as string;
}
if (!transcode.enabled) {
// transcoding disabled; save the result
prior.current = [song.uniqueId, song.streamUrl];
prior.current = [song._uniqueId, song.streamUrl];
return song.streamUrl;
}
const result = api.controller.getTranscodingUrl({
apiClientProps: {
server: getServerById(song.serverId),
},
query: {
base: song.streamUrl,
...transcode,
@@ -85,14 +87,14 @@ const useSongUrl = (transcode: TranscodingConfig, current: boolean, song?: Song)
})!;
// transcoding enabled; save the updated result
prior.current = [song.uniqueId, result];
prior.current = [song._uniqueId, result];
return result;
}
// no track; clear result
prior.current = ['', ''];
return null;
}, [current, song?.uniqueId, song?.serverId, song?.streamUrl, transcode]);
}, [song?._serverId, song?._uniqueId, song?.streamUrl, current, transcode]);
};
export interface AudioPlayerRef {
@@ -233,17 +235,17 @@ export const AudioPlayer = forwardRef<AudioPlayerRef, AudioPlayerProps>((props,
}
const { error } = target;
console.log('Playback error occurred:', error);
if (
error?.code !== MediaError.MEDIA_ERR_DECODE &&
error?.code !== MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
) {
if (error?.code !== MediaError.MEDIA_ERR_DECODE) {
return;
}
handleOnEnded();
const duration = player.getDuration();
const currentTime = player.getCurrentTime();
// Decode error within last second, handle as track ended
if (duration && duration - currentTime < 1) {
handleOnEnded();
}
};
};
@@ -13,7 +13,7 @@ import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
import { Button } from '/@/shared/components/button/button';
import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Play } from '/@/shared/types/types';
export const CardControls = ({
+5 -2
View File
@@ -3,18 +3,21 @@ import formatDuration from 'format-duration';
import React from 'react';
import { generatePath } from 'react-router';
import { Link } from 'react-router-dom';
import { Song } from 'src/main/features/core/lyrics/netease';
import styles from './card-rows.module.css';
import { AppRoute } from '/@/renderer/router/routes';
import { formatDateAbsolute, formatDateRelative, formatRating } from '/@/renderer/utils/format';
import { Text } from '/@/shared/components/text/text';
import { Album, AlbumArtist, Artist, Playlist, Song } from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
import { Playlist } from '/@/shared/types/domain/playlist-domain-types';
import { CardRow } from '/@/shared/types/types';
interface CardRowsProps {
data: any;
rows: CardRow<Album>[] | CardRow<AlbumArtist>[] | CardRow<Artist>[];
rows: CardRow<Album>[] | CardRow<Artist>[];
}
export const CardRows = ({ data, rows }: CardRowsProps) => {
+4 -2
View File
@@ -8,12 +8,14 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/
import { Image } from '/@/shared/components/image/image';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Stack } from '/@/shared/components/stack/stack';
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
interface BaseGridCardProps {
controls: {
cardRows: CardRow<Album>[] | CardRow<AlbumArtist>[] | CardRow<Artist>[];
cardRows: CardRow<Album>[] | CardRow<Artist>[];
handleFavorite: (options: {
id: string[];
isFavorite: boolean;
@@ -20,7 +20,8 @@ import { Image } from '/@/shared/components/image/image';
import { Stack } from '/@/shared/components/stack/stack';
import { TextTitle } from '/@/shared/components/text-title/text-title';
import { Text } from '/@/shared/components/text/text';
import { Album, LibraryItem } from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Play } from '/@/shared/types/types';
const variants: Variants = {
@@ -24,13 +24,9 @@ import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
import { Stack } from '/@/shared/components/stack/stack';
import { TextTitle } from '/@/shared/components/text-title/text-title';
import {
Album,
AlbumArtist,
Artist,
LibraryItem,
RelatedArtist,
} from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist, RelatedArtist } from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { CardRoute, CardRow } from '/@/shared/types/types';
const getSlidesPerView = (windowWidth: number) => {
@@ -10,20 +10,17 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/
import { Image } from '/@/shared/components/image/image';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Stack } from '/@/shared/components/stack/stack';
import {
Album,
AlbumArtist,
Artist,
LibraryItem,
Playlist,
Song,
} from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
import { Playlist } from '/@/shared/types/domain/playlist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Song } from '/@/shared/types/domain/song-domain-types';
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
interface BaseGridCardProps {
columnIndex: number;
controls: {
cardRows: CardRow<Album | AlbumArtist | Artist | Playlist | Song>[];
cardRows: CardRow<Album | Artist | Playlist | Song>[];
handleFavorite: (options: {
id: string[];
isFavorite: boolean;
@@ -13,7 +13,7 @@ import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
import { Button } from '/@/shared/components/button/button';
import { Icon } from '/@/shared/components/icon/icon';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Play, PlayQueueAddOptions } from '/@/shared/types/types';
export const GridCardControls = ({
@@ -10,20 +10,17 @@ import { GridCardControls } from '/@/renderer/components/virtual-grid/grid-card/
import { Image } from '/@/shared/components/image/image';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Stack } from '/@/shared/components/stack/stack';
import {
Album,
AlbumArtist,
Artist,
LibraryItem,
Playlist,
Song,
} from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
import { Playlist } from '/@/shared/types/domain/playlist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Song } from '/@/shared/types/domain/song-domain-types';
import { CardRoute, CardRow, Play, PlayQueueAddOptions } from '/@/shared/types/types';
interface BaseGridCardProps {
columnIndex: number;
controls: {
cardRows: CardRow<Album | AlbumArtist | Artist | Playlist | Song>[];
cardRows: CardRow<Album | Artist | Playlist | Song>[];
handleFavorite: (options: {
id: string[];
isFavorite: boolean;
@@ -14,7 +14,9 @@ import { FixedSizeList } from 'react-window';
import styles from './virtual-grid-wrapper.module.css';
import { GridCard } from '/@/renderer/components/virtual-grid/grid-card';
import { Album, AlbumArtist, Artist, LibraryItem } from '/@/shared/types/domain-types';
import { Album } from '/@/shared/types/domain/album-domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
const createItemData = memoize(
(
@@ -72,7 +74,7 @@ export const VirtualGridWrapper = ({
width,
...rest
}: Omit<FixedSizeListProps, 'children' | 'height' | 'itemSize' | 'ref' | 'width'> & {
cardRows: CardRow<Album | AlbumArtist | Artist>[];
cardRows: CardRow<Album | Artist>[];
columnCount: number;
display: ListDisplayType;
handleFavorite?: (options: {
@@ -14,7 +14,8 @@ import {
import InfiniteLoader from 'react-window-infinite-loader';
import { VirtualGridWrapper } from '/@/renderer/components/virtual-grid/virtual-grid-wrapper';
import { AnyLibraryItem, Genre, LibraryItem } from '/@/shared/types/domain-types';
import { Genre } from '/@/shared/types/domain/genre-domain-types';
import { AnyLibraryItem, LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { ListDisplayType } from '/@/shared/types/types';
export type VirtualInfiniteGridRef = {
@@ -1,4 +1,3 @@
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
import React from 'react';
@@ -10,6 +9,7 @@ import { AppRoute } from '/@/renderer/router/routes';
import { Separator } from '/@/shared/components/separator/separator';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Text } from '/@/shared/components/text/text';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => {
if (value === undefined) {
@@ -23,7 +23,7 @@ export const AlbumArtistCell = ({ data, value }: ICellRendererParams) => {
return (
<CellContainer position="left">
<Text isMuted overflow="hidden" size="md">
{value?.map((item: AlbumArtist | Artist, index: number) => (
{value?.map((item: Artist, index: number) => (
<React.Fragment key={`row-${item.id}-${data.uniqueId}`}>
{index > 0 && <Separator />}
{item.id ? (
@@ -1,4 +1,3 @@
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
import React from 'react';
@@ -10,6 +9,7 @@ import { AppRoute } from '/@/renderer/router/routes';
import { Separator } from '/@/shared/components/separator/separator';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Text } from '/@/shared/components/text/text';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
export const ArtistCell = ({ data, value }: ICellRendererParams) => {
if (value === undefined) {
@@ -23,7 +23,7 @@ export const ArtistCell = ({ data, value }: ICellRendererParams) => {
return (
<CellContainer position="left">
<Text isMuted overflow="hidden" size="md">
{value?.map((item: AlbumArtist | Artist, index: number) => (
{value?.map((item: Artist, index: number) => (
<React.Fragment key={`row-${item.id}-${data.uniqueId}`}>
{index > 0 && <Separator />}
{item.id ? (
@@ -5,7 +5,7 @@ import styles from './combined-title-cell-controls.module.css';
import { usePlayQueueAdd } from '/@/renderer/features/player';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { ActionIcon } from '/@/shared/components/action-icon/action-icon';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { Play } from '/@/shared/types/types';
export const ListCoverControls = ({
@@ -12,7 +12,7 @@ import { SEPARATOR_STRING } from '/@/shared/api/utils';
import { Image } from '/@/shared/components/image/image';
import { Skeleton } from '/@/shared/components/skeleton/skeleton';
import { Text } from '/@/shared/components/text/text';
import { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
export const CombinedTitleCell = ({
context,
@@ -74,7 +74,7 @@ export const CombinedTitleCell = ({
</Text>
<Text isMuted overflow="hidden" size="md">
{artists?.length ? (
artists.map((artist: AlbumArtist | Artist, index: number) => (
artists.map((artist: Artist, index: number) => (
<React.Fragment key={`queue-${rowIndex}-artist-${artist.id}`}>
{index > 0 ? SEPARATOR_STRING : null}
{artist.id ? (
@@ -1,4 +1,3 @@
import type { AlbumArtist, Artist } from '/@/shared/types/domain-types';
import type { ICellRendererParams } from '@ag-grid-community/core';
import React from 'react';
@@ -8,13 +7,14 @@ import { CellContainer } from '/@/renderer/components/virtual-table/cells/generi
import { useGenreRoute } from '/@/renderer/hooks/use-genre-route';
import { Separator } from '/@/shared/components/separator/separator';
import { Text } from '/@/shared/components/text/text';
import { Artist } from '/@/shared/types/domain/artist-domain-types';
export const GenreCell = ({ data, value }: ICellRendererParams) => {
const genrePath = useGenreRoute();
return (
<CellContainer position="left">
<Text isMuted overflow="hidden" size="md">
{value?.map((item: AlbumArtist | Artist, index: number) => (
{value?.map((item: Artist, index: number) => (
<React.Fragment key={`row-${item.id}-${data.uniqueId}`}>
{index > 0 && <Separator />}
<Text
@@ -5,7 +5,7 @@ import { MutableRefObject, useEffect, useMemo, useRef } from 'react';
import { useAppFocus } from '/@/renderer/hooks';
import { useCurrentSong, usePlayerStore } from '/@/renderer/store';
import { Song } from '/@/shared/types/domain-types';
import { Song } from '/@/shared/types/domain/song-domain-types';
import { PlayerStatus } from '/@/shared/types/types';
interface UseCurrentSongRowStylesProps {
@@ -24,11 +24,11 @@ import { AppRoute } from '/@/renderer/router/routes';
import { PersistedTableColumn, useListStoreActions } from '/@/renderer/store';
import { ListKey, useListStoreByKey } from '/@/renderer/store/list.store';
import {
BasePaginatedQuery,
BasePaginatedResponse,
BaseQuery,
LibraryItem,
ServerListItem,
} from '/@/shared/types/domain-types';
} from '/@/shared/types/adapter/api-controller-types';
import { ServerListItem } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { ListDisplayType, TablePagination } from '/@/shared/types/types';
export type AgGridFetchFn<TResponse, TFilter> = (
@@ -52,7 +52,7 @@ interface UseAgGridProps<TFilter> {
const BLOCK_SIZE = 500;
export const useVirtualTable = <TFilter extends BaseQuery<any>>({
export const useVirtualTable = <TFilter extends BasePaginatedQuery<any>>({
columnType,
contextMenu,
customFilters,
@@ -18,7 +18,7 @@ import { Icon } from '/@/shared/components/icon/icon';
import { ScrollArea } from '/@/shared/components/scroll-area/scroll-area';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { ServerListItem, ServerType } from '/@/shared/types/domain-types';
import { ServerListItem, ServerType } from '/@/shared/types/domain/server-domain-types';
const localSettings = isElectron() ? window.api.localSettings : null;
@@ -0,0 +1,45 @@
import { queryOptions, UseQueryOptions } from '@tanstack/react-query';
import { api } from '/@/renderer/api/api-controller';
import { AlbumListRequest } from '/@/shared/types/domain/album-domain-types';
export const getAlbumListQueryKey = (serverId: string, request?: AlbumListRequest) => {
if (!request) {
return [serverId, 'albums'];
}
return [serverId, 'albums', request];
};
export const getInfiniteAlbumListQueryKey = (serverId: string, request?: AlbumListRequest) => {
if (!request) {
return [serverId, 'albums', 'infinite'];
}
return [serverId, 'albums', 'infinite', request];
};
export const getAlbumList = async (serverId: string, request: AlbumListRequest) => {
const [error, response] = await api.controller[serverId]!.album.getList!({
query: request.query,
});
if (error) {
throw new Error(error.message);
}
return response;
};
export const getAlbumListQuery = (
serverId: string,
request: AlbumListRequest,
options?: UseQueryOptions,
) => {
return queryOptions({
enabled: !!serverId,
queryFn: () => getAlbumList(serverId, request),
queryKey: getAlbumListQueryKey(serverId, request),
...options,
});
};
@@ -49,13 +49,9 @@ import { Group } from '/@/shared/components/group/group';
import { Popover } from '/@/shared/components/popover/popover';
import { Spoiler } from '/@/shared/components/spoiler/spoiler';
import { Stack } from '/@/shared/components/stack/stack';
import {
AlbumListQuery,
AlbumListSort,
LibraryItem,
QueueSong,
SortOrder,
} from '/@/shared/types/domain-types';
import { AlbumListQuery, AlbumListSort } from '/@/shared/types/domain/album-domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { Play } from '/@/shared/types/types';
const isFullWidthRow = (node: RowNode) => {
@@ -154,8 +150,8 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP
const artistQuery = useAlbumList({
options: {
cacheTime: 1000 * 60,
enabled: detailQuery?.data?.albumArtists[0]?.id !== undefined,
gcTime: 1000 * 60,
keepPreviousData: true,
staleTime: 1000 * 60,
},
@@ -169,9 +165,9 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP
? [detailQuery?.data?.albumArtists[0].id]
: undefined,
limit: 15,
offset: 0,
sortBy: AlbumListSort.YEAR,
sortOrder: SortOrder.DESC,
startIndex: 0,
sortOrder: ListSortOrder.DESC,
},
serverId: server?.id,
});
@@ -179,15 +175,15 @@ export const AlbumDetailContent = ({ background, tableRef }: AlbumDetailContentP
const relatedAlbumGenresRequest: AlbumListQuery = {
genres: detailQuery.data?.genres.length ? [detailQuery.data.genres[0].id] : undefined,
limit: 15,
offset: 0,
sortBy: AlbumListSort.RANDOM,
sortOrder: SortOrder.ASC,
startIndex: 0,
sortOrder: ListSortOrder.ASC,
};
const relatedAlbumGenresQuery = useAlbumList({
options: {
cacheTime: 1000 * 60,
enabled: !!detailQuery?.data?.genres?.[0],
gcTime: 1000 * 60,
queryKey: queryKeys.albums.related(
server?.id || '',
albumId,
@@ -16,7 +16,9 @@ import { Group } from '/@/shared/components/group/group';
import { Rating } from '/@/shared/components/rating/rating';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { AlbumDetailResponse, LibraryItem, ServerType } from '/@/shared/types/domain-types';
import { AlbumDetailResponse } from '/@/shared/types/domain/album-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface AlbumDetailHeaderProps {
background: {
@@ -21,8 +21,8 @@ import {
AlbumListQuery,
AlbumListResponse,
AlbumListSort,
LibraryItem,
} from '/@/shared/types/domain-types';
} from '/@/shared/types/domain/album-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { CardRow, ListDisplayType } from '/@/shared/types/types';
export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
@@ -137,15 +137,11 @@ export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
const itemData: Album[] = [];
for (const [, data] of queriesFromCache) {
const { items, startIndex } = data || {};
const { items, offset } = data || {};
if (items && items.length !== 1 && startIndex !== undefined) {
if (items && items.length !== 1 && offset !== undefined) {
let itemIndex = 0;
for (
let rowIndex = startIndex;
rowIndex < startIndex + items.length;
rowIndex += 1
) {
for (let rowIndex = offset; rowIndex < offset + items.length; rowIndex += 1) {
itemData[rowIndex] = items[itemIndex];
itemIndex += 1;
}
@@ -165,7 +161,7 @@ export const AlbumListGridView = ({ gridRef, itemCount }: any) => {
limit: take,
...filter,
...customFilters,
startIndex: skip,
offset: skip,
};
const queryKey = queryKeys.albums.list(server?.id || '', query, id);
@@ -34,158 +34,154 @@ import { DropdownMenu } from '/@/shared/components/dropdown-menu/dropdown-menu';
import { Flex } from '/@/shared/components/flex/flex';
import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
import {
AlbumListQuery,
AlbumListSort,
LibraryItem,
ServerType,
SortOrder,
} from '/@/shared/types/domain-types';
import { AlbumListQuery, AlbumListSort } from '/@/shared/types/domain/album-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { ListDisplayType, Play, TableColumn } from '/@/shared/types/types';
const FILTERS = {
jellyfin: [
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }),
value: AlbumListSort.ALBUM_ARTIST,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.communityRating', { postProcess: 'titleCase' }),
value: AlbumListSort.COMMUNITY_RATING,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.criticRating', { postProcess: 'titleCase' }),
value: AlbumListSort.CRITIC_RATING,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumListSort.NAME,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.playCount', { postProcess: 'titleCase' }),
value: AlbumListSort.PLAY_COUNT,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.random', { postProcess: 'titleCase' }),
value: AlbumListSort.RANDOM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }),
value: AlbumListSort.RECENTLY_ADDED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.releaseDate', { postProcess: 'titleCase' }),
value: AlbumListSort.RELEASE_DATE,
},
],
navidrome: [
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }),
value: AlbumListSort.ALBUM_ARTIST,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.artist', { postProcess: 'titleCase' }),
value: AlbumListSort.ARTIST,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.duration', { postProcess: 'titleCase' }),
value: AlbumListSort.DURATION,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }),
value: AlbumListSort.PLAY_COUNT,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumListSort.NAME,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.random', { postProcess: 'titleCase' }),
value: AlbumListSort.RANDOM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.rating', { postProcess: 'titleCase' }),
value: AlbumListSort.RATING,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }),
value: AlbumListSort.RECENTLY_ADDED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }),
value: AlbumListSort.RECENTLY_PLAYED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.songCount', { postProcess: 'titleCase' }),
value: AlbumListSort.SONG_COUNT,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.favorited', { postProcess: 'titleCase' }),
value: AlbumListSort.FAVORITED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }),
value: AlbumListSort.YEAR,
},
],
subsonic: [
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.albumArtist', { postProcess: 'titleCase' }),
value: AlbumListSort.ALBUM_ARTIST,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }),
value: AlbumListSort.PLAY_COUNT,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumListSort.NAME,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.random', { postProcess: 'titleCase' }),
value: AlbumListSort.RANDOM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }),
value: AlbumListSort.RECENTLY_ADDED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyPlayed', { postProcess: 'titleCase' }),
value: AlbumListSort.RECENTLY_PLAYED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.favorited', { postProcess: 'titleCase' }),
value: AlbumListSort.FAVORITED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.releaseYear', { postProcess: 'titleCase' }),
value: AlbumListSort.YEAR,
},
@@ -299,7 +295,7 @@ export const AlbumListHeaderFilters = ({
customFilters,
data: {
sortBy: e.currentTarget.value as AlbumListSort,
sortOrder: sortOrder || SortOrder.ASC,
sortOrder: sortOrder || ListSortOrder.ASC,
},
itemType: LibraryItem.ALBUM,
key: pageKey,
@@ -337,7 +333,8 @@ export const AlbumListHeaderFilters = ({
);
const handleToggleSortOrder = useCallback(() => {
const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC;
const newSortOrder =
filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC;
const updatedFilters = setFilter({
customFilters,
data: { sortOrder: newSortOrder },
@@ -16,7 +16,8 @@ import { titleCase } from '/@/renderer/utils';
import { Flex } from '/@/shared/components/flex/flex';
import { Group } from '/@/shared/components/group/group';
import { Stack } from '/@/shared/components/stack/stack';
import { AlbumListQuery, LibraryItem } from '/@/shared/types/domain-types';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface AlbumListHeaderProps {
genreId?: string;
@@ -4,7 +4,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use-
import { useListContext } from '/@/renderer/context/list-context';
import { ALBUM_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
import { useCurrentServer } from '/@/renderer/store';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
export const AlbumListTableView = ({ itemCount, tableRef }: any) => {
const server = useCurrentServer();
@@ -14,13 +14,10 @@ import { SpinnerIcon } from '/@/shared/components/spinner/spinner';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select';
import {
AlbumArtistListSort,
AlbumListQuery,
GenreListSort,
LibraryItem,
SortOrder,
} from '/@/shared/types/domain-types';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types';
import { GenreListSort } from '/@/shared/types/domain/genre-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
interface JellyfinAlbumFiltersProps {
customFilters?: Partial<AlbumListFilter>;
@@ -44,14 +41,14 @@ export const JellyfinAlbumFilters = ({
// TODO - eventually replace with /items/filters endpoint to fetch genres and tags specific to the selected library
const genreListQuery = useGenreList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
musicFolderId: filter?.musicFolderId,
sortBy: GenreListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
sortOrder: ListSortOrder.ASC,
offset: 0,
},
serverId,
});
@@ -66,7 +63,7 @@ export const JellyfinAlbumFilters = ({
const tagsQuery = useTagList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
@@ -173,12 +170,12 @@ export const JellyfinAlbumFilters = ({
const albumArtistListQuery = useAlbumArtistList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
sortBy: AlbumArtistListSort.NAME,
sortOrder: SortOrder.ASC,
sortOrder: ListSortOrder.ASC,
startIndex: 0,
},
serverId,
@@ -2,21 +2,12 @@ import debounce from 'lodash/debounce';
import { ChangeEvent, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import {
MultiSelectWithInvalidData,
SelectWithInvalidData,
} from '/@/renderer/components/select-with-invalid-data';
import { SelectWithInvalidData } from '/@/renderer/components/select-with-invalid-data';
import { useAlbumArtistList } from '/@/renderer/features/artists/queries/album-artist-list-query';
import { useGenreList } from '/@/renderer/features/genres';
import { useTagList } from '/@/renderer/features/tag/queries/use-tag-list';
import {
AlbumListFilter,
getServerById,
useListStoreActions,
useListStoreByKey,
} from '/@/renderer/store';
import { AlbumListFilter, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
import { NDSongQueryFields } from '/@/shared/api/navidrome.types';
import { hasFeature } from '/@/shared/api/utils';
import { Divider } from '/@/shared/components/divider/divider';
import { Group } from '/@/shared/components/group/group';
import { NumberInput } from '/@/shared/components/number-input/number-input';
@@ -25,14 +16,10 @@ import { Stack } from '/@/shared/components/stack/stack';
import { Switch } from '/@/shared/components/switch/switch';
import { Text } from '/@/shared/components/text/text';
import { YesNoSelect } from '/@/shared/components/yes-no-select/yes-no-select';
import {
AlbumArtistListSort,
AlbumListQuery,
GenreListSort,
LibraryItem,
SortOrder,
} from '/@/shared/types/domain-types';
import { ServerFeature } from '/@/shared/types/features-types';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types';
import { GenreListSort } from '/@/shared/types/domain/genre-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
interface NavidromeAlbumFiltersProps {
customFilters?: Partial<AlbumListFilter>;
@@ -52,17 +39,16 @@ export const NavidromeAlbumFilters = ({
const { t } = useTranslation();
const { filter } = useListStoreByKey<AlbumListQuery>({ key: pageKey });
const { setFilter } = useListStoreActions();
const server = getServerById(serverId);
const genreListQuery = useGenreList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
sortBy: GenreListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
sortOrder: ListSortOrder.ASC,
offset: 0,
},
serverId,
});
@@ -75,14 +61,12 @@ export const NavidromeAlbumFilters = ({
}));
}, [genreListQuery.data]);
const hasBrf = hasFeature(server, ServerFeature.BFR);
const handleGenresFilter = debounce((e: null | string[]) => {
const handleGenresFilter = debounce((e: null | string) => {
const updatedFilters = setFilter({
customFilters,
data: {
_custom: filter._custom,
genres: e ? e : undefined,
genres: e ? [e] : undefined,
},
itemType: LibraryItem.ALBUM,
key: pageKey,
@@ -92,7 +76,7 @@ export const NavidromeAlbumFilters = ({
const tagsQuery = useTagList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
@@ -201,13 +185,13 @@ export const NavidromeAlbumFilters = ({
const albumArtistListQuery = useAlbumArtistList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
// searchTerm: debouncedSearchTerm,
sortBy: AlbumArtistListSort.NAME,
sortOrder: SortOrder.ASC,
sortOrder: ListSortOrder.ASC,
startIndex: 0,
},
serverId,
@@ -282,29 +266,15 @@ export const NavidromeAlbumFilters = ({
min={0}
onChange={(e) => handleYearFilter(e)}
/>
{!hasBrf && (
<SelectWithInvalidData
clearable
data={genreList}
defaultValue={filter.genres && filter.genres[0]}
label={t('entity.genre', { count: 1, postProcess: 'titleCase' })}
onChange={(value) => handleGenresFilter(value !== null ? [value] : null)}
searchable
/>
)}
<SelectWithInvalidData
clearable
data={genreList}
defaultValue={filter.genres && filter.genres[0]}
label={t('entity.genre', { count: 1, postProcess: 'titleCase' })}
onChange={handleGenresFilter}
searchable
/>
</Group>
{hasBrf && (
<Group grow>
<MultiSelectWithInvalidData
clearable
data={genreList}
defaultValue={filter.genres}
label={t('entity.genre', { count: 2, postProcess: 'sentenceCase' })}
onChange={handleGenresFilter}
searchable
/>
</Group>
)}
<Group grow>
<SelectWithInvalidData
clearable
@@ -14,13 +14,10 @@ import { SpinnerIcon } from '/@/shared/components/spinner/spinner';
import { Stack } from '/@/shared/components/stack/stack';
import { Switch } from '/@/shared/components/switch/switch';
import { Text } from '/@/shared/components/text/text';
import {
AlbumArtistListSort,
AlbumListQuery,
GenreListSort,
LibraryItem,
SortOrder,
} from '/@/shared/types/domain-types';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import { AlbumArtistListSort } from '/@/shared/types/domain/artist-domain-types';
import { GenreListSort } from '/@/shared/types/domain/genre-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
interface SubsonicAlbumFiltersProps {
disableArtistFilter?: boolean;
@@ -42,12 +39,12 @@ export const SubsonicAlbumFilters = ({
const albumArtistListQuery = useAlbumArtistList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
sortBy: AlbumArtistListSort.NAME,
sortOrder: SortOrder.ASC,
sortOrder: ListSortOrder.ASC,
startIndex: 0,
},
serverId,
@@ -75,13 +72,13 @@ export const SubsonicAlbumFilters = ({
const genreListQuery = useGenreList({
options: {
cacheTime: 1000 * 60 * 2,
gcTime: 1000 * 60 * 2,
staleTime: 1000 * 60 * 1,
},
query: {
sortBy: GenreListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
sortOrder: ListSortOrder.ASC,
offset: 0,
},
serverId,
});
@@ -1,15 +1,15 @@
import type { QueryHookArgs } from '/@/renderer/lib/react-query';
import type { AlbumDetailQuery } from '/@/shared/types/domain-types';
import type { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useQuery } from '@tanstack/react-query';
import { controller } from '/@/renderer/api/controller';
import { queryKeys } from '/@/renderer/api/query-keys';
import { getServerById } from '/@/renderer/store';
import { useServerById } from '/@/renderer/store';
import { AlbumDetailQuery } from '/@/shared/types/domain/album-domain-types';
export const useAlbumDetail = (args: QueryHookArgs<AlbumDetailQuery>) => {
export const useAlbumDetail = (args: RQueryHookArgs<AlbumDetailQuery>) => {
const { options, query, serverId } = args;
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
queryFn: ({ signal }) => {
@@ -1,15 +1,15 @@
import type { QueryHookArgs } from '/@/renderer/lib/react-query';
import type { AlbumListQuery } from '/@/shared/types/domain-types';
import type { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { getServerById } from '/@/renderer/store';
import { useServerById } from '/@/renderer/store';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
export const useAlbumListCount = (args: QueryHookArgs<AlbumListQuery>) => {
export const useAlbumListCount = (args: RQueryHookArgs<AlbumListQuery>) => {
const { options, query, serverId } = args;
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!serverId,
@@ -1,16 +1,16 @@
import type { QueryHookArgs } from '/@/renderer/lib/react-query';
import type { AlbumListQuery, AlbumListResponse } from '/@/shared/types/domain-types';
import type { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useInfiniteQuery, useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { controller } from '/@/renderer/api/controller';
import { queryKeys } from '/@/renderer/api/query-keys';
import { getServerById } from '/@/renderer/store';
import { useServerById } from '/@/renderer/store';
import { AlbumListQuery, AlbumListResponse } from '/@/shared/types/domain/album-domain-types';
export const useAlbumList = (args: QueryHookArgs<AlbumListQuery>) => {
export const useAlbumList = (args: RQueryHookArgs<AlbumListQuery>) => {
const { options, query, serverId } = args;
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!serverId,
@@ -33,9 +33,9 @@ export const useAlbumList = (args: QueryHookArgs<AlbumListQuery>) => {
});
};
export const useAlbumListInfinite = (args: QueryHookArgs<AlbumListQuery>) => {
export const useAlbumListInfinite = (args: RQueryHookArgs<AlbumListQuery>) => {
const { options, query, serverId } = args;
const server = getServerById(serverId);
const server = useServerById(serverId);
return useInfiniteQuery({
enabled: !!serverId,
@@ -57,7 +57,7 @@ export const useAlbumListInfinite = (args: QueryHookArgs<AlbumListQuery>) => {
query: {
...query,
limit: query.limit || 50,
startIndex: pageParam * (query.limit || 50),
offset: pageParam * (query.limit || 50),
},
});
},
@@ -12,7 +12,7 @@ import { AnimatedPage, LibraryHeaderBar } from '/@/renderer/features/shared';
import { useFastAverageColor } from '/@/renderer/hooks';
import { useCurrentServer, useGeneralSettings } from '/@/renderer/store';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
const AlbumDetailRoute = () => {
const tableRef = useRef<AgGridReactType | null>(null);
@@ -16,12 +16,9 @@ import { usePlayQueueAdd } from '/@/renderer/features/player';
import { AnimatedPage } from '/@/renderer/features/shared';
import { queryClient } from '/@/renderer/lib/react-query';
import { useCurrentServer, useListFilterByKey } from '/@/renderer/store';
import {
AlbumListQuery,
GenreListSort,
LibraryItem,
SortOrder,
} from '/@/shared/types/domain-types';
import { AlbumListQuery } from '/@/shared/types/domain/album-domain-types';
import { GenreListSort } from '/@/shared/types/domain/genre-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { Play } from '/@/shared/types/types';
const AlbumListRoute = () => {
@@ -55,13 +52,13 @@ const AlbumListRoute = () => {
const genreList = useGenreList({
options: {
cacheTime: 1000 * 60 * 60,
gcTime: 1000 * 60 * 60,
enabled: !!genreId,
},
query: {
sortBy: GenreListSort.NAME,
sortOrder: SortOrder.ASC,
startIndex: 0,
sortOrder: ListSortOrder.ASC,
offset: 0,
},
serverId: server?.id,
});
@@ -77,7 +74,7 @@ const AlbumListRoute = () => {
const itemCountCheck = useAlbumListCount({
options: {
cacheTime: 1000 * 60,
gcTime: 1000 * 60,
staleTime: 1000 * 60,
},
query: {
@@ -33,7 +33,8 @@ import { Icon } from '/@/shared/components/icon/icon';
import { Spoiler } from '/@/shared/components/spoiler/spoiler';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { LibraryItem, SongDetailResponse } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { SongDetailResponse } from '/@/shared/types/domain/song-domain-types';
const DummyAlbumDetailRoute = () => {
const cq = useContainerQuery();
@@ -9,4 +9,8 @@
gap: var(--theme-spacing-lg);
padding: 1rem 2rem 5rem;
overflow: hidden;
:global(.ag-theme-alpine-dark) {
--ag-header-background-color: rgb(0 0 0 / 0%) !important;
}
}
@@ -35,15 +35,10 @@ import { Group } from '/@/shared/components/group/group';
import { Spoiler } from '/@/shared/components/spoiler/spoiler';
import { Stack } from '/@/shared/components/stack/stack';
import { TextTitle } from '/@/shared/components/text-title/text-title';
import {
Album,
AlbumArtist,
AlbumListSort,
LibraryItem,
QueueSong,
ServerType,
SortOrder,
} from '/@/shared/types/domain-types';
import { Album, AlbumListSort } from '/@/shared/types/domain/album-domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { CardRow, Play, TableColumn } from '/@/shared/types/types';
interface AlbumArtistDetailContentProps {
@@ -106,8 +101,8 @@ export const AlbumArtistDetailContent = ({ background }: AlbumArtistDetailConten
compilation: false,
limit: 15,
sortBy: AlbumListSort.RELEASE_DATE,
sortOrder: SortOrder.DESC,
startIndex: 0,
sortOrder: ListSortOrder.DESC,
offset: 0,
},
serverId: server?.id,
});
@@ -121,8 +116,8 @@ export const AlbumArtistDetailContent = ({ background }: AlbumArtistDetailConten
compilation: true,
limit: 15,
sortBy: AlbumListSort.RELEASE_DATE,
sortOrder: SortOrder.DESC,
startIndex: 0,
sortOrder: ListSortOrder.DESC,
offset: 0,
},
serverId: server?.id,
});
@@ -11,18 +11,16 @@ import { Group } from '/@/shared/components/group/group';
import { Rating } from '/@/shared/components/rating/rating';
import { Stack } from '/@/shared/components/stack/stack';
import { Text } from '/@/shared/components/text/text';
import { LibraryItem, ServerType } from '/@/shared/types/domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface AlbumArtistDetailHeaderProps {
background: {
background?: string;
blur: number;
loading: boolean;
};
background?: string;
loading: boolean;
}
export const AlbumArtistDetailHeader = forwardRef(
({ background }: AlbumArtistDetailHeaderProps, ref: Ref<HTMLDivElement>) => {
({ background, loading }: AlbumArtistDetailHeaderProps, ref: Ref<HTMLDivElement>) => {
const { albumArtistId, artistId } = useParams() as {
albumArtistId?: string;
artistId?: string;
@@ -79,11 +77,12 @@ export const AlbumArtistDetailHeader = forwardRef(
return (
<LibraryHeader
background={background}
imageUrl={detailQuery?.data?.imageUrl}
item={{ route: AppRoute.LIBRARY_ALBUM_ARTISTS, type: LibraryItem.ALBUM_ARTIST }}
loading={loading}
ref={ref}
title={detailQuery?.data?.name || ''}
{...background}
>
<Stack>
<Group>
@@ -12,7 +12,9 @@ import { SONG_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/conte
import { usePlayQueueAdd } from '/@/renderer/features/player';
import { useCurrentServer } from '/@/renderer/store';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { LibraryItem, QueueSong, SongListQuery } from '/@/shared/types/domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { SongListQuery } from '/@/shared/types/domain/song-domain-types';
interface AlbumArtistSongListContentProps {
data: QueueSong[];
@@ -6,7 +6,7 @@ import { LibraryHeaderBar } from '/@/renderer/features/shared';
import { usePlayButtonBehavior } from '/@/renderer/store/settings.store';
import { Badge } from '/@/shared/components/badge/badge';
import { SpinnerIcon } from '/@/shared/components/spinner/spinner';
import { QueueSong } from '/@/shared/types/domain-types';
import { QueueSong } from '/@/shared/types/domain/player-domain-types';
import { Play } from '/@/shared/types/types';
interface AlbumArtistDetailTopSongsListHeaderProps {
@@ -17,12 +17,11 @@ import { useHandleFavorite } from '/@/renderer/features/shared/hooks/use-handle-
import { AppRoute } from '/@/renderer/router/routes';
import { useCurrentServer, useListStoreActions, useListStoreByKey } from '/@/renderer/store';
import {
AlbumArtist,
AlbumArtistListQuery,
AlbumArtistListResponse,
AlbumArtistListSort,
LibraryItem,
} from '/@/shared/types/domain-types';
} from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { CardRow, ListDisplayType } from '/@/shared/types/types';
interface AlbumArtistListGridViewProps {
@@ -34,91 +34,90 @@ import { Icon } from '/@/shared/components/icon/icon';
import {
AlbumArtistListQuery,
AlbumArtistListSort,
LibraryItem,
ServerType,
SortOrder,
} from '/@/shared/types/domain-types';
} from '/@/shared/types/domain/artist-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { ListDisplayType } from '/@/shared/types/types';
const FILTERS = {
jellyfin: [
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.album', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.ALBUM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.duration', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.DURATION,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.NAME,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.random', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.RANDOM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.RECENTLY_ADDED,
},
// { defaultOrder: SortOrder.DESC, name: 'Release Date', value: AlbumArtistListSort.RELEASE_DATE },
// { defaultOrder: ListSortOrder.DESC, name: 'Release Date', value: AlbumArtistListSort.RELEASE_DATE },
],
navidrome: [
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.ALBUM_COUNT,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.FAVORITED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.PLAY_COUNT,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.NAME,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.rating', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.RATING,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.songCount', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.SONG_COUNT,
},
],
subsonic: [
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.ALBUM_COUNT,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.FAVORITED,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.NAME,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.rating', { postProcess: 'titleCase' }),
value: AlbumArtistListSort.RATING,
},
@@ -270,7 +269,7 @@ export const AlbumArtistListHeaderFilters = ({
const updatedFilters = setFilter({
data: {
sortBy: e.currentTarget.value as AlbumArtistListSort,
sortOrder: sortOrder || SortOrder.ASC,
sortOrder: sortOrder || ListSortOrder.ASC,
},
itemType: LibraryItem.ALBUM_ARTIST,
key: pageKey,
@@ -306,7 +305,8 @@ export const AlbumArtistListHeaderFilters = ({
);
const handleToggleSortOrder = useCallback(() => {
const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC;
const newSortOrder =
filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC;
const updatedFilters = setFilter({
data: { sortOrder: newSortOrder },
itemType: LibraryItem.ALBUM_ARTIST,
@@ -15,7 +15,8 @@ import { AlbumArtistListFilter, useCurrentServer } from '/@/renderer/store';
import { Flex } from '/@/shared/components/flex/flex';
import { Group } from '/@/shared/components/group/group';
import { Stack } from '/@/shared/components/stack/stack';
import { AlbumArtistListQuery, LibraryItem } from '/@/shared/types/domain-types';
import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface AlbumArtistListHeaderProps {
gridRef: MutableRefObject<null | VirtualInfiniteGridRef>;
@@ -8,7 +8,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use-
import { useListContext } from '/@/renderer/context/list-context';
import { ARTIST_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
import { useCurrentServer } from '/@/renderer/store';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface AlbumArtistListTableViewProps {
itemCount?: number;
@@ -18,12 +18,11 @@ import { AppRoute } from '/@/renderer/router/routes';
import { useCurrentServer, useListStoreActions } from '/@/renderer/store';
import { useListStoreByKey } from '/@/renderer/store/list.store';
import {
AlbumArtist,
ArtistListQuery,
ArtistListResponse,
ArtistListSort,
LibraryItem,
} from '/@/shared/types/domain-types';
} from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
import { CardRow, ListDisplayType } from '/@/shared/types/types';
interface ArtistListGridViewProps {
@@ -56,15 +55,11 @@ export const ArtistListGridView = ({ gridRef, itemCount }: ArtistListGridViewPro
const itemData: AlbumArtist[] = [];
for (const [, data] of queriesFromCache) {
const { items, startIndex } = data || {};
const { items, offset } = data || {};
if (items && items.length !== 1 && startIndex !== undefined) {
if (items && items.length !== 1 && offset !== undefined) {
let itemIndex = 0;
for (
let rowIndex = startIndex;
rowIndex < startIndex + items.length;
rowIndex += 1
) {
for (let rowIndex = offset; rowIndex < offset + items.length; rowIndex += 1) {
itemData[rowIndex] = items[itemIndex];
itemIndex += 1;
}
@@ -79,7 +74,7 @@ export const ArtistListGridView = ({ gridRef, itemCount }: ArtistListGridViewPro
const query: ArtistListQuery = {
...filter,
limit,
startIndex,
offset,
};
const queryKey = queryKeys.artists.list(server?.id || '', query);
@@ -33,93 +33,89 @@ import { Flex } from '/@/shared/components/flex/flex';
import { Group } from '/@/shared/components/group/group';
import { Icon } from '/@/shared/components/icon/icon';
import { Select } from '/@/shared/components/select/select';
import {
ArtistListQuery,
ArtistListSort,
LibraryItem,
ServerType,
SortOrder,
} from '/@/shared/types/domain-types';
import { ArtistListQuery, ArtistListSort } from '/@/shared/types/domain/artist-domain-types';
import { ServerType } from '/@/shared/types/domain/server-domain-types';
import { LibraryItem, ListSortOrder } from '/@/shared/types/domain/shared-domain-types';
import { ListDisplayType } from '/@/shared/types/types';
const FILTERS = {
jellyfin: [
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.album', { postProcess: 'titleCase' }),
value: ArtistListSort.ALBUM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.duration', { postProcess: 'titleCase' }),
value: ArtistListSort.DURATION,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: ArtistListSort.NAME,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.random', { postProcess: 'titleCase' }),
value: ArtistListSort.RANDOM,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.recentlyAdded', { postProcess: 'titleCase' }),
value: ArtistListSort.RECENTLY_ADDED,
},
],
navidrome: [
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }),
value: ArtistListSort.ALBUM_COUNT,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }),
value: ArtistListSort.FAVORITED,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.mostPlayed', { postProcess: 'titleCase' }),
value: ArtistListSort.PLAY_COUNT,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: ArtistListSort.NAME,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.rating', { postProcess: 'titleCase' }),
value: ArtistListSort.RATING,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.songCount', { postProcess: 'titleCase' }),
value: ArtistListSort.SONG_COUNT,
},
],
subsonic: [
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.albumCount', { postProcess: 'titleCase' }),
value: ArtistListSort.ALBUM_COUNT,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.isFavorited', { postProcess: 'titleCase' }),
value: ArtistListSort.FAVORITED,
},
{
defaultOrder: SortOrder.ASC,
defaultOrder: ListSortOrder.ASC,
name: i18n.t('filter.name', { postProcess: 'titleCase' }),
value: ArtistListSort.NAME,
},
{
defaultOrder: SortOrder.DESC,
defaultOrder: ListSortOrder.DESC,
name: i18n.t('filter.rating', { postProcess: 'titleCase' }),
value: ArtistListSort.RATING,
},
@@ -144,7 +140,7 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF
const cq = useContainerQuery();
const roles = useRoles({
options: {
cacheTime: 1000 * 60 * 60 * 2,
gcTime: 1000 * 60 * 60 * 2,
staleTime: 1000 * 60 * 60 * 2,
},
query: {},
@@ -192,7 +188,7 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF
},
query: {
limit,
startIndex,
offset,
...filters,
},
}),
@@ -228,7 +224,7 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF
},
query: {
limit,
startIndex,
offset,
...filters,
},
}),
@@ -276,7 +272,7 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF
const updatedFilters = setFilter({
data: {
sortBy: e.currentTarget.value as ArtistListSort,
sortOrder: sortOrder || SortOrder.ASC,
sortOrder: sortOrder || ListSortOrder.ASC,
},
itemType: LibraryItem.ARTIST,
key: pageKey,
@@ -312,7 +308,8 @@ export const ArtistListHeaderFilters = ({ gridRef, tableRef }: ArtistListHeaderF
);
const handleToggleSortOrder = useCallback(() => {
const newSortOrder = filter.sortOrder === SortOrder.ASC ? SortOrder.DESC : SortOrder.ASC;
const newSortOrder =
filter.sortOrder === ListSortOrder.ASC ? ListSortOrder.DESC : ListSortOrder.ASC;
const updatedFilters = setFilter({
data: { sortOrder: newSortOrder },
itemType: LibraryItem.ARTIST,
@@ -15,7 +15,8 @@ import { ArtistListFilter, useCurrentServer } from '/@/renderer/store';
import { Flex } from '/@/shared/components/flex/flex';
import { Group } from '/@/shared/components/group/group';
import { Stack } from '/@/shared/components/stack/stack';
import { ArtistListQuery, LibraryItem } from '/@/shared/types/domain-types';
import { ArtistListQuery } from '/@/shared/types/domain/artist-domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface ArtistListHeaderProps {
gridRef: MutableRefObject<null | VirtualInfiniteGridRef>;
@@ -8,7 +8,7 @@ import { useVirtualTable } from '/@/renderer/components/virtual-table/hooks/use-
import { useListContext } from '/@/renderer/context/list-context';
import { ARTIST_CONTEXT_MENU_ITEMS } from '/@/renderer/features/context-menu/context-menu-items';
import { useCurrentServer } from '/@/renderer/store';
import { LibraryItem } from '/@/shared/types/domain-types';
import { LibraryItem } from '/@/shared/types/domain/shared-domain-types';
interface ArtistListTableViewProps {
itemCount?: number;
@@ -1,15 +1,14 @@
import type { AlbumArtistDetailQuery } from '/@/shared/types/domain-types';
import { useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store';
import { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useServerById } from '/@/renderer/store';
import { AlbumArtistDetailQuery } from '/@/shared/types/domain/artist-domain-types';
export const useAlbumArtistDetail = (args: QueryHookArgs<AlbumArtistDetailQuery>) => {
export const useAlbumArtistDetail = (args: RQueryHookArgs<AlbumArtistDetailQuery>) => {
const { options, query, serverId } = args || {};
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!server?.id && !!query.id,
@@ -2,13 +2,13 @@ import { useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store';
import { AlbumArtistListQuery } from '/@/shared/types/domain-types';
import { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useServerById } from '/@/renderer/store';
import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types';
export const useAlbumArtistListCount = (args: QueryHookArgs<AlbumArtistListQuery>) => {
export const useAlbumArtistListCount = (args: RQueryHookArgs<AlbumArtistListQuery>) => {
const { options, query, serverId } = args;
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!serverId,
@@ -1,15 +1,14 @@
import type { AlbumArtistListQuery } from '/@/shared/types/domain-types';
import { useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store';
import { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useServerById } from '/@/renderer/store';
import { AlbumArtistListQuery } from '/@/shared/types/domain/artist-domain-types';
export const useAlbumArtistList = (args: QueryHookArgs<AlbumArtistListQuery>) => {
export const useAlbumArtistList = (args: RQueryHookArgs<AlbumArtistListQuery>) => {
const { options, query, serverId } = args || {};
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!server?.id,
@@ -1,15 +1,14 @@
import type { AlbumArtistDetailQuery } from '/@/shared/types/domain-types';
import { useQuery } from '@tanstack/react-query';
import { api } from '/@/renderer/api';
import { queryKeys } from '/@/renderer/api/query-keys';
import { QueryHookArgs } from '/@/renderer/lib/react-query';
import { getServerById } from '/@/renderer/store';
import { RQueryHookArgs } from '/@/renderer/lib/react-query';
import { useServerById } from '/@/renderer/store';
import { AlbumArtistDetailQuery } from '/@/shared/types/domain/artist-domain-types';
export const useAlbumArtistInfo = (args: QueryHookArgs<AlbumArtistDetailQuery>) => {
export const useAlbumArtistInfo = (args: RQueryHookArgs<AlbumArtistDetailQuery>) => {
const { options, query, serverId } = args || {};
const server = getServerById(serverId);
const server = useServerById(serverId);
return useQuery({
enabled: !!server?.id && !!query.id,

Some files were not shown because too many files have changed in this diff Show More