Python bindings report an error if you delete a nonexistent playlist.
[disorder] / python / disorder.py.in
index 16685f5..47d7090 100644 (file)
@@ -911,7 +911,9 @@ class client:
 
   def playlist_delete(self, playlist):
     """Delete a playlist"""
-    self._simple("playlist-delete", playlist)
+    res, details = self._simple("playlist-delete", playlist)
+    if res == 555:
+      raise operationError(res, details, "playlist-delete")
 
   def playlist_get(self, playlist):
     """Get the contents of a playlist
@@ -937,7 +939,7 @@ class client:
     Arguments:
     playlist -- Playlist to set
     tracks -- Array of tracks"""
-    self._simple_body("playlist-set", tracks, playlist)
+    self._simple_body(tracks, "playlist-set", playlist)
 
   def playlist_set_share(self, playlist, share):
     """Set the sharing status of a playlist"""
@@ -950,6 +952,11 @@ class client:
       return None
     return _split(details)[0]
 
+  def playlists(self):
+    """Returns the list of visible playlists"""
+    self._simple("playlists")
+    return self._body()
+
   ########################################################################
   # I/O infrastructure