aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2014-10-15 14:43:08 -0700
committerScott Jackson <daneren2005@gmail.com>2014-10-15 14:43:08 -0700
commit7fc5fb868566e565d191555337840b15cbcb4081 (patch)
treecdb1918a901f875f4ed47242ed9adf239ed66658 /src
parent3e3ed654a5be6db5974f4986d656b2aee40d288e (diff)
downloaddsub-7fc5fb868566e565d191555337840b15cbcb4081.tar.gz
dsub-7fc5fb868566e565d191555337840b15cbcb4081.tar.bz2
dsub-7fc5fb868566e565d191555337840b15cbcb4081.zip
Fix issues with playlist file listings in offline mode
In offline mode, playlists are read from a .m3u file which stores the absolute paths. No matter what, the files need to be passed to createEntry without the .complete part in the filename or else the files will not be found. If the normal name file does not exist, need to check against the .complete one as well before removing it from the list of valid songs to show in the playlist.
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/OfflineMusicService.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/github/daneren2005/dsub/service/OfflineMusicService.java b/src/github/daneren2005/dsub/service/OfflineMusicService.java
index 22b12cde..a676d9a1 100644
--- a/src/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/src/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -428,12 +428,20 @@ public class OfflineMusicService implements MusicService {
if(!"#EXTM3U".equals(line)) return playlist;
while( (line = buffer.readLine()) != null ){
+ // No matter what, end file can't have .complete in it
+ line = line.replace(".complete", "");
File entryFile = new File(line);
- if(!entryFile.exists()) {
- entryFile = new File(line.replace(".complete", ""));
+
+ // Don't add file to playlist if it doesn't exist as cached or pinned!
+ File checkFile = entryFile;
+ if(!checkFile.exists()) {
+ // If normal file doens't exist, check if .complete version does
+ checkFile = new File(entryFile.getParent(), FileUtil.getBaseName(entryFile.getName())
+ + ".complete" + FileUtil.getExtension(entryFile.getName()));
}
+
String entryName = getName(entryFile);
- if(entryFile.exists() && entryName != null){
+ if(checkFile.exists() && entryName != null){
playlist.addChild(createEntry(context, entryFile, entryName, false));
}
}