mirror of
https://github.com/beetbox/beets.git
synced 2026-01-25 01:22:14 +01:00
implemented interactive selection in modify
This commit is contained in:
parent
6b39751337
commit
c28eaee7d0
2 changed files with 19 additions and 2 deletions
|
|
@ -1349,8 +1349,9 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm):
|
||||||
else:
|
else:
|
||||||
extra = ''
|
extra = ''
|
||||||
|
|
||||||
if not ui.input_yn('Really modify%s (Y/n)?' % extra):
|
changed = ui.input_select_items(
|
||||||
return
|
'Really modify%s (Y/n)?' % extra, changed,
|
||||||
|
lambda o: print_modify_item(o, mods, dels))
|
||||||
|
|
||||||
# Apply changes to database and files
|
# Apply changes to database and files
|
||||||
with lib.transaction():
|
with lib.transaction():
|
||||||
|
|
|
||||||
|
|
@ -231,6 +231,22 @@ class ModifyTest(unittest.TestCase, TestHelper):
|
||||||
item.load()
|
item.load()
|
||||||
self.assertEqual(0, item.mtime)
|
self.assertEqual(0, item.mtime)
|
||||||
|
|
||||||
|
def test_selective_modify(self):
|
||||||
|
title = "Tracktitle"
|
||||||
|
album = "album"
|
||||||
|
origArtist = "composer"
|
||||||
|
newArtist = "coverArtist"
|
||||||
|
for i in range(0, 10):
|
||||||
|
self.add_item_fixture(title="{0}{1}".format(title, i),
|
||||||
|
artist=origArtist,
|
||||||
|
album=album)
|
||||||
|
self.modify_inp('s\ny\ny\ny\nn\nn\ny\ny\ny\ny\nn',
|
||||||
|
title, "artist={0}".format(newArtist))
|
||||||
|
origItems = self.lib.items("artist:{0}".format(origArtist))
|
||||||
|
newItems = self.lib.items("artist:{0}".format(newArtist))
|
||||||
|
self.assertEqual(len(list(origItems)), 3)
|
||||||
|
self.assertEqual(len(list(newItems)), 7)
|
||||||
|
|
||||||
# Album Tests
|
# Album Tests
|
||||||
|
|
||||||
def test_modify_album(self):
|
def test_modify_album(self):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue