Skip to content

Commit cb1ddba

Browse files
committed
Add progress bars to 'beet update', 'beet rm', 'beet mv', and the modify command.
1 parent 8dc275d commit cb1ddba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

beets/ui/commands.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ def update_items(lib, query, album, move, pretend, fields, exclude_fields=None):
16251625

16261626
# Walk through the items and pick up their changes.
16271627
affected_albums = set()
1628-
for item in items:
1628+
for item in ui.iprogress_bar(items, desc="Updating", unit="item"):
16291629
# Item deleted?
16301630
if not item.path or not os.path.exists(syspath(item.path)):
16311631
ui.print_(format(item))
@@ -1683,7 +1683,7 @@ def update_items(lib, query, album, move, pretend, fields, exclude_fields=None):
16831683
return
16841684

16851685
# Modify affected albums to reflect changes in their items.
1686-
for album_id in affected_albums:
1686+
for album_id in ui.iprogress_bar(affected_albums, "Updating", unit="album"):
16871687
if album_id is None: # Singletons.
16881688
continue
16891689
album = lib.get_album(album_id)
@@ -1839,7 +1839,7 @@ def fmt_album(a):
18391839

18401840
# Remove (and possibly delete) items.
18411841
with lib.transaction():
1842-
for obj in objs:
1842+
for obj in ui.iprogress_bar(objs, desc="Removing", unit="item"):
18431843
obj.remove(delete)
18441844

18451845

@@ -1992,7 +1992,7 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm, inherit):
19921992

19931993
# Apply changes to database and files
19941994
with lib.transaction():
1995-
for obj in changed:
1995+
for obj in ui.iprogress_bar(changed, desc="Modifying", unit="item"):
19961996
obj.try_sync(write, move, inherit)
19971997

19981998

@@ -2125,7 +2125,7 @@ def isitemmoved(item):
21252125
def isalbummoved(album):
21262126
return any(isitemmoved(i) for i in album.items())
21272127

2128-
objs = [o for o in objs if (isalbummoved if album else isitemmoved)(o)]
2128+
objs = [o for o in ui.iprogress_bar(objs, desc="Preparing", unit="item") if (isalbummoved if album else isitemmoved)(o)]
21292129
num_unmoved = num_objs - len(objs)
21302130
# Report unmoved files that match the query.
21312131
unmoved_msg = ""
@@ -2254,7 +2254,7 @@ def write_items(lib, query, pretend, force):
22542254
"""
22552255
items, albums = _do_query(lib, query, False, False)
22562256

2257-
for item in items:
2257+
for item in ui.iprogress_bar(items, desc="Writing", unit="item"):
22582258
# Item deleted?
22592259
if not os.path.exists(syspath(item.path)):
22602260
log.info("missing file: {.filepath}", item)

0 commit comments

Comments
 (0)