From 9b05401457970e6372620ae65ad133593918d5f7 Mon Sep 17 00:00:00 2001 From: Matthew Blythe Date: Mon, 27 Jul 2015 22:46:25 -0600 Subject: [PATCH 1/4] fix auto-grouping The auto-grouper only worked if the filenames in the directory happened to already be in order by artist & album. Now, the code will first sort by artist & album, then group them. --- beets/importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/importer.py b/beets/importer.py index 713bcd52f..ce8103ad8 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1408,7 +1408,7 @@ def group_albums(session): if task.skip: continue tasks = [] - for _, items in itertools.groupby(task.items, group): + for _, items in itertools.groupby(sorted(task.items,key=group), group): items = list(items) task = ImportTask(task.toppath, [i.path for i in items], items) From 05da49fa6a7bc55a52f80cd20ade973cd317399e Mon Sep 17 00:00:00 2001 From: Matthew Blythe Date: Tue, 28 Jul 2015 20:04:49 -0600 Subject: [PATCH 2/4] fixing style issue --- beets/importer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beets/importer.py b/beets/importer.py index ce8103ad8..adc30fe1f 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1408,7 +1408,7 @@ def group_albums(session): if task.skip: continue tasks = [] - for _, items in itertools.groupby(sorted(task.items,key=group), group): + for _, items in itertools.groupby(sorted(task.items, key=group), group): items = list(items) task = ImportTask(task.toppath, [i.path for i in items], items) From abb9ab5f1b44fd5d3b71c026ecae9fd4bfe47fc4 Mon Sep 17 00:00:00 2001 From: Matthew Blythe Date: Tue, 28 Jul 2015 20:13:41 -0600 Subject: [PATCH 3/4] add 'group album' fix to changelog --- docs/changelog.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changelog.rst b/docs/changelog.rst index 057440a54..e9e57d9e0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -77,6 +77,8 @@ Fixes: on the user's path by default). * Fix an incompatibility with certain JPEG files. Here's a relevant `Python bug`_. Thanks to :user:`nathdwek`. :bug:`1545` +* Fix the 'Group albums' feature so it can handle when files aren't already + in order by album. :bug:`1550` .. _Python bug: http://bugs.python.org/issue16512 From 5710a9629900368fc366435721fcb2454241d220 Mon Sep 17 00:00:00 2001 From: Matthew Blythe Date: Tue, 28 Jul 2015 20:28:16 -0600 Subject: [PATCH 4/4] shortening line to meet style guidelines --- beets/importer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beets/importer.py b/beets/importer.py index adc30fe1f..844b66086 100644 --- a/beets/importer.py +++ b/beets/importer.py @@ -1408,7 +1408,8 @@ def group_albums(session): if task.skip: continue tasks = [] - for _, items in itertools.groupby(sorted(task.items, key=group), group): + sorted_items = sorted(task.items, key=group) + for _, items in itertools.groupby(sorted_items, group): items = list(items) task = ImportTask(task.toppath, [i.path for i in items], items)