Added the playlist generator
This commit is contained in:
@@ -227,6 +227,15 @@ pub async fn trigger_monitor_check() -> Result<TaskRef, ApiError> {
|
||||
post_empty(&format!("{BASE}/monitor/check")).await
|
||||
}
|
||||
|
||||
// --- Scheduler ---
|
||||
pub async fn skip_scheduled_pipeline() -> Result<serde_json::Value, ApiError> {
|
||||
post_empty(&format!("{BASE}/scheduler/skip-pipeline")).await
|
||||
}
|
||||
|
||||
pub async fn skip_scheduled_monitor() -> Result<serde_json::Value, ApiError> {
|
||||
post_empty(&format!("{BASE}/scheduler/skip-monitor")).await
|
||||
}
|
||||
|
||||
// --- System ---
|
||||
pub async fn trigger_index() -> Result<TaskRef, ApiError> {
|
||||
post_empty(&format!("{BASE}/index")).await
|
||||
@@ -259,6 +268,42 @@ pub async fn save_config(config: &AppConfig) -> Result<AppConfig, ApiError> {
|
||||
resp.json().await.map_err(|e| ApiError(e.to_string()))
|
||||
}
|
||||
|
||||
// --- Playlists ---
|
||||
pub async fn generate_playlist(req: &GenerateRequest) -> Result<GeneratedPlaylist, ApiError> {
|
||||
let body = serde_json::to_string(req).map_err(|e| ApiError(e.to_string()))?;
|
||||
post_json(&format!("{BASE}/playlists/generate"), &body).await
|
||||
}
|
||||
|
||||
pub async fn save_playlist(
|
||||
name: &str,
|
||||
description: Option<&str>,
|
||||
track_ids: &[i32],
|
||||
) -> Result<serde_json::Value, ApiError> {
|
||||
let body = serde_json::json!({
|
||||
"name": name,
|
||||
"description": description,
|
||||
"track_ids": track_ids,
|
||||
})
|
||||
.to_string();
|
||||
post_json(&format!("{BASE}/playlists"), &body).await
|
||||
}
|
||||
|
||||
pub async fn list_playlists() -> Result<Vec<PlaylistSummary>, ApiError> {
|
||||
get_json(&format!("{BASE}/playlists")).await
|
||||
}
|
||||
|
||||
pub async fn get_playlist(id: i32) -> Result<PlaylistDetail, ApiError> {
|
||||
get_json(&format!("{BASE}/playlists/{id}")).await
|
||||
}
|
||||
|
||||
pub async fn delete_playlist(id: i32) -> Result<(), ApiError> {
|
||||
delete(&format!("{BASE}/playlists/{id}")).await
|
||||
}
|
||||
|
||||
pub fn export_m3u_url(id: i32) -> String {
|
||||
format!("{BASE}/playlists/{id}/m3u")
|
||||
}
|
||||
|
||||
// --- YouTube Auth ---
|
||||
|
||||
pub async fn get_ytauth_status() -> Result<YtAuthStatus, ApiError> {
|
||||
|
||||
Reference in New Issue
Block a user