aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-07-10 20:01:23 -0700
committerScott Jackson <daneren2005@gmail.com>2013-07-10 20:01:23 -0700
commitf8baa8956a2bebcf3e536124cd3d38ee79f563be (patch)
tree1f55d4e44d71782fd4822f4e044d554ae5ccddf1
parent232f308d7161e4f68ce8f2beecaf25e709988d4d (diff)
downloaddsub-f8baa8956a2bebcf3e536124cd3d38ee79f563be.tar.gz
dsub-f8baa8956a2bebcf3e536124cd3d38ee79f563be.tar.bz2
dsub-f8baa8956a2bebcf3e536124cd3d38ee79f563be.zip
Fix for when path isn't pre-defined for podcasts
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/parser/AbstractParser.java2
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java6
-rw-r--r--subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java4
3 files changed, 9 insertions, 3 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/AbstractParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/AbstractParser.java
index 188d4a21..1a457754 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/parser/AbstractParser.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/AbstractParser.java
@@ -34,7 +34,7 @@ import github.daneren2005.dsub.util.Util;
*/
public abstract class AbstractParser {
- private final Context context;
+ protected final Context context;
private XmlPullParser parser;
private boolean rootElementFound;
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java b/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java
index 2af3b970..408b1b7a 100644
--- a/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java
+++ b/subsonic-android/src/github/daneren2005/dsub/service/parser/PodcastEntryParser.java
@@ -22,10 +22,9 @@ import android.content.Context;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.domain.PodcastEpisode;
+import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.ProgressListener;
import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
import org.xmlpull.v1.XmlPullParser;
/**
@@ -76,6 +75,9 @@ public class PodcastEntryParser extends AbstractParser {
episode.setDuration(getInteger("duration"));
episode.setBitRate(getInteger("bitRate"));
episode.setPath(get("path"));
+ if(episode.getPath() == null) {
+ episode.setPath(FileUtil.getPodcastPath(context, episode));
+ }
if("error".equals(episode.getStatus()) || "skipped".equals(episode.getStatus())) {
episode.setId(String.valueOf(bogusId));
diff --git a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
index 44be1921..a8a6d480 100644
--- a/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
+++ b/subsonic-android/src/github/daneren2005/dsub/util/FileUtil.java
@@ -38,6 +38,7 @@ import android.util.Log;
import github.daneren2005.dsub.domain.Artist;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.domain.PodcastChannel;
+import github.daneren2005.dsub.domain.PodcastEpisode;
/**
* @author Sindre Mehus
@@ -152,6 +153,9 @@ public class FileUtil {
return dir;
}
+ public static String getPodcastPath(Context context, PodcastEpisode episode) {
+ return getMusicDirectory(context).getPath() + "/" + fileSystemSafe(episode.getArtist()) + "/" + fileSystemSafe(episode.getTitle());
+ }
public static File getPodcastFile(Context context, String server) {
File dir = getPodcastDirectory(context);
return new File(dir.getPath() + "/" + fileSystemSafe(server));