From 71e410832a1386c30e294a2db23db15ba78f3558 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Sun, 25 Jan 2015 09:21:21 -0800 Subject: Everything support mp3, so when mp3 -> mp3 just specify raw so content length is correct --- src/github/daneren2005/dsub/service/RESTMusicService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index f0144ee4..cc9362fd 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -730,7 +730,14 @@ public class RESTMusicService implements MusicService { public String getMusicUrl(Context context, MusicDirectory.Entry song, int maxBitrate) throws Exception { StringBuilder builder = new StringBuilder(getRestUrl(context, "stream")); builder.append("&id=").append(song.getId()); - builder.append("&maxBitRate=").append(maxBitrate); + + // If we are doing mp3 to mp3, just specify raw so that stuff works better + if("mp3".equals(song.getSuffix()) && (song.getTranscodedSuffix() == null || "mp3".equals(song.getTranscodedSuffix())) && ServerInfo.checkServerVersion(context, "1.9", getInstance(context))) { + builder.append("&format=raw"); + builder.append("&estimateContentLength=true"); + } else { + builder.append("&maxBitRate=").append(maxBitrate); + } String url = builder.toString(); Log.i(TAG, "Using music URL: " + stripUrlInfo(url)); -- cgit v1.2.3