Update playlists
This commit is contained in:
parent
3a196153ba
commit
587f82932b
@ -15,24 +15,9 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="52900e09-9584-4b6c-95ff-fbd4ed5d8b2c" name="Changes" comment="Add interface package. Start adding auth stuff for refreshing tokens.">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/Cargo.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/migrations/20230816135241_initial.sql" beforeDir="false" afterPath="$PROJECT_DIR$/migrations/20230816135241_initial.sql" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/Cargo.lock" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/Cargo.lock" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/Cargo.toml" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/Cargo.toml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/client/auth.rs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/client/builder.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/builder.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/client/library.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/library.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/client/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/client/playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/client/playlists.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/models/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/models/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/navidrome/src/models/navidrome.rs" beforeDir="false" afterPath="$PROJECT_DIR$/navidrome/src/models/subsonic.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/daemon/mod.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/mod.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/daemon/update_playlists.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/daemon/update_playlists.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/daemon/update_tracks.rs" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/listenbrainz.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/listenbrainz.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/models.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/models.rs" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/subsonic.rs" beforeDir="false" afterPath="$PROJECT_DIR$/src/subsonic.rs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -167,7 +152,7 @@
|
||||
<workItem from="1694621211523" duration="3713000" />
|
||||
<workItem from="1708962769688" duration="6050000" />
|
||||
<workItem from="1710605458078" duration="1011000" />
|
||||
<workItem from="1710677603495" duration="12586000" />
|
||||
<workItem from="1710677603495" duration="13610000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Structure">
|
||||
<created>1692008860369</created>
|
||||
|
@ -75,7 +75,7 @@ async fn update_playlist(
|
||||
|
||||
match filtered {
|
||||
Some(track) => {
|
||||
tracks.push(track);
|
||||
tracks.push(track.clone());
|
||||
}
|
||||
None => {
|
||||
println!(
|
||||
@ -86,6 +86,10 @@ async fn update_playlist(
|
||||
}
|
||||
}
|
||||
|
||||
media_client
|
||||
.update_playlist(playlist.playlist_id.unwrap().to_string(), vec![], vec![])
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -60,20 +60,30 @@ impl Subsonic {
|
||||
pub async fn update_playlist(
|
||||
&self,
|
||||
playlist_id: String,
|
||||
add_ids: Vec<String>,
|
||||
remove_indexes: Vec<usize>,
|
||||
add: Vec<String>,
|
||||
remove: Vec<usize>,
|
||||
) -> Result<Vec<Track>, Box<dyn std::error::Error>> {
|
||||
let mut query_params = vec![
|
||||
("u", self.username.to_string()),
|
||||
("s", self.salt.to_string()),
|
||||
("t", self.hash.to_string()),
|
||||
("v", String::from("16")),
|
||||
("c", String::from("playlistd")),
|
||||
("f", String::from("json")),
|
||||
];
|
||||
|
||||
for id in add {
|
||||
query_params.push(("songIdToAdd", id));
|
||||
}
|
||||
|
||||
for index in remove {
|
||||
query_params.push(("songIndexToRemove", index.to_string()));
|
||||
}
|
||||
|
||||
Ok(self
|
||||
.client
|
||||
.get(format!("{}/search3", self.base))
|
||||
.query(&[
|
||||
("u", self.username.as_str()),
|
||||
("s", self.salt.as_str()),
|
||||
("t", self.hash.as_str()),
|
||||
("v", "16"),
|
||||
("c", "playlistd"),
|
||||
("f", "json"),
|
||||
])
|
||||
.query(&query_params)
|
||||
.send()
|
||||
.await?
|
||||
.json::<Vec<Track>>()
|
||||
@ -116,7 +126,7 @@ impl SubsonicBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(mut self) -> Result<Subsonic, Box<dyn std::error::Error>> {
|
||||
pub fn build(self) -> Result<Subsonic, Box<dyn std::error::Error>> {
|
||||
let salt = Uuid::new_v4().simple().to_string();
|
||||
let hash = format!(
|
||||
"{:?}",
|
||||
|
Loading…
Reference in New Issue
Block a user