Remove unused methods from MusicService.
Signed-off-by: Yahor Berdnikau <egorr.berd@gmail.com>
This commit is contained in:
parent
4d2a8a16bb
commit
4f42301752
|
@ -1,51 +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 2010 (C) Sindre Mehus
|
||||
*/
|
||||
package org.moire.ultrasonic.domain;
|
||||
|
||||
/**
|
||||
* Information about the Subsonic server.
|
||||
*
|
||||
* @author Sindre Mehus
|
||||
*/
|
||||
public class ServerInfo
|
||||
{
|
||||
|
||||
private boolean isLicenseValid;
|
||||
private Version restVersion;
|
||||
|
||||
public boolean isLicenseValid()
|
||||
{
|
||||
return isLicenseValid;
|
||||
}
|
||||
|
||||
public void setLicenseValid(boolean licenseValid)
|
||||
{
|
||||
isLicenseValid = licenseValid;
|
||||
}
|
||||
|
||||
public Version getRestVersion()
|
||||
{
|
||||
return restVersion;
|
||||
}
|
||||
|
||||
public void setRestVersion(Version restVersion)
|
||||
{
|
||||
this.restVersion = restVersion;
|
||||
}
|
||||
}
|
|
@ -21,6 +21,7 @@ package org.moire.ultrasonic.service;
|
|||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.moire.ultrasonic.domain.Bookmark;
|
||||
import org.moire.ultrasonic.domain.ChatMessage;
|
||||
import org.moire.ultrasonic.domain.Genre;
|
||||
|
@ -35,7 +36,6 @@ import org.moire.ultrasonic.domain.SearchCriteria;
|
|||
import org.moire.ultrasonic.domain.SearchResult;
|
||||
import org.moire.ultrasonic.domain.Share;
|
||||
import org.moire.ultrasonic.domain.UserInfo;
|
||||
import org.moire.ultrasonic.domain.Version;
|
||||
import org.moire.ultrasonic.util.CancellableTask;
|
||||
import org.moire.ultrasonic.util.Constants;
|
||||
import org.moire.ultrasonic.util.LRUCache;
|
||||
|
@ -43,8 +43,6 @@ import org.moire.ultrasonic.util.ProgressListener;
|
|||
import org.moire.ultrasonic.util.TimeLimitedCache;
|
||||
import org.moire.ultrasonic.util.Util;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -261,18 +259,6 @@ public class CachedMusicService implements MusicService
|
|||
musicService.deletePlaylist(id, context, progressListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, List<MusicDirectory.Entry> toAdd, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
musicService.updatePlaylist(id, toAdd, context, progressListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromPlaylist(String id, List<Integer> toRemove, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
musicService.removeFromPlaylist(id, toRemove, context, progressListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
@ -333,30 +319,12 @@ public class CachedMusicService implements MusicService
|
|||
return musicService.getDownloadInputStream(context, song, offset, maxBitrate, task);
|
||||
}
|
||||
|
||||
@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(Context context, String id, boolean useFlash) throws Exception
|
||||
{
|
||||
return musicService.getVideoUrl(context, id, useFlash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVideoStreamUrl(int maxBitrate, Context context, String id)
|
||||
{
|
||||
return musicService.getVideoStreamUrl(maxBitrate, context, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.moire.ultrasonic.service;
|
|||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import org.moire.ultrasonic.activity.SelectAlbumActivity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.moire.ultrasonic.domain.Bookmark;
|
||||
import org.moire.ultrasonic.domain.ChatMessage;
|
||||
import org.moire.ultrasonic.domain.Genre;
|
||||
|
@ -31,18 +31,14 @@ import org.moire.ultrasonic.domain.Lyrics;
|
|||
import org.moire.ultrasonic.domain.MusicDirectory;
|
||||
import org.moire.ultrasonic.domain.MusicFolder;
|
||||
import org.moire.ultrasonic.domain.Playlist;
|
||||
import org.moire.ultrasonic.domain.PodcastEpisode;
|
||||
import org.moire.ultrasonic.domain.PodcastsChannel;
|
||||
import org.moire.ultrasonic.domain.SearchCriteria;
|
||||
import org.moire.ultrasonic.domain.SearchResult;
|
||||
import org.moire.ultrasonic.domain.Share;
|
||||
import org.moire.ultrasonic.domain.UserInfo;
|
||||
import org.moire.ultrasonic.domain.Version;
|
||||
import org.moire.ultrasonic.util.CancellableTask;
|
||||
import org.moire.ultrasonic.util.ProgressListener;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -85,10 +81,6 @@ public interface MusicService
|
|||
|
||||
void deletePlaylist(String id, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
void updatePlaylist(String id, List<MusicDirectory.Entry> toAdd, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
void removeFromPlaylist(String id, List<Integer> toRemove, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
Lyrics getLyrics(String artist, String title, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
@ -111,14 +103,8 @@ public interface MusicService
|
|||
|
||||
HttpResponse getDownloadInputStream(Context context, MusicDirectory.Entry song, long offset, int maxBitrate, CancellableTask task) throws Exception;
|
||||
|
||||
Version getLocalVersion(Context context) throws Exception;
|
||||
|
||||
Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
String getVideoUrl(Context context, String id, boolean useFlash) throws Exception;
|
||||
|
||||
String getVideoStreamUrl(int Bitrate, Context context, String id);
|
||||
|
||||
JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
||||
JukeboxStatus skipJukebox(int index, int offsetSeconds, Context context, ProgressListener progressListener) throws Exception;
|
||||
|
|
|
@ -666,18 +666,6 @@ public class OfflineMusicService extends RESTMusicService
|
|||
throw new OfflineException("Playlists not available in offline mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, List<MusicDirectory.Entry> toAdd, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
throw new OfflineException("Updating playlist not available in offline mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromPlaylist(String id, List<Integer> toRemove, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
throw new OfflineException("Removing from playlist not available in offline mode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
@ -708,12 +696,6 @@ public class OfflineMusicService extends RESTMusicService
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVideoStreamUrl(int maxBitrate, Context context, String id)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
|
|
@ -93,7 +93,6 @@ import org.moire.ultrasonic.service.parser.SearchResult2Parser;
|
|||
import org.moire.ultrasonic.service.parser.SearchResultParser;
|
||||
import org.moire.ultrasonic.service.parser.ShareParser;
|
||||
import org.moire.ultrasonic.service.parser.UserInfoParser;
|
||||
import org.moire.ultrasonic.service.parser.VersionParser;
|
||||
import org.moire.ultrasonic.service.ssl.SSLSocketFactory;
|
||||
import org.moire.ultrasonic.service.ssl.TrustSelfSignedStrategy;
|
||||
import org.moire.ultrasonic.util.CancellableTask;
|
||||
|
@ -687,55 +686,6 @@ public class RESTMusicService implements MusicService
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, List<MusicDirectory.Entry> toAdd, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
checkServerVersion(context, "1.8", "Updating playlist not supported.");
|
||||
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
names.add("playlistId");
|
||||
values.add(id);
|
||||
for (MusicDirectory.Entry song : toAdd)
|
||||
{
|
||||
names.add("songIdToAdd");
|
||||
values.add(song.getId());
|
||||
}
|
||||
Reader reader = getReader(context, progressListener, "updatePlaylist", null, names, values);
|
||||
try
|
||||
{
|
||||
new ErrorParser(context).parse(reader);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Util.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromPlaylist(String id, List<Integer> toRemove, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
checkServerVersion(context, "1.8", "Updating playlists is not supported.");
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
names.add("playlistId");
|
||||
values.add(id);
|
||||
for (Integer song : toRemove)
|
||||
{
|
||||
names.add("songIndexToRemove");
|
||||
values.add(song);
|
||||
}
|
||||
Reader reader = getReader(context, progressListener, "updatePlaylist", null, names, values);
|
||||
try
|
||||
{
|
||||
new ErrorParser(context).parse(reader);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Util.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
@ -872,26 +822,6 @@ public class RESTMusicService implements MusicService
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Version getLocalVersion(Context context) throws Exception
|
||||
{
|
||||
return new Version(Util.getVersionName(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Version getLatestVersion(Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
Reader reader = getReaderForURL(context, VERSION_URL, null, null, null, progressListener);
|
||||
try
|
||||
{
|
||||
return VersionParser.parse(reader);
|
||||
}
|
||||
finally
|
||||
{
|
||||
Util.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkServerVersion(Context context, String version, String text) throws ServerTooOldException
|
||||
{
|
||||
Version serverVersion = Util.getServerRestVersion(context);
|
||||
|
@ -1057,14 +987,6 @@ public class RESTMusicService implements MusicService
|
|||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVideoStreamUrl(int maxBitrate, Context context, String id)
|
||||
{
|
||||
String url = rewriteUrlWithRedirect(context, Util.getRestUrl(context, "stream") + "&id=" + id + "&maxBitRate=" + maxBitrate);
|
||||
Log.i(TAG, String.format("Using video URL: %s", url));
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context, ProgressListener progressListener) throws Exception
|
||||
{
|
||||
|
|
|
@ -1,51 +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 org.moire.ultrasonic.service.parser;
|
||||
|
||||
import org.moire.ultrasonic.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 static 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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue