diff --git a/app/dialogs.py b/app/dialogs.py index 92fac26..e76440e 100644 --- a/app/dialogs.py +++ b/app/dialogs.py @@ -84,7 +84,12 @@ class ReplaceFilesDialog(QDialog): continue rf = TrackFileData(new_file_path=new_file_path) rf.tags = get_tags(new_file_path) - if not rf.tags["title"] or not rf.tags["artist"]: + if not ( + "title" in rf.tags + and "artist" in rf.tags + and rf.tags["title"] + and rf.tags["artist"] + ): show_warning( parent=self.main_window, title="Error", @@ -177,7 +182,9 @@ class ReplaceFilesDialog(QDialog): for cbbn in candidates_by_basename: cbbn_tags = get_tags(cbbn.path) if ( - cbbn_tags["title"].lower() == new_path_title.lower() + "title" in cbbn_tags + and cbbn_tags["title"].lower() == new_path_title.lower() + and "artist" in cbbn_tags and cbbn_tags["artist"].lower() == new_path_artist.lower() ): match_track = cbbn @@ -197,10 +204,13 @@ class ReplaceFilesDialog(QDialog): if candidates_by_title: # Check artist tag for cbt in candidates_by_title: - cbt_artist = get_tags(cbt.path)["artist"] - if cbt_artist.lower() == new_path_artist.lower(): - match_track = cbt - break + try: + cbt_artist = get_tags(cbt.path)["artist"] + if cbt_artist.lower() == new_path_artist.lower(): + match_track = cbt + break + except FileNotFoundError: + return None return match_track