Skip to content

Commit

Permalink
Fix album cover art #4
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovenoboyo committed Dec 22, 2024
1 parent b4e4691 commit 59244e3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
11 changes: 9 additions & 2 deletions src/components/cardview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use std::rc::Rc;
use crate::{
components::provider_icon::ProviderIcon,
icons::{play_hover_icon::PlayHoverIcon, song_default_icon::SongDefaultIcon},
utils::common::convert_file_src,
};
use leptos::{component, create_rw_signal, view, IntoView, SignalGet, SignalSet};
use leptos_router::A;
use leptos_virtual_scroller::VirtualGridScroller;
use serde::Serialize;
use types::errors::MoosyncError;

type CardContextMenu<T> = Option<Rc<Box<dyn Fn(leptos::ev::MouseEvent, T)>>>;

Expand Down Expand Up @@ -82,9 +84,14 @@ where
} else {
view! {
<img
src=item.cover.clone()
src=item.cover.clone().map(convert_file_src)
class="rounded-corners img-fluid w-100 h-100"
on:error=move |_| show_default_icon.set(true)
on:error=move |e| {
tracing::error!(
"Error loading cover image {:?}", MoosyncError::from(e.error())
);
show_default_icon.set(true);
}
/>
}
.into_view()
Expand Down
1 change: 0 additions & 1 deletion src/components/prefs/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ pub fn PathsPref(
});

let start_scan = move |_| {
tracing::info!("Starting scan");
spawn_local(async move {
let _ = crate::utils::invoke::start_scan(None, true).await;
})
Expand Down
4 changes: 2 additions & 2 deletions src/pages/albums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::components::songview::SongView;
use crate::dyn_provider_songs;
use crate::store::player_store::PlayerStore;
use crate::store::provider_store::ProviderStore;
use crate::utils::common::fetch_infinite;
use crate::utils::common::{convert_file_src, fetch_infinite};
use crate::utils::songs::get_songs_from_indices;
use leptos::{
component, create_effect, create_memo, create_rw_signal, create_write_slice, expect_context,
Expand Down Expand Up @@ -53,7 +53,7 @@ pub fn SingleAlbum() -> impl IntoView {
if let Some(album) = album {
default_details.update(|d| {
d.title = album.album_name.clone();
d.icon = album.album_coverpath_high.clone();
d.icon = album.album_coverpath_high.clone().map(convert_file_src);
});

get_songs_by_option(
Expand Down
4 changes: 2 additions & 2 deletions src/pages/artists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::components::songlist::ShowProvidersArgs;
use crate::dyn_provider_songs;
use crate::store::player_store::PlayerStore;
use crate::store::provider_store::ProviderStore;
use crate::utils::common::fetch_infinite;
use crate::utils::common::{convert_file_src, fetch_infinite};
use crate::utils::db_utils::get_artists_by_option;
use crate::utils::songs::get_songs_from_indices;
use leptos::{
Expand Down Expand Up @@ -54,7 +54,7 @@ pub fn SingleArtist() -> impl IntoView {
if let Some(artist) = artist {
default_details.update(|d| {
d.title = artist.artist_name.clone();
d.icon = artist.artist_coverpath.clone();
d.icon = artist.artist_coverpath.clone().map(convert_file_src);
});

get_songs_by_option(
Expand Down
4 changes: 2 additions & 2 deletions src/pages/playlists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::components::songview::SongView;
use crate::store::modal_store::{ModalStore, Modals};
use crate::store::player_store::PlayerStore;
use crate::store::ui_store::{PlaylistSortByColumns, UiStore};
use crate::utils::common::fetch_infinite;
use crate::utils::common::{convert_file_src, fetch_infinite};
use crate::utils::db_utils::{
create_playlist, export_playlist, get_songs_by_option, remove_playlist,
};
Expand Down Expand Up @@ -139,7 +139,7 @@ pub fn SinglePlaylist() -> impl IntoView {
if let Some(playlist) = playlist {
default_details.update(|d| {
d.title = Some(playlist.playlist_name.clone());
d.icon = playlist.playlist_coverpath.clone();
d.icon = playlist.playlist_coverpath.clone().map(convert_file_src);
});

let playlist_id = playlist.playlist_id.clone().unwrap();
Expand Down

0 comments on commit 59244e3

Please sign in to comment.