use std::{sync::mpsc, thread};
use iced::Task;
use tracing::{error, warn};
use crate::{
app::{
interaction::{TrackListKind, TrackPos},
message::{BackendResult, Message},
view_data::ViewData,
MusicPlayer,
},
media_controls::{self, MediaControlEvent, MediaUpdate},
types::Track,
};
mod actions;
mod artist;
mod dispatch;
mod drag;
mod input;
mod navigation;
pub mod operation;
mod playback;
mod playlists;
mod search;
mod selection;
mod session;
pub mod settings;
pub use settings::SettingsChange;
mod tick;
mod translate;
mod updates;
pub use updates::{
cleanup_stale_update, spawn_update_download, spawn_version_check, UpdateStatus, APP_VERSION,
};
const DOUBLE_CLICK_MS: u128 = 300;
pub(crate) const PREPEND: usize = 0;
pub fn spawn_thumbnail_download(
entries: Vec<(crate::providers::ProviderId, String, String)>,
tx: &mpsc::Sender<BackendResult>,
) {
tracing::debug!(
"Spawning thumbnail download threads for {} entries",
entries.len()
);
for (provider, id, thumb) in entries {
let tx = tx.clone();
thread::spawn(move || {
crate::data::thumbnails::download(provider, &id, &thumb);
let _ = tx.send(BackendResult::ThumbnailDownloaded(provider, id));
});
}
}