add console output to execute_organize
This commit is contained in:
parent
4fbcf77ef8
commit
52433b9493
1 changed files with 9 additions and 3 deletions
|
@ -311,28 +311,34 @@ def execute_organize():
|
||||||
data = ox.jsonc.load(open(FILES['organize']))
|
data = ox.jsonc.load(open(FILES['organize']))
|
||||||
remove = map(lambda x: os.path.join(volume_path, x), data['automatic']['remove'])
|
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'])
|
rename = map(lambda x: map(lambda y: os.path.join(volume_path, y), x), data['automatic']['rename'])
|
||||||
|
errors = []
|
||||||
for path in remove:
|
for path in remove:
|
||||||
|
print 'Removing "%s"' % path
|
||||||
try:
|
try:
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
os.rmdir(path)
|
os.rmdir(path)
|
||||||
else:
|
else:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
except:
|
except:
|
||||||
print "Could not remove '%s'" % (path)
|
errors.append('Could not remove "%s"' % path)
|
||||||
for paths in rename:
|
for paths in rename:
|
||||||
source = paths[0]
|
source = paths[0]
|
||||||
target = paths[1] + '.pandora'
|
target = paths[1] + '.pandora'
|
||||||
|
print 'Renaming "%s" to "%s"' % (source, target)
|
||||||
try:
|
try:
|
||||||
rename_file(source, target)
|
rename_file(source, target)
|
||||||
except IOError as error:
|
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:
|
for paths in rename:
|
||||||
source = paths[1] + '.pandora'
|
source = paths[1] + '.pandora'
|
||||||
target = paths[1]
|
target = paths[1]
|
||||||
|
print 'Renaming "%s" to "%s"' % (source, target)
|
||||||
try:
|
try:
|
||||||
rename_file(source, target)
|
rename_file(source, target)
|
||||||
except IOError as error:
|
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():
|
def sync():
|
||||||
|
|
Loading…
Reference in a new issue