Fix crash when the file doesn't belong to an album

If the file doesn't belong to an album, we have to load a NAT and then
move the file there. Also fix the call to self.tagger.move_file_to_nat
which was missing a parameter (the file to move)
This commit is contained in:
Antonio Larrosa
2018-08-02 11:59:16 +02:00
committed by Sambhav Kothari
parent 7fcafe7822
commit ef4130e785

View File

@@ -197,10 +197,11 @@ class TrackSearchDialog(SearchDialog):
# No files associated. Just a normal search.
self.tagger.load_album(track["musicbrainz_albumid"])
else:
if self.file_:
if self.file_ and getattr(self.file_.parent, 'album', None):
album = self.file_.parent.album
self.tagger.move_file_to_nat(track["musicbrainz_recordingid"])
self.tagger.move_file_to_nat(self.file_, track["musicbrainz_recordingid"], node)
if album._files == 0:
self.tagger.remove_album(album)
else:
self.tagger.load_nat(track["musicbrainz_recordingid"], node)
self.tagger.move_file_to_nat(self.file_, track["musicbrainz_recordingid"], node)