From 24bced19455b2e55919ef57fd33fdff3b8ed3db9 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Mon, 23 Nov 2015 08:35:52 -0800 Subject: Only count songs as duplicate if they have the same disc/track # as well --- .../daneren2005/dsub/service/parser/MusicDirectoryParser.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java index a786bceb..f2d58b5d 100644 --- a/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java +++ b/app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java @@ -64,7 +64,11 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { // Only check for songs if(checkForDuplicates && !entry.isDirectory()) { // Check if duplicates - Entry duplicate = titleMap.get(entry.getTitle()); + String disc = (entry.getDiscNumber() != null) ? Integer.toString(entry.getDiscNumber()) : ""; + String track = (entry.getTrack() != null) ? Integer.toString(entry.getTrack()) : ""; + String duplicateId = disc + "-" + track + "-" + entry.getTitle(); + + Entry duplicate = titleMap.get(duplicateId); if (duplicate != null) { // Check if the first already has been rebased or not if (duplicate.getTitle().equals(entry.getTitle())) { @@ -74,7 +78,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser { // Rebase if this is the second instance of this title found entry.rebaseTitleOffPath(); } else { - titleMap.put(entry.getTitle(), entry); + titleMap.put(duplicateId, entry); } } -- cgit v1.2.3