From a9793067fa161c8e5185170a511978e61335911f Mon Sep 17 00:00:00 2001 From: Taizo Simpson Date: Mon, 22 Oct 2018 20:34:21 -0400 Subject: [PATCH 1/4] When selecting items to modify, use configured order Closes #3501 --- beets/ui/commands.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 6adc27786..ac81703b8 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1376,10 +1376,10 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm): # objects. print_(u'Modifying {0} {1}s.' .format(len(objs), u'album' if album else u'item')) - changed = set() + changed = [] for obj in objs: if print_and_modify(obj, mods, dels): - changed.add(obj) + changed.append(obj) # Still something to do? if not changed: From fd56b1d677600bd101b77875d057293fdf45fcf2 Mon Sep 17 00:00:00 2001 From: Taizo Simpson Date: Wed, 24 Oct 2018 14:07:27 -0400 Subject: [PATCH 2/4] Added changelog entry for issue 3051 --- docs/changelog.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9ff3a5008..fec36af67 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -98,6 +98,10 @@ Fixes: * Missing album art file during an update no longer causes a fatal exception (instead, an error is logged and the missing file path is removed from the library). :bug:`3030` +* Fixed the ordering of items when manually selecting changes while updating + tags + Thanks to :user:`TaizoSimpson`. + :bug:`3501` .. _python-itunes: https://github.com/ocelma/python-itunes From b901eb37237b087c810b17f2c8df988c69bc1d4a Mon Sep 17 00:00:00 2001 From: Taizo Simpson Date: Wed, 24 Oct 2018 14:12:32 -0400 Subject: [PATCH 3/4] Added check to remove duplicate changes --- beets/ui/commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index ac81703b8..1ed03bb9e 100755 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -1378,7 +1378,7 @@ def modify_items(lib, mods, dels, query, write, move, album, confirm): .format(len(objs), u'album' if album else u'item')) changed = [] for obj in objs: - if print_and_modify(obj, mods, dels): + if print_and_modify(obj, mods, dels) and obj not in changed: changed.append(obj) # Still something to do? From 0a74e0fd3f25079d6db59c01536eee23012b9cc0 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 24 Oct 2018 17:05:38 -0400 Subject: [PATCH 4/4] Style fixes for latest pycodestyle changes --- test/test_filefilter.py | 10 +++++----- test/test_lyrics.py | 2 +- test/test_player.py | 2 +- test/test_the.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/test_filefilter.py b/test/test_filefilter.py index e7a4119d4..57310fd2a 100644 --- a/test/test_filefilter.py +++ b/test/test_filefilter.py @@ -137,7 +137,7 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): # Global options def test_import_global(self): - config['filefilter']['path'] = '.*track_1.*\.mp3' + config['filefilter']['path'] = '.*track_1.*\\.mp3' self.__run([ 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), @@ -151,7 +151,7 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): # Album options def test_import_album(self): - config['filefilter']['album_path'] = '.*track_1.*\.mp3' + config['filefilter']['album_path'] = '.*track_1.*\\.mp3' self.__run([ 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), @@ -169,7 +169,7 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): # Singleton options def test_import_singleton(self): - config['filefilter']['singleton_path'] = '.*track_1.*\.mp3' + config['filefilter']['singleton_path'] = '.*track_1.*\\.mp3' self.__run([ 'Singleton: %s' % displayable_path(self.artist_paths[0]), 'Singleton: %s' % displayable_path(self.misc_paths[0]) @@ -188,8 +188,8 @@ class FileFilterPluginTest(unittest.TestCase, ImportHelper): # Album and singleton options def test_import_both(self): - config['filefilter']['album_path'] = '.*track_1.*\.mp3' - config['filefilter']['singleton_path'] = '.*track_2.*\.mp3' + config['filefilter']['album_path'] = '.*track_1.*\\.mp3' + config['filefilter']['singleton_path'] = '.*track_2.*\\.mp3' self.__run([ 'Album: %s' % displayable_path(self.artist_path), ' %s' % displayable_path(self.artist_paths[0]), diff --git a/test/test_lyrics.py b/test/test_lyrics.py index 398314ba6..4d48ed9ed 100644 --- a/test/test_lyrics.py +++ b/test/test_lyrics.py @@ -165,7 +165,7 @@ class LyricsPluginTest(unittest.TestCase):  one
two ! -

+

four""" self.assertEqual(lyrics._scrape_strip_cruft(text, True), "one\ntwo !\n\nfour") diff --git a/test/test_player.py b/test/test_player.py index 0a576f0ba..523a39d1b 100644 --- a/test/test_player.py +++ b/test/test_player.py @@ -60,7 +60,7 @@ class CommandParseTest(unittest.TestCase): def test_backslash_in_arg(self): s = r'command "hello \\ there"' c = bpd.Command(s) - self.assertEqual(c.args, [u'hello \ there']) + self.assertEqual(c.args, [u'hello \\ there']) def suite(): diff --git a/test/test_the.py b/test/test_the.py index 72e9bf161..263446b92 100644 --- a/test/test_the.py +++ b/test/test_the.py @@ -50,7 +50,7 @@ class ThePluginTest(_common.TestCase): self.assertEqual(ThePlugin().the_template_func(u'An A'), u'A, An') def test_custom_pattern(self): - config['the']['patterns'] = [u'^test\s'] + config['the']['patterns'] = [u'^test\\s'] config['the']['format'] = FORMAT self.assertEqual(ThePlugin().the_template_func(u'test passed'), u'passed, test')