aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-03-27 17:19:57 -0700
committerScott Jackson <daneren2005@gmail.com>2015-03-27 17:19:57 -0700
commiteb16f3ed8272daf28c4b0936920acf7a790ef751 (patch)
tree70cce71f3eb44dc9ebe9c44fdb3d6039778f07d2
parent2a466fe1bb69c64ea5e897d529a9e21ebbf5cc57 (diff)
downloaddsub-eb16f3ed8272daf28c4b0936920acf7a790ef751.tar.gz
dsub-eb16f3ed8272daf28c4b0936920acf7a790ef751.tar.bz2
dsub-eb16f3ed8272daf28c4b0936920acf7a790ef751.zip
#478 Make duplicate track renaming optional
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/settings.xml6
-rw-r--r--src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java3
-rw-r--r--src/github/daneren2005/dsub/util/Constants.java1
4 files changed, 11 insertions, 1 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 789e632f..6caa152f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -450,6 +450,8 @@
<string name="settings.casting">Casting</string>
<string name="settings.casting_proxy">Use device proxy</string>
<string name="settings.casting_proxy_summary">Stream everything through the device as a proxy. This gets around issues such as using self-signed certificates.</string>
+ <string name="settings.rename_duplicates">Rename duplicate tracks</string>
+ <string name="settings.rename_duplicates_summary">Rename duplicate tracks to the original filename so you can tell them apart.</string>
<string name="shuffle.title">Shuffle By</string>
<string name="shuffle.startYear">Start Year:</string>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 4179f0a8..f6b654cf 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -56,6 +56,12 @@
android:key="customSortEnabled"
android:defaultValue="true"/>
+ <CheckBoxPreference
+ android:title="@string/settings.rename_duplicates"
+ android:summary="@string/settings.rename_duplicates_summary"
+ android:key="renameDuplicates"
+ android:defaultValue="true"/>
+
<ListPreference
android:title="@string/settings.open_to_tab"
android:summary="@string/settings.open_to_tab_summary"
diff --git a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
index 9e5b48b4..a786bceb 100644
--- a/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
+++ b/src/github/daneren2005/dsub/service/parser/MusicDirectoryParser.java
@@ -51,6 +51,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser {
MusicDirectory dir = new MusicDirectory();
int eventType;
boolean isArtist = false;
+ boolean checkForDuplicates = Util.getPreferences(context).getBoolean(Constants.PREFERENCES_KEY_RENAME_DUPLICATES, true);
Map<String, Entry> titleMap = new HashMap<String, Entry>();
do {
eventType = nextParseEvent();
@@ -61,7 +62,7 @@ public class MusicDirectoryParser extends MusicDirectoryEntryParser {
entry.setGrandParent(dir.getParent());
// Only check for songs
- if(!entry.isDirectory()) {
+ if(checkForDuplicates && !entry.isDirectory()) {
// Check if duplicates
Entry duplicate = titleMap.get(entry.getTitle());
if (duplicate != null) {
diff --git a/src/github/daneren2005/dsub/util/Constants.java b/src/github/daneren2005/dsub/util/Constants.java
index 0102aba1..9622e84c 100644
--- a/src/github/daneren2005/dsub/util/Constants.java
+++ b/src/github/daneren2005/dsub/util/Constants.java
@@ -154,6 +154,7 @@ public final class Constants {
public static final String PREFERENCES_KEY_ALBUMS_PER_FOLDER = "albumsPerFolder";
public static final String PREFERENCES_KEY_CAST_PROXY = "castProxy";
public static final String PREFERENCES_KEY_DISABLE_EXIT_PROMPT = "disableExitPrompt";
+ public static final String PREFERENCES_KEY_RENAME_DUPLICATES = "renameDuplicates";
public static final String OFFLINE_SCROBBLE_COUNT = "scrobbleCount";
public static final String OFFLINE_SCROBBLE_ID = "scrobbleID";