diff options
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java | 8 |
1 files changed, 6 insertions, 2 deletions
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); } } |