diff options
author | Scott Jackson <daneren2005@gmail.com> | 2014-07-22 18:00:23 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2014-07-22 18:00:23 -0700 |
commit | 3fdb0677104aba0bce46a6a3aa3250b10a33b52f (patch) | |
tree | a68828b89fc5cffa5070e36358ccc302d563be29 /src | |
parent | 04ee05fd4174c8e35e5462c8f3a7e4697214d39d (diff) | |
download | dsub-3fdb0677104aba0bce46a6a3aa3250b10a33b52f.tar.gz dsub-3fdb0677104aba0bce46a6a3aa3250b10a33b52f.tar.bz2 dsub-3fdb0677104aba0bce46a6a3aa3250b10a33b52f.zip |
Remove unused MusicService methods
Diffstat (limited to 'src')
5 files changed, 2 insertions, 98 deletions
diff --git a/src/github/daneren2005/dsub/service/CachedMusicService.java b/src/github/daneren2005/dsub/service/CachedMusicService.java index 86ad44f7..4f722d5c 100644 --- a/src/github/daneren2005/dsub/service/CachedMusicService.java +++ b/src/github/daneren2005/dsub/service/CachedMusicService.java @@ -42,7 +42,6 @@ import github.daneren2005.dsub.domain.SearchCritera; import github.daneren2005.dsub.domain.SearchResult; import github.daneren2005.dsub.domain.Share; import github.daneren2005.dsub.domain.User; -import github.daneren2005.dsub.domain.Version; import github.daneren2005.dsub.util.SilentBackgroundTask; import github.daneren2005.dsub.util.ProgressListener; import github.daneren2005.dsub.util.TimeLimitedCache; @@ -316,16 +315,6 @@ public class CachedMusicService implements MusicService { } @Override - public Version getLocalVersion(Context context) throws Exception { - return musicService.getLocalVersion(context); - } - - @Override - public Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception { - return musicService.getLatestVersion(context, progressListener); - } - - @Override public String getVideoUrl(int maxBitrate, Context context, String id) { return musicService.getVideoUrl(maxBitrate, context, id); } diff --git a/src/github/daneren2005/dsub/service/MusicService.java b/src/github/daneren2005/dsub/service/MusicService.java index 318873da..9f87065c 100644 --- a/src/github/daneren2005/dsub/service/MusicService.java +++ b/src/github/daneren2005/dsub/service/MusicService.java @@ -102,11 +102,7 @@ public interface MusicService { String getMusicUrl(Context context, MusicDirectory.Entry song, int maxBitrate) throws Exception; - Version getLocalVersion(Context context) throws Exception; - - Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception; - - String getVideoUrl(int maxBitrate, Context context, String id); + String getVideoUrl(int maxBitrate, Context context, String id); String getVideoStreamUrl(String format, int Bitrate, Context context, String id) throws Exception; diff --git a/src/github/daneren2005/dsub/service/OfflineMusicService.java b/src/github/daneren2005/dsub/service/OfflineMusicService.java index 8a520c8a..3dacaee7 100644 --- a/src/github/daneren2005/dsub/service/OfflineMusicService.java +++ b/src/github/daneren2005/dsub/service/OfflineMusicService.java @@ -52,7 +52,6 @@ import github.daneren2005.dsub.domain.SearchCritera; import github.daneren2005.dsub.domain.SearchResult; import github.daneren2005.dsub.domain.Share; import github.daneren2005.dsub.domain.User; -import github.daneren2005.dsub.domain.Version; import github.daneren2005.dsub.util.Constants; import github.daneren2005.dsub.util.FileUtil; import github.daneren2005.dsub.util.ProgressListener; @@ -258,16 +257,6 @@ public class OfflineMusicService implements MusicService { } @Override - public Version getLocalVersion(Context context) throws Exception { - throw new OfflineException(ERRORMSG); - } - - @Override - public Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception { - throw new OfflineException(ERRORMSG); - } - - @Override public List<MusicFolder> getMusicFolders(boolean refresh, Context context, ProgressListener progressListener) throws Exception { throw new OfflineException(ERRORMSG); } diff --git a/src/github/daneren2005/dsub/service/RESTMusicService.java b/src/github/daneren2005/dsub/service/RESTMusicService.java index 0129bf22..1a246867 100644 --- a/src/github/daneren2005/dsub/service/RESTMusicService.java +++ b/src/github/daneren2005/dsub/service/RESTMusicService.java @@ -61,7 +61,6 @@ import org.apache.http.protocol.HttpContext; import android.content.Context; import android.content.SharedPreferences; -import android.content.pm.PackageInfo; import android.graphics.Bitmap; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -90,7 +89,6 @@ import github.daneren2005.dsub.service.parser.SearchResultParser; import github.daneren2005.dsub.service.parser.ShareParser; import github.daneren2005.dsub.service.parser.StarredListParser; import github.daneren2005.dsub.service.parser.UserParser; -import github.daneren2005.dsub.service.parser.VersionParser; import github.daneren2005.dsub.service.ssl.SSLSocketFactory; import github.daneren2005.dsub.service.ssl.TrustSelfSignedStrategy; import github.daneren2005.dsub.util.BackgroundTask; @@ -118,11 +116,6 @@ public class RESTMusicService implements MusicService { // Allow 20 seconds extra timeout per MB offset. private static final double TIMEOUT_MILLIS_PER_OFFSET_BYTE = 20000.0 / 1000000.0; - /** - * URL from which to fetch latest versions. - */ - private static final String VERSION_URL = "http://subsonic.org/backend/version.view"; - private static final int HTTP_REQUEST_MAX_ATTEMPTS = 5; private static final long REDIRECTION_CHECK_INTERVAL_MILLIS = 60L * 60L * 1000L; @@ -627,23 +620,7 @@ public class RESTMusicService implements MusicService { } } - @Override - public Version getLocalVersion(Context context) throws Exception { - PackageInfo packageInfo = context.getPackageManager().getPackageInfo("github.daneren2005.dsub", 0); - return new Version(packageInfo.versionName); - } - - @Override - public Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception { - Reader reader = getReaderForURL(context, VERSION_URL, null, null, null, progressListener); - try { - return new VersionParser().parse(reader); - } finally { - Util.close(reader); - } - } - - private void checkServerVersion(Context context, String version, String text) throws ServerTooOldException { + private void checkServerVersion(Context context, String version, String text) throws ServerTooOldException { Version serverVersion = ServerInfo.getServerVersion(context); Version requiredVersion = new Version(version); boolean ok = serverVersion == null || serverVersion.compareTo(requiredVersion) >= 0; diff --git a/src/github/daneren2005/dsub/service/parser/VersionParser.java b/src/github/daneren2005/dsub/service/parser/VersionParser.java deleted file mode 100644 index 1b646206..00000000 --- a/src/github/daneren2005/dsub/service/parser/VersionParser.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - This file is part of Subsonic. - - Subsonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Subsonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Subsonic. If not, see <http://www.gnu.org/licenses/>. - - Copyright 2009 (C) Sindre Mehus - */ -package github.daneren2005.dsub.service.parser; - -import github.daneren2005.dsub.domain.Version; - -import java.io.BufferedReader; -import java.io.Reader; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * @author Sindre Mehus - */ -public class VersionParser { - - public Version parse(Reader reader) throws Exception { - - BufferedReader bufferedReader = new BufferedReader(reader); - Pattern pattern = Pattern.compile("SUBSONIC_ANDROID_VERSION_BEGIN(.*)SUBSONIC_ANDROID_VERSION_END"); - String line = bufferedReader.readLine(); - while (line != null) { - Matcher finalMatcher = pattern.matcher(line); - if (finalMatcher.find()) { - return new Version(finalMatcher.group(1)); - } - line = bufferedReader.readLine(); - } - return null; - } -}
\ No newline at end of file |