Skip to content

Commit 8dc275d

Browse files
committed
Add progress bar to 'beet mv', and handle missing file exceptions without crashing.
1 parent 6b163fe commit 8dc275d

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

beets/ui/commands.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,20 +2170,23 @@ def isalbummoved(album):
21702170
),
21712171
)
21722172

2173-
for obj in objs:
2173+
for obj in ui.iprogress_bar(objs, desc=action, unit=entity):
21742174
log.debug("moving: {.filepath}", obj)
21752175

2176-
if export:
2177-
# Copy without affecting the database.
2178-
obj.move(
2179-
operation=MoveOperation.COPY, basedir=dest, store=False
2180-
)
2181-
else:
2182-
# Ordinary move/copy: store the new path.
2183-
if copy:
2184-
obj.move(operation=MoveOperation.COPY, basedir=dest)
2176+
try:
2177+
if export:
2178+
# Copy without affecting the database.
2179+
obj.move(
2180+
operation=MoveOperation.COPY, basedir=dest, store=False
2181+
)
21852182
else:
2186-
obj.move(operation=MoveOperation.MOVE, basedir=dest)
2183+
# Ordinary move/copy: store the new path.
2184+
if copy:
2185+
obj.move(operation=MoveOperation.COPY, basedir=dest)
2186+
else:
2187+
obj.move(operation=MoveOperation.MOVE, basedir=dest)
2188+
except FileNotFoundError as e:
2189+
log.error("Failed to {} '{}': {}", act, obj, e)
21872190

21882191

21892192
def move_func(lib, opts, args):

0 commit comments

Comments
 (0)