fix(audio): use UltraHiRes quality for downloads and playback
- Changed download quality from HiRes to UltraHiRes to support 24-bit/192kHz - Updated playback streaming to use UltraHiRes for highest quality - Added debug logging for artwork path storage and retrieval - Quality fallback will still work for lower subscription tiers cp
This commit is contained in:
1 parent
2d82d74b7f
commit
6ac622d69b
3 files changed
+18
-9
No files matched your search
@@ -73,9 +73,9 @@ pub async fn play_track(
|
||||
|
||||
let client = state.client.lock().await;
|
||||
|
||||
// Get the stream URL
|
||||
// Get the stream URL with highest quality available
|
||||
let stream_url = client
|
||||
.get_stream_url_with_fallback(track_id, Quality::HiRes)
|
||||
.get_stream_url_with_fallback(track_id, Quality::UltraHiRes)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get stream URL: {}", e))?;
|
||||
|
||||
@@ -147,7 +147,7 @@ pub async fn prefetch_track(
|
||||
|
||||
let client = state.client.lock().await;
|
||||
let stream_url = client
|
||||
.get_stream_url_with_fallback(track_id, Quality::HiRes)
|
||||
.get_stream_url_with_fallback(track_id, Quality::UltraHiRes)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get stream URL: {}", e))?;
|
||||
drop(client);
|
||||
@@ -239,7 +239,7 @@ fn spawn_prefetch(
|
||||
let result = async {
|
||||
let client_guard = client_clone.lock().await;
|
||||
let stream_url = client_guard
|
||||
.get_stream_url_with_fallback(track_id, Quality::HiRes)
|
||||
.get_stream_url_with_fallback(track_id, Quality::UltraHiRes)
|
||||
.await
|
||||
.map_err(|e| format!("Failed to get stream URL: {}", e))?;
|
||||
drop(client_guard);
|
||||
|
||||
@@ -46,7 +46,11 @@ async fn post_process_track(
|
||||
// Extract album directory from the new_path
|
||||
if let Some(parent_dir) = std::path::Path::new(&new_path).parent() {
|
||||
match save_album_artwork(parent_dir, artwork_url).await {
|
||||
Ok(_) => Some(parent_dir.join("cover.jpg").to_string_lossy().to_string()),
|
||||
Ok(_) => {
|
||||
let cover_path = parent_dir.join("cover.jpg").to_string_lossy().to_string();
|
||||
log::info!("Album artwork saved for track {}: {}", track_id, cover_path);
|
||||
Some(cover_path)
|
||||
},
|
||||
Err(e) => {
|
||||
log::warn!("Failed to save album artwork for track {}: {}", track_id, e);
|
||||
None
|
||||
@@ -56,6 +60,7 @@ async fn post_process_track(
|
||||
None
|
||||
}
|
||||
} else {
|
||||
log::warn!("No artwork URL available for track {}", track_id);
|
||||
None
|
||||
};
|
||||
|
||||
@@ -98,7 +103,7 @@ async fn post_process_track(
|
||||
sample_rate,
|
||||
artwork_path.as_deref(),
|
||||
) {
|
||||
Ok(_) => log::info!("Track {} inserted to local library DB with group key: {}", track_id, album_group_key),
|
||||
Ok(_) => log::info!("Track {} inserted to local library DB with group key: {}, artwork: {:?}", track_id, album_group_key, artwork_path),
|
||||
Err(e) => log::error!("Failed to insert track {} to library DB: {}", track_id, e),
|
||||
}
|
||||
|
||||
@@ -186,11 +191,11 @@ pub async fn download_track(
|
||||
"trackId": track_id
|
||||
}));
|
||||
|
||||
// Get stream URL
|
||||
// Get stream URL with highest quality available
|
||||
let stream_url = {
|
||||
let client_guard = client.lock().await;
|
||||
client_guard
|
||||
.get_stream_url_with_fallback(track_id, Quality::HiRes)
|
||||
.get_stream_url_with_fallback(track_id, Quality::UltraHiRes)
|
||||
.await
|
||||
};
|
||||
|
||||
|
||||
@@ -509,12 +509,16 @@ impl LibraryDatabase {
|
||||
let group_key: String = row.get(0)?;
|
||||
let album: String = row.get(1)?;
|
||||
let artist: String = row.get(2)?;
|
||||
let artwork_path: Option<String> = row.get(4)?;
|
||||
|
||||
log::debug!("Album grouping {}: artwork_path = {:?}", group_key, artwork_path);
|
||||
|
||||
Ok(LocalAlbum {
|
||||
id: group_key.clone(),
|
||||
title: album,
|
||||
artist,
|
||||
year: row.get(3)?,
|
||||
artwork_path: row.get(4)?,
|
||||
artwork_path,
|
||||
track_count: row.get(5)?,
|
||||
total_duration_secs: row.get(6)?,
|
||||
format: Self::parse_format(
|
||||
|
||||
Reference in new issue
Block a user