aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/AlbumListAdapter.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/adapter/EntryInfiniteGridAdapter.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java10
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java18
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/MusicService.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java4
-rw-r--r--app/src/main/java/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java6
-rw-r--r--app/src/main/java/github/daneren2005/dsub/view/AlbumListCountView.java2
9 files changed, 29 insertions, 27 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/AlbumListAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/AlbumListAdapter.java
index 7151362c..47f82259 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/AlbumListAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/AlbumListAdapter.java
@@ -72,11 +72,11 @@ public class AlbumListAdapter extends EndlessAdapter implements SectionIndexer {
MusicService service = MusicServiceFactory.getMusicService(context);
MusicDirectory result;
if(("genres".equals(type) && ServerInfo.checkServerVersion(context, "1.10.0")) || "years".equals(type)) {
- result = service.getAlbumList(type, extra, size, offset, context, null);
+ result = service.getAlbumList(type, extra, size, offset, false, context, null);
} else if("genres".equals(type) || "genres-songs".equals(type)) {
result = service.getSongsByGenre(extra, size, offset, context, null);
} else {
- result = service.getAlbumList(type, size, offset, context, null);
+ result = service.getAlbumList(type, size, offset, shouldIndex, context, null);
}
entries = result.getChildren();
return entries.size() > 0;
diff --git a/app/src/main/java/github/daneren2005/dsub/adapter/EntryInfiniteGridAdapter.java b/app/src/main/java/github/daneren2005/dsub/adapter/EntryInfiniteGridAdapter.java
index 7b7dc6fc..2c4f75dc 100644
--- a/app/src/main/java/github/daneren2005/dsub/adapter/EntryInfiniteGridAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/adapter/EntryInfiniteGridAdapter.java
@@ -123,11 +123,11 @@ public class EntryInfiniteGridAdapter extends EntryGridAdapter {
MusicDirectory result;
int offset = sections.get(0).size();
if(("genres".equals(type) && ServerInfo.checkServerVersion(context, "1.10.0")) || "years".equals(type)) {
- result = service.getAlbumList(type, extra, size, offset, context, null);
+ result = service.getAlbumList(type, extra, size, offset, false, context, null);
} else if("genres".equals(type) || "genres-songs".equals(type)) {
result = service.getSongsByGenre(extra, size, offset, context, null);
} else {
- result = service.getAlbumList(type, size, offset, context, null);
+ result = service.getAlbumList(type, size, offset, false, context, null);
}
return result.getChildren();
}
diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
index 555e308e..c41a4ea5 100644
--- a/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
+++ b/app/src/main/java/github/daneren2005/dsub/fragments/SelectDirectoryFragment.java
@@ -17,7 +17,6 @@ import android.text.SpannableString;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.util.Log;
-import android.view.ContextMenu;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -25,7 +24,6 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RatingBar;
@@ -453,7 +451,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
getShare(share, refresh);
}
} else if (albumListType != null) {
- getAlbumList(albumListType, albumListSize);
+ getAlbumList(albumListType, albumListSize, refresh);
} else {
if(showAll) {
getRecursiveMusicDirectory(id, name, refresh);
@@ -588,7 +586,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
}.execute();
}
- private void getAlbumList(final String albumListType, final int size) {
+ private void getAlbumList(final String albumListType, final int size, final boolean refresh) {
if ("newest".equals(albumListType)) {
setTitle(R.string.main_albums_newest);
} else if ("random".equals(albumListType)) {
@@ -614,7 +612,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
if ("starred".equals(albumListType)) {
result = service.getStarredList(context, this);
} else if(("genres".equals(albumListType) && ServerInfo.checkServerVersion(context, "1.10.0")) || "years".equals(albumListType)) {
- result = service.getAlbumList(albumListType, albumListExtra, size, 0, context, this);
+ result = service.getAlbumList(albumListType, albumListExtra, size, 0, refresh, context, this);
if(result.getChildrenSize() == 0 && "genres".equals(albumListType)) {
SelectDirectoryFragment.this.albumListType = "genres-songs";
result = service.getSongsByGenre(albumListExtra, size, 0, context, this);
@@ -622,7 +620,7 @@ public class SelectDirectoryFragment extends SubsonicFragment implements Section
} else if("genres".equals(albumListType) || "genres-songs".equals(albumListType)) {
result = service.getSongsByGenre(albumListExtra, size, 0, context, this);
} else {
- result = service.getAlbumList(albumListType, size, 0, context, this);
+ result = service.getAlbumList(albumListType, size, 0, refresh, context, this);
}
return result;
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
index 3bc7f2a3..f053c215 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/CachedMusicService.java
@@ -51,7 +51,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.util.Pair;
import github.daneren2005.dsub.util.SilentBackgroundTask;
import github.daneren2005.dsub.util.ProgressListener;
import github.daneren2005.dsub.util.TimeLimitedCache;
@@ -384,9 +383,9 @@ public class CachedMusicService implements MusicService {
}
@Override
- public MusicDirectory getAlbumList(String type, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
try {
- MusicDirectory dir = musicService.getAlbumList(type, size, offset, context, progressListener);
+ MusicDirectory dir = musicService.getAlbumList(type, size, offset, refresh, context, progressListener);
// Do some serialization updates for changes to recently added
if ("newest".equals(type) && offset == 0) {
@@ -490,6 +489,10 @@ public class CachedMusicService implements MusicService {
return dir;
} catch(IOException e) {
Log.w(TAG, "Failed to refresh album list: ", e);
+ if(refresh) {
+ throw e;
+ }
+
MusicDirectory dir = FileUtil.deserialize(context, getCacheName(context, type, Integer.toString(offset)), MusicDirectory.class);
if(dir == null) {
@@ -507,12 +510,17 @@ public class CachedMusicService implements MusicService {
}
@Override
- public MusicDirectory getAlbumList(String type, String extra, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, String extra, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
try {
- MusicDirectory dir = musicService.getAlbumList(type, extra, size, offset, context, progressListener);
+ MusicDirectory dir = musicService.getAlbumList(type, extra, size, offset, refresh, context, progressListener);
FileUtil.serialize(context, dir, getCacheName(context, type + extra, Integer.toString(offset)));
return dir;
} catch(IOException e) {
+ Log.w(TAG, "Failed to refresh album list: ", e);
+ if(refresh) {
+ throw e;
+ }
+
MusicDirectory dir = FileUtil.deserialize(context, getCacheName(context, type + extra, Integer.toString(offset)), MusicDirectory.class);
if(dir == null) {
diff --git a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
index 4d014462..0cc8d484 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/MusicService.java
@@ -90,9 +90,9 @@ public interface MusicService {
void scrobble(String id, boolean submission, Context context, ProgressListener progressListener) throws Exception;
- MusicDirectory getAlbumList(String type, int size, int offset, Context context, ProgressListener progressListener) throws Exception;
+ MusicDirectory getAlbumList(String type, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception;
- MusicDirectory getAlbumList(String type, String extra, int size, int offset, Context context, ProgressListener progressListener) throws Exception;
+ MusicDirectory getAlbumList(String type, String extra, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception;
MusicDirectory getRandomSongs(int size, String artistId, Context context, ProgressListener progressListener) throws Exception;
MusicDirectory getRandomSongs(int size, String folder, String genre, String startYear, String endYear, Context context, ProgressListener progressListener) throws Exception;
diff --git a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
index 250d8566..82716fa8 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/OfflineMusicService.java
@@ -561,12 +561,12 @@ public class OfflineMusicService implements MusicService {
}
@Override
- public MusicDirectory getAlbumList(String type, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
throw new OfflineException(ERRORMSG);
}
@Override
- public MusicDirectory getAlbumList(String type, String extra, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, String extra, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
throw new OfflineException(ERRORMSG);
}
diff --git a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
index ed34e1cb..78a7ec51 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/RESTMusicService.java
@@ -522,7 +522,7 @@ public class RESTMusicService implements MusicService {
}
@Override
- public MusicDirectory getAlbumList(String type, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
List<String> names = new ArrayList<String>();
List<Object> values = new ArrayList<Object>();
@@ -553,7 +553,7 @@ public class RESTMusicService implements MusicService {
}
@Override
- public MusicDirectory getAlbumList(String type, String extra, int size, int offset, Context context, ProgressListener progressListener) throws Exception {
+ public MusicDirectory getAlbumList(String type, String extra, int size, int offset, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
checkServerVersion(context, "1.10.1", "This type of album list is not supported");
List<String> names = new ArrayList<String>();
diff --git a/app/src/main/java/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java b/app/src/main/java/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
index f7a8634e..8da83be1 100644
--- a/app/src/main/java/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
+++ b/app/src/main/java/github/daneren2005/dsub/service/sync/MostRecentSyncAdapter.java
@@ -23,18 +23,14 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.util.Log;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.domain.MusicDirectory;
-import github.daneren2005.dsub.domain.PodcastEpisode;
-import github.daneren2005.dsub.service.DownloadFile;
import github.daneren2005.dsub.util.FileUtil;
import github.daneren2005.dsub.util.Notifications;
import github.daneren2005.dsub.util.SyncUtil;
-import github.daneren2005.dsub.util.SyncUtil.SyncSet;
import github.daneren2005.dsub.util.Util;
/**
@@ -56,7 +52,7 @@ public class MostRecentSyncAdapter extends SubsonicSyncAdapter {
public void onExecuteSync(Context context, int instance) {
try {
ArrayList<String> syncedList = SyncUtil.getSyncedMostRecent(context, instance);
- MusicDirectory albumList = musicService.getAlbumList("newest", 20, 0, context, null);
+ MusicDirectory albumList = musicService.getAlbumList("newest", 20, 0, tagBrowsing, context, null);
List<String> updated = new ArrayList<String>();
boolean firstRun = false;
if(syncedList.size() == 0) {
diff --git a/app/src/main/java/github/daneren2005/dsub/view/AlbumListCountView.java b/app/src/main/java/github/daneren2005/dsub/view/AlbumListCountView.java
index a1b14f61..1ae9ef8e 100644
--- a/app/src/main/java/github/daneren2005/dsub/view/AlbumListCountView.java
+++ b/app/src/main/java/github/daneren2005/dsub/view/AlbumListCountView.java
@@ -68,7 +68,7 @@ public class AlbumListCountView extends UpdateView2<Integer, Void> {
}
MusicService musicService = MusicServiceFactory.getMusicService(context);
- MusicDirectory recentlyAdded = musicService.getAlbumList("newest", 20, 0, context, null);
+ MusicDirectory recentlyAdded = musicService.getAlbumList("newest", 20, 0, false, context, null);
// If first run, just put everything in it and return 0
boolean firstRun = recents.isEmpty();