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