diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-03-12 20:20:54 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-03-12 20:20:54 -0700 |
commit | 61bf15569c8d5683d105e19352b3756cb0cdba28 (patch) | |
tree | d73d59736541f05593e778c6b2cc1f48501dc8ac /subsonic-android | |
parent | bc1766a4967ad60fcdd78aec7991816268336c13 (diff) | |
download | dsub-61bf15569c8d5683d105e19352b3756cb0cdba28.tar.gz dsub-61bf15569c8d5683d105e19352b3756cb0cdba28.tar.bz2 dsub-61bf15569c8d5683d105e19352b3756cb0cdba28.zip |
Get rid of code which is never reached
Diffstat (limited to 'subsonic-android')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java | 101 |
1 files changed, 46 insertions, 55 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java index 95cbae2b..5a6a1985 100644 --- a/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java +++ b/subsonic-android/src/github/daneren2005/dsub/service/DownloadServiceImpl.java @@ -927,69 +927,60 @@ public class DownloadServiceImpl extends Service implements DownloadService { isPartial = file.equals(downloadFile.getPartialFile()); downloadFile.updateModificationDate(); - if(playerState == PlayerState.PREPARED) { - if (start) { - mediaPlayer.start(); - setPlayerState(STARTED); - } else { - setPlayerState(PAUSED); + mediaPlayer.setOnCompletionListener(null); + mediaPlayer.reset(); + setPlayerState(IDLE); + mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); + String dataSource = file.getPath(); + if(isPartial) { + if (proxy == null) { + proxy = new StreamProxy(this); + proxy.start(); } - } else { - mediaPlayer.setOnCompletionListener(null); - mediaPlayer.reset(); - setPlayerState(IDLE); - mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); - String dataSource = file.getPath(); - if(isPartial) { - if (proxy == null) { - proxy = new StreamProxy(this); - proxy.start(); + dataSource = String.format("http://127.0.0.1:%d/%s", proxy.getPort(), dataSource); + Log.i(TAG, "Data Source: " + dataSource); + } else if(proxy != null) { + proxy.stop(); + proxy = null; + } + mediaPlayer.setDataSource(dataSource); + setPlayerState(PREPARING); + + mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { + public void onBufferingUpdate(MediaPlayer mp, int percent) { + Log.i(TAG, "Buffered " + percent + "%"); + if(percent == 100) { + mediaPlayer.setOnBufferingUpdateListener(null); } - dataSource = String.format("http://127.0.0.1:%d/%s", proxy.getPort(), dataSource); - Log.i(TAG, "Data Source: " + dataSource); - } else if(proxy != null) { - proxy.stop(); - proxy = null; } - mediaPlayer.setDataSource(dataSource); - setPlayerState(PREPARING); - - mediaPlayer.setOnBufferingUpdateListener(new MediaPlayer.OnBufferingUpdateListener() { - public void onBufferingUpdate(MediaPlayer mp, int percent) { - Log.i(TAG, "Buffered " + percent + "%"); - if(percent == 100) { - mediaPlayer.setOnBufferingUpdateListener(null); - } - } - }); + }); - mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { - public void onPrepared(MediaPlayer mediaPlayer) { - try { - setPlayerState(PREPARED); - - synchronized (DownloadServiceImpl.this) { - if (position != 0) { - Log.i(TAG, "Restarting player from position " + position); - mediaPlayer.seekTo(position); - } - cachedPosition = position; - - if (start) { - mediaPlayer.start(); - setPlayerState(STARTED); - } else { - setPlayerState(PAUSED); - } + mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { + public void onPrepared(MediaPlayer mediaPlayer) { + try { + setPlayerState(PREPARED); + + synchronized (DownloadServiceImpl.this) { + if (position != 0) { + Log.i(TAG, "Restarting player from position " + position); + mediaPlayer.seekTo(position); } + cachedPosition = position; - lifecycleSupport.serializeDownloadQueue(); - } catch (Exception x) { - handleError(x); + if (start) { + mediaPlayer.start(); + setPlayerState(STARTED); + } else { + setPlayerState(PAUSED); + } } + + lifecycleSupport.serializeDownloadQueue(); + } catch (Exception x) { + handleError(x); } - }); - } + } + }); setupHandlers(downloadFile, isPartial); |