diff --git a/pl.py b/pl.py
index 2c5e7db..be80846 100755
--- a/pl.py
+++ b/pl.py
@@ -161,16 +161,11 @@ def main():
else:
print "Everything is OK."
elif action == 'create':
- command = "find %(find_dir)s -type f | grep -e '%(regex)s' | " + \
- "sed -e 's#^%(replace_dir)s/#%(prefix)s#g' | sort >> %(pl)s"
- command = command % \
- dict(find_dir=options.target,
- replace_dir=options.target,
- pl=playlists[0],
- prefix=options.prefix,
- regex=r"\.\(%s\)$" % r'\|'.join(MUSIC_EXT))
- # print command
- os.system(command)
+ pl_list = music_files_list(options.target)
+ pl_list = [elt.replace(options.target, options.prefix) \
+ for elt in pl_list]
+ pl_file = open(playlists[0], 'a')
+ pl_file.write('\n' + '\n'.join(pl_list))
else:
print "This unknown action should have been caught as an error."
print "Please report this bug precising '%s not implemented'." % action