diff --git a/SubsonicMono/SubsonicAPI/SubsonicAPI.cs b/SubsonicMono/SubsonicAPI/SubsonicAPI.cs index 3632e93..4dccd42 100644 --- a/SubsonicMono/SubsonicAPI/SubsonicAPI.cs +++ b/SubsonicMono/SubsonicAPI/SubsonicAPI.cs @@ -31,7 +31,7 @@ namespace SubsonicAPI { public enum SubsonicItemType { - Folder, Song, Artist, Library + Folder, Song, Artist, Library, Playlist } public string name; @@ -572,12 +572,15 @@ namespace SubsonicAPI StreamReader sr = new StreamReader(theStream); string result = sr.ReadToEnd(); + /// TODO: Parse result to list return nowPlaying; } /// - /// Performs a search valid for the current version of the subsonic server + /// Performs a search valid for the current version of the subsonic server + /// If version is >= 1.4.0 search2 + /// Else search /// /// The Term you want to search for /// A List of SubsonicItem objects @@ -587,6 +590,7 @@ namespace SubsonicAPI Version apiV = new Version(apiVersion); Version Search2Min = new Version("1.4.0"); string request = ""; + // Use search for the server version if (apiV >= Search2Min) { request = "search2"; @@ -643,6 +647,49 @@ namespace SubsonicAPI return searchResults; } + /// + /// Returns a list of all playlists on server + /// + public static List GetPlaylists() + { + List playlists = new List(); + + Dictionary theParameters = new Dictionary(); + Stream theStream = MakeGenericRequest("getPlaylists", theParameters); + StreamReader sr = new StreamReader(theStream); + string result = sr.ReadToEnd(); + + /// TODO: Parse result into list + + return playlists; + } + + /// + /// Returns a list of all SubsonicItems in playlist of given ID + /// + /// + /// ID of playlist to be fetched [retreive from GetPlaylists()] + /// + /// + /// Returns list of SubsonicItems + /// + public static List GetPlaylist(string playlistId) + { + List playlist = new List(); + + Dictionary theParameters = new Dictionary(); + theParameters.Add("id", playlistId); + Stream theStream = MakeGenericRequest("getPlaylist", theParameters); + StreamReader sr = new StreamReader(theStream); + string result = sr.ReadToEnd(); + + /// TODO: Parse result into list + + return playlist; + } + + + } } \ No newline at end of file