aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/github
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2015-09-16 18:25:56 -0700
committerScott Jackson <daneren2005@gmail.com>2015-09-16 18:25:56 -0700
commita501dc49b08f3dc7a256f650d7937febb46c7e39 (patch)
tree08af192a1ff866e0c3a07b963e40c236e07ad76c /app/src/main/java/github
parentfa285723cd21e4799990bef0726d71ef96001e5c (diff)
parentf14c1fe6c7484a1d83ef2078ccc6abfd28eb545b (diff)
downloaddsub-a501dc49b08f3dc7a256f650d7937febb46c7e39.tar.gz
dsub-a501dc49b08f3dc7a256f650d7937febb46c7e39.tar.bz2
dsub-a501dc49b08f3dc7a256f650d7937febb46c7e39.zip
Merge branch '255limit'
Diffstat (limited to 'app/src/main/java/github')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/util/FileUtil.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java
index 332f775c..31d7e31d 100644
--- a/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java
+++ b/app/src/main/java/github/daneren2005/dsub/util/FileUtil.java
@@ -70,6 +70,7 @@ public class FileUtil {
private static final List<String> MUSIC_FILE_EXTENSIONS = Arrays.asList("mp3", "ogg", "aac", "flac", "m4a", "wav", "wma");
private static final List<String> VIDEO_FILE_EXTENSIONS = Arrays.asList("flv", "mp4", "m4v", "wmv", "avi", "mov", "mpg", "mkv");
private static final List<String> PLAYLIST_FILE_EXTENSIONS = Arrays.asList("m3u");
+ private static final int MAX_FILENAME_LENGTH = 254 - ".complete.mp3".length();
private static File DEFAULT_MUSIC_DIR;
private static final Kryo kryo = new Kryo();
private static HashMap<String, MusicDirectory.Entry> entryLookup;
@@ -123,8 +124,12 @@ public class FileUtil {
fileName.append(track).append("-");
}
- fileName.append(fileSystemSafe(song.getTitle())).append(".");
+ fileName.append(fileSystemSafe(song.getTitle()));
+ if(fileName.length() >= MAX_FILENAME_LENGTH) {
+ fileName.setLength(MAX_FILENAME_LENGTH);
+ }
+ fileName.append(".");
if(song.isVideo()) {
String videoPlayerType = Util.getVideoPlayerType(context);
if("hls".equals(videoPlayerType)) {