add console output to execute_organize

This commit is contained in:
rolux 2012-09-23 15:45:14 +02:00
parent 4fbcf77ef8
commit 52433b9493

View file

@ -311,28 +311,34 @@ def execute_organize():
data = ox.jsonc.load(open(FILES['organize']))
remove = map(lambda x: os.path.join(volume_path, x), data['automatic']['remove'])
rename = map(lambda x: map(lambda y: os.path.join(volume_path, y), x), data['automatic']['rename'])
errors = []
for path in remove:
print 'Removing "%s"' % path
try:
if os.path.isdir(path):
os.rmdir(path)
else:
os.remove(path)
except:
print "Could not remove '%s'" % (path)
errors.append('Could not remove "%s"' % path)
for paths in rename:
source = paths[0]
target = paths[1] + '.pandora'
print 'Renaming "%s" to "%s"' % (source, target)
try:
rename_file(source, target)
except IOError as error:
print "Could not rename '%s' to '%s' (%s)" % (source, target, error)
errors.append('Could not rename "%s" to "%s" (%s)' % (source, target, error))
for paths in rename:
source = paths[1] + '.pandora'
target = paths[1]
print 'Renaming "%s" to "%s"' % (source, target)
try:
rename_file(source, target)
except IOError as error:
print "Could not rename '%s' to '%s' (%s)" % (source, target, error)
errors.append('Could not rename "%s" to "%s" (%s)' % (source, target, error))
for error in errors:
print error
def sync():