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 dd6e6261d33ad86052c201a0f051c055eadb8c8f..980123cd39482ffac9f52e7a65563b26f5c13a53 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,