small corrections to def reorder_imgs

pull/1/head
Castro0o 5 years ago
parent 82a6404b40
commit 2b0e6654e0

@ -125,11 +125,10 @@ def listimgs(dir):
def reorder_imgs(dir, dry): def reorder_imgs(dir, dry):
# does zero pad file numbers # does zero pad file numbers
# and returns correct order of files
lsimgs = listimgs(dir) lsimgs = listimgs(dir)
for img in lsimgs: for img in lsimgs:
img_name, img_ext = os.path.splitext(img) img_name, img_ext = os.path.splitext(img)
print(img)
# does file follow \d{1,}\.img_ext # does file follow \d{1,}\.img_ext
numb_exp = re.compile( numb_exp = re.compile(
r'(?P<name>.*?)(?P<num>\d+)(?P<ext>%s)'% re.escape(img_ext)) r'(?P<name>.*?)(?P<num>\d+)(?P<ext>%s)'% re.escape(img_ext))
@ -151,6 +150,5 @@ def reorder_imgs(dir, dry):
print(f'Renaming: {img} >>>>> {new_img}') print(f'Renaming: {img} >>>>> {new_img}')
if dry == False: if dry == False:
os.replace(src_img, dst_img) os.replace(src_img, dst_img)
lsimgs = listimgs(dir) # update list w/ renamed imgs return listimgs(dir) # update list w/ renamed imgs
return listimgs(dir)

Loading…
Cancel
Save