Add playlist building daemon
This creates playlists when the name would change
This commit is contained in:
1 parent
996504373e
commit
2bd75c1c06
12 files changed
+267
-28
No files matched your search
+10
-2
@@ -6,6 +6,10 @@ use std::fmt::{Display, Formatter};
|
||||
use thiserror::Error;
|
||||
use uuid::Uuid;
|
||||
|
||||
fn default_vec() -> Vec<Track> {
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Subsonic {
|
||||
username: String,
|
||||
@@ -28,6 +32,7 @@ struct SearchResponse {
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct SearchResponseSongs {
|
||||
#[serde(default = "default_vec")]
|
||||
song: Vec<Track>,
|
||||
}
|
||||
|
||||
@@ -121,7 +126,10 @@ impl Subsonic {
|
||||
.playlist)
|
||||
}
|
||||
|
||||
pub async fn create_playlist(&self, playlist_name: String) -> Result<Playlist, SubsonicError> {
|
||||
pub async fn create_playlist(
|
||||
&self,
|
||||
playlist_name: impl ToString,
|
||||
) -> Result<Playlist, SubsonicError> {
|
||||
let auth_params = self.auth_params();
|
||||
|
||||
let get_params = [
|
||||
@@ -131,7 +139,7 @@ impl Subsonic {
|
||||
("v", String::from("16")),
|
||||
("c", String::from("playlistd")),
|
||||
("f", String::from("json")),
|
||||
("name", playlist_name),
|
||||
("name", playlist_name.to_string()),
|
||||
];
|
||||
|
||||
Ok(self
|
||||
|
||||
Reference in new issue
Block a user