aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-11-23 08:35:52 -0800
committerScott Jackson <daneren2005@gmail.com>2015-11-23 08:35:52 -0800
commit24bced19455b2e55919ef57fd33fdff3b8ed3db9 (patch)
treed120a2a5d5515acddc4297f4708a3a738375417d /app
parent914093d65ea20552c0def2b7125a607ddad1ebd9 (diff)
downloaddsub-24bced19455b2e55919ef57fd33fdff3b8ed3db9.tar.gz
dsub-24bced19455b2e55919ef57fd33fdff3b8ed3db9.tar.bz2
dsub-24bced19455b2e55919ef57fd33fdff3b8ed3db9.zip
Only count songs as duplicate if they have the same disc/track # as well
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java8
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);
}
}