Large bugfix
This commit is contained in:
parent
d482acca94
commit
913da0c0ef
4
Cargo.lock
generated
4
Cargo.lock
generated
@ -2356,8 +2356,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "soundcloud"
|
||||
version = "0.1.9"
|
||||
source = "git+https://gitea.awain.net/alterwain/soundcloud_api.git#a6732847bebbcb6e59a1b8a44a965fe7092af6e9"
|
||||
version = "0.1.11"
|
||||
source = "git+https://gitea.awain.net/alterwain/soundcloud_api.git#06a9c773fc01e37867298a4985899be843aeb3ae"
|
||||
dependencies = [
|
||||
"hyper-util",
|
||||
"regex",
|
||||
|
@ -20,7 +20,7 @@ crossterm = { version = "0.28.1", features = ["event-stream"] }
|
||||
futures = "0.3"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
tokio-util = { version = "0.7.12", features = ["codec"] }
|
||||
soundcloud = { version = "0.1.9", git = "https://gitea.awain.net/alterwain/soundcloud_api.git" }
|
||||
soundcloud = { version = "0.1.11", git = "https://gitea.awain.net/alterwain/soundcloud_api.git" }
|
||||
youtube-api = { version = "0.1.1", git = "https://gitea.awain.net/alterwain/youtube_api.git" }
|
||||
itunesdb = { version = "0.1.99", git = "https://gitea.awain.net/alterwain/ITunesDB.git" }
|
||||
rand = "0.8.5"
|
||||
|
@ -419,21 +419,23 @@ impl MainScreen {
|
||||
self.set_mode(self.mode);
|
||||
|
||||
if let Some(pls) = &self.youtube {
|
||||
let y = &pls.get(self.pl_table.selected_row()).unwrap().videos;
|
||||
let data = y
|
||||
.iter()
|
||||
.map(|video| {
|
||||
vec![
|
||||
video.videoId.clone(),
|
||||
video.title.clone(),
|
||||
video.publisher.clone(),
|
||||
video.lengthSeconds.to_string(),
|
||||
String::new(),
|
||||
]
|
||||
})
|
||||
.collect::<Vec<Vec<String>>>();
|
||||
if let Some(ypl) = &pls.get(self.pl_table.selected_row()) {
|
||||
let y = ypl.videos.clone();
|
||||
let data = y
|
||||
.iter()
|
||||
.map(|video| {
|
||||
vec![
|
||||
video.videoId.clone(),
|
||||
video.title.clone(),
|
||||
video.publisher.clone(),
|
||||
video.lengthSeconds.to_string(),
|
||||
String::new(),
|
||||
]
|
||||
})
|
||||
.collect::<Vec<Vec<String>>>();
|
||||
|
||||
self.song_table.set_data(data);
|
||||
self.song_table.set_data(data);
|
||||
}
|
||||
}
|
||||
self.song_table.set_title(" Songs ".to_string());
|
||||
}
|
||||
|
48
src/sync.rs
48
src/sync.rs
@ -940,36 +940,36 @@ async fn parse_itunes(sender: &Sender<AppEvent>, path: String) -> XDatabase {
|
||||
tokio::spawn(async move {
|
||||
let app_version = soundcloud::get_app().await.unwrap().unwrap();
|
||||
let client_id = soundcloud::get_client_id().await.unwrap().unwrap();
|
||||
let playlists =
|
||||
if let Ok(playlists) =
|
||||
soundcloud::get_playlists(soundcloud_user_id, client_id.clone(), app_version.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
{
|
||||
let mut playlists = playlists.collection;
|
||||
|
||||
let mut playlists = playlists.collection;
|
||||
|
||||
for playlist in playlists.iter_mut() {
|
||||
let trr = playlist.tracks.clone();
|
||||
playlist.tracks = Vec::new();
|
||||
for pl_tracks in trr.clone().chunks(45) {
|
||||
if let Ok(tracks) = soundcloud::get_tracks(
|
||||
pl_tracks.to_vec(),
|
||||
client_id.clone(),
|
||||
app_version.clone(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
let mut tracks = tracks;
|
||||
tracks.retain(|t| t.title.is_some());
|
||||
playlist.tracks.append(&mut tracks);
|
||||
for playlist in playlists.iter_mut() {
|
||||
let trr = playlist.tracks.clone();
|
||||
playlist.tracks = Vec::new();
|
||||
for pl_tracks in trr.clone().chunks(45) {
|
||||
if let Ok(tracks) = soundcloud::get_tracks(
|
||||
pl_tracks.to_vec(),
|
||||
client_id.clone(),
|
||||
app_version.clone(),
|
||||
)
|
||||
.await
|
||||
{
|
||||
let mut tracks = tracks;
|
||||
tracks.retain(|t| t.title.is_some());
|
||||
playlist.tracks.append(&mut tracks);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let _ = soundcloud_sender
|
||||
.send(AppEvent::SoundcloudGot(CloudPlaylists {
|
||||
collection: playlists,
|
||||
}))
|
||||
.await;
|
||||
let _ = soundcloud_sender
|
||||
.send(AppEvent::SoundcloudGot(CloudPlaylists {
|
||||
collection: playlists,
|
||||
}))
|
||||
.await;
|
||||
}
|
||||
});
|
||||
|
||||
database
|
||||
|
Loading…
x
Reference in New Issue
Block a user