fix(library): use tauri file src for local artwork
This commit is contained in:
1 parent
cdf55e1d34
commit
84e19c0a02
2 files changed
+4
-4
No files matched your search
@@ -5,7 +5,7 @@
|
||||
* Reduces prop drilling by providing direct access to track operations.
|
||||
*/
|
||||
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { invoke, convertFileSrc } from '@tauri-apps/api/core';
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
import {
|
||||
addToQueueNext,
|
||||
@@ -69,7 +69,7 @@ export function buildQueueTrackFromPlaylistTrack(track: PlaylistTrack): BackendQ
|
||||
}
|
||||
|
||||
export function buildQueueTrackFromLocalTrack(track: LocalLibraryTrack): BackendQueueTrack {
|
||||
const artwork = track.artwork_path ? `asset://localhost/${encodeURIComponent(track.artwork_path)}` : null;
|
||||
const artwork = track.artwork_path ? convertFileSrc(track.artwork_path) : null;
|
||||
// Local tracks are hi-res if bit_depth > 16 or sample_rate > 44100
|
||||
const isHires = Boolean((track.bit_depth && track.bit_depth > 16) || (track.sample_rate && track.sample_rate > 44100));
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount, onDestroy } from 'svelte';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { invoke, convertFileSrc } from '@tauri-apps/api/core';
|
||||
import { listen, emitTo, type UnlistenFn } from '@tauri-apps/api/event';
|
||||
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
||||
|
||||
@@ -888,7 +888,7 @@
|
||||
async function handleLocalTrackPlay(track: LocalLibraryTrack) {
|
||||
console.log('Playing local track:', track);
|
||||
|
||||
const artwork = track.artwork_path ? `asset://localhost/${encodeURIComponent(track.artwork_path)}` : '';
|
||||
const artwork = track.artwork_path ? convertFileSrc(track.artwork_path) : '';
|
||||
const quality = track.bit_depth && track.sample_rate
|
||||
? (track.bit_depth >= 24 || track.sample_rate > 48000
|
||||
? `${track.bit_depth}bit/${track.sample_rate / 1000}kHz`
|
||||
|
||||
Reference in new issue
Block a user