From 55eebfbb7e97f7c959c6b70a13aa033500668a05 Mon Sep 17 00:00:00 2001 From: Rahul Raturi Date: Sat, 4 Jun 2016 11:54:17 +0530 Subject: [PATCH] Remove album on certain condition Remove album from picard if the track for which more results lookup was performed, was the only track in it. Otherwise load the new album without removing existing one. --- picard/ui/searchdialog.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/picard/ui/searchdialog.py b/picard/ui/searchdialog.py index b4b4574f6..bb9e3a741 100644 --- a/picard/ui/searchdialog.py +++ b/picard/ui/searchdialog.py @@ -82,7 +82,11 @@ class SearchDialog(PicardDialog): self.tagger.get_release_group_by_id(rg_id).loaded_albums.add( release_id) self.tagger.move_file_to_track(self.obj, release_id, track_id) - self.tagger.remove_album(album) + if album._files == 0: + # Remove album if the selected file was the only one in album + # Compared to 0 because file has already moved to another album + # by move_file_to_track + self.tagger.remove_album(album) self.accept() def parse_match(self, match):