Fix broken hooke.plugin.playlist.playlist_name_callback
authorW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 06:40:52 +0000 (02:40 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 06:40:52 +0000 (02:40 -0400)
hooke/plugin/playlist.py

index dd6e626..980123c 100644 (file)
@@ -57,7 +57,13 @@ playlist.
 """.strip())
 
 def playlist_name_callback(hooke, command, argument, value):
-        return hooke.playlists.free_name()
+    i = 0
+    names = [p.name for p in hooke.playlists]
+    while True:
+        name = 'playlist-%d' % i
+        if name not in names:
+            return name
+        i += 1
 
 PlaylistNameArgument = Argument(
     name='name', type='string', optional=True, callback=playlist_name_callback,