Merge pull request #485 from tzugen/context-free-2
Removing remaining context from MusicService signatures.
This commit is contained in:
commit
14941486a5
|
@ -117,8 +117,8 @@
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$// TODO Test if this works with external Intents // android.intent.action.SEARCH and android.media.action.MEDIA_PLAY_FROM_SEARCH calls here override fun onNewIntent(intent: Intent?)</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$// TODO Test if this works with external Intents // android.intent.action.SEARCH and android.media.action.MEDIA_PLAY_FROM_SEARCH calls here override fun onNewIntent(intent: Intent?)</ID>
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$private fun showNowPlaying()</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$private fun showNowPlaying()</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( context: Context, username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( context: Context, entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(IOException::class) private fun savePlaylist( name: String?, playlist: MusicDirectory )</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(IOException::class) private fun savePlaylist( name: String?, playlist: MusicDirectory )</ID>
|
||||||
<ID>LongMethod:RestErrorMapper.kt$ fun SubsonicRESTException.getLocalizedErrorMessage(context: Context): String</ID>
|
<ID>LongMethod:RestErrorMapper.kt$ fun SubsonicRESTException.getLocalizedErrorMessage(context: Context): String</ID>
|
||||||
<ID>LongMethod:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
<ID>LongMethod:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
||||||
|
@ -200,8 +200,8 @@
|
||||||
<ID>ReturnCount:CommunicationErrorHandler.kt$CommunicationErrorHandler.Companion$fun getErrorMessage(error: Throwable, context: Context): String</ID>
|
<ID>ReturnCount:CommunicationErrorHandler.kt$CommunicationErrorHandler.Companion$fun getErrorMessage(error: Throwable, context: Context): String</ID>
|
||||||
<ID>ReturnCount:FileLoggerTree.kt$FileLoggerTree$ private fun getNextLogFile()</ID>
|
<ID>ReturnCount:FileLoggerTree.kt$FileLoggerTree$ private fun getNextLogFile()</ID>
|
||||||
<ID>ReturnCount:MediaPlayerService.kt$MediaPlayerService$private fun generateAction(context: Context, requestCode: Int): NotificationCompat.Action?</ID>
|
<ID>ReturnCount:MediaPlayerService.kt$MediaPlayerService$private fun generateAction(context: Context, requestCode: Int): NotificationCompat.Action?</ID>
|
||||||
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( context: Context, username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( context: Context, entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
||||||
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
||||||
<ID>ReturnCount:ServerRowAdapter.kt$ServerRowAdapter$ private fun popupMenuItemClick(menuItem: MenuItem, position: Int): Boolean</ID>
|
<ID>ReturnCount:ServerRowAdapter.kt$ServerRowAdapter$ private fun popupMenuItemClick(menuItem: MenuItem, position: Int): Boolean</ID>
|
||||||
|
|
|
@ -117,8 +117,8 @@
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$// TODO Test if this works with external Intents // android.intent.action.SEARCH and android.media.action.MEDIA_PLAY_FROM_SEARCH calls here override fun onNewIntent(intent: Intent?)</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$// TODO Test if this works with external Intents // android.intent.action.SEARCH and android.media.action.MEDIA_PLAY_FROM_SEARCH calls here override fun onNewIntent(intent: Intent?)</ID>
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$override fun onCreate(savedInstanceState: Bundle?)</ID>
|
||||||
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$private fun showNowPlaying()</ID>
|
<ID>LongMethod:NavigationActivity.kt$NavigationActivity$private fun showNowPlaying()</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( context: Context, username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( context: Context, entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(IOException::class) private fun savePlaylist( name: String?, playlist: MusicDirectory )</ID>
|
<ID>LongMethod:RESTMusicService.kt$RESTMusicService$@Throws(IOException::class) private fun savePlaylist( name: String?, playlist: MusicDirectory )</ID>
|
||||||
<ID>LongMethod:RestErrorMapper.kt$ fun SubsonicRESTException.getLocalizedErrorMessage(context: Context): String</ID>
|
<ID>LongMethod:RestErrorMapper.kt$ fun SubsonicRESTException.getLocalizedErrorMessage(context: Context): String</ID>
|
||||||
<ID>LongMethod:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
<ID>LongMethod:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
||||||
|
@ -200,8 +200,8 @@
|
||||||
<ID>ReturnCount:CommunicationErrorHandler.kt$CommunicationErrorHandler.Companion$fun getErrorMessage(error: Throwable, context: Context): String</ID>
|
<ID>ReturnCount:CommunicationErrorHandler.kt$CommunicationErrorHandler.Companion$fun getErrorMessage(error: Throwable, context: Context): String</ID>
|
||||||
<ID>ReturnCount:FileLoggerTree.kt$FileLoggerTree$ private fun getNextLogFile()</ID>
|
<ID>ReturnCount:FileLoggerTree.kt$FileLoggerTree$ private fun getNextLogFile()</ID>
|
||||||
<ID>ReturnCount:MediaPlayerService.kt$MediaPlayerService$private fun generateAction(context: Context, requestCode: Int): NotificationCompat.Action?</ID>
|
<ID>ReturnCount:MediaPlayerService.kt$MediaPlayerService$private fun generateAction(context: Context, requestCode: Int): NotificationCompat.Action?</ID>
|
||||||
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( context: Context, username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getAvatar( username: String?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( context: Context, entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
<ID>ReturnCount:RESTMusicService.kt$RESTMusicService$@Throws(Exception::class) override fun getCoverArt( entry: MusicDirectory.Entry?, size: Int, saveToFile: Boolean, highQuality: Boolean ): Bitmap?</ID>
|
||||||
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onContextItemSelected(menuItem: MenuItem): Boolean</ID>
|
||||||
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
<ID>ReturnCount:SelectAlbumFragment.kt$SelectAlbumFragment$override fun onOptionsItemSelected(item: MenuItem): Boolean</ID>
|
||||||
<ID>ReturnCount:ServerRowAdapter.kt$ServerRowAdapter$ private fun popupMenuItemClick(menuItem: MenuItem, position: Int): Boolean</ID>
|
<ID>ReturnCount:ServerRowAdapter.kt$ServerRowAdapter$ private fun popupMenuItemClick(menuItem: MenuItem, position: Int): Boolean</ID>
|
||||||
|
|
|
@ -205,7 +205,7 @@ public class BookmarksFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
protected MusicDirectory load(MusicService service) throws Exception
|
protected MusicDirectory load(MusicService service) throws Exception
|
||||||
{
|
{
|
||||||
return Util.getSongsFromBookmarks(service.getBookmarks(getContext()));
|
return Util.getSongsFromBookmarks(service.getBookmarks());
|
||||||
}
|
}
|
||||||
}.execute();
|
}.execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ public class ChatFragment extends Fragment {
|
||||||
protected Void doInBackground() throws Throwable
|
protected Void doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.addChatMessage(message, getContext());
|
musicService.addChatMessage(message);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ public class ChatFragment extends Fragment {
|
||||||
protected List<ChatMessage> doInBackground() throws Throwable
|
protected List<ChatMessage> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
return musicService.getChatMessages(lastChatMessageTime, getContext());
|
return musicService.getChatMessages(lastChatMessageTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class LyricsFragment extends Fragment {
|
||||||
String artist = arguments.getString(Constants.INTENT_EXTRA_NAME_ARTIST);
|
String artist = arguments.getString(Constants.INTENT_EXTRA_NAME_ARTIST);
|
||||||
String title = arguments.getString(Constants.INTENT_EXTRA_NAME_TITLE);
|
String title = arguments.getString(Constants.INTENT_EXTRA_NAME_TITLE);
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
return musicService.getLyrics(artist, title, getContext());
|
return musicService.getLyrics(artist, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1027,7 +1027,7 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur
|
||||||
final MusicService musicService = MusicServiceFactory.getMusicService();
|
final MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
musicService.createBookmark(songId, playerPosition, getContext());
|
musicService.createBookmark(songId, playerPosition);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Timber.e(e);
|
Timber.e(e);
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1053,7 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur
|
||||||
final MusicService musicService = MusicServiceFactory.getMusicService();
|
final MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
musicService.deleteBookmark(bookmarkSongId, getContext());
|
musicService.deleteBookmark(bookmarkSongId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Timber.e(e);
|
Timber.e(e);
|
||||||
}
|
}
|
||||||
|
@ -1128,7 +1128,7 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur
|
||||||
entries.add(downloadFile.getSong());
|
entries.add(downloadFile.getSong());
|
||||||
}
|
}
|
||||||
final MusicService musicService = MusicServiceFactory.getMusicService();
|
final MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.createPlaylist(null, playlistName, entries, getContext());
|
musicService.createPlaylist(null, playlistName, entries);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class PlaylistsFragment extends Fragment {
|
||||||
protected List<Playlist> doInBackground() throws Throwable
|
protected List<Playlist> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
List<Playlist> playlists = musicService.getPlaylists(refresh, getContext());
|
List<Playlist> playlists = musicService.getPlaylists(refresh);
|
||||||
|
|
||||||
if (!ActiveServerProvider.Companion.isOffline())
|
if (!ActiveServerProvider.Companion.isOffline())
|
||||||
new CacheCleaner(getContext()).cleanPlaylists(playlists);
|
new CacheCleaner(getContext()).cleanPlaylists(playlists);
|
||||||
|
@ -223,7 +223,7 @@ public class PlaylistsFragment extends Fragment {
|
||||||
protected Void doInBackground() throws Throwable
|
protected Void doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.deletePlaylist(playlist.getId(), getContext());
|
musicService.deletePlaylist(playlist.getId());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public class PlaylistsFragment extends Fragment {
|
||||||
String comment = commentBoxText != null ? commentBoxText.toString() : null;
|
String comment = commentBoxText != null ? commentBoxText.toString() : null;
|
||||||
|
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.updatePlaylist(playlist.getId(), name, comment, publicBox.isChecked(), getContext());
|
musicService.updatePlaylist(playlist.getId(), name, comment, publicBox.isChecked());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class PodcastFragment extends Fragment {
|
||||||
protected List<PodcastsChannel> doInBackground() throws Throwable
|
protected List<PodcastsChannel> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
return musicService.getPodcastsChannels(refresh, context);
|
return musicService.getPodcastsChannels(refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -421,7 +421,7 @@ public class SearchFragment extends Fragment {
|
||||||
{
|
{
|
||||||
SearchCriteria criteria = new SearchCriteria(query, maxArtists, maxAlbums, maxSongs);
|
SearchCriteria criteria = new SearchCriteria(query, maxArtists, maxAlbums, maxSongs);
|
||||||
MusicService service = MusicServiceFactory.getMusicService();
|
MusicService service = MusicServiceFactory.getMusicService();
|
||||||
return service.search(criteria, getContext());
|
return service.search(criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -129,7 +129,7 @@ public class SharesFragment extends Fragment {
|
||||||
protected List<Share> doInBackground() throws Throwable
|
protected List<Share> doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
return musicService.getShares(refresh, getContext());
|
return musicService.getShares(refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -196,7 +196,7 @@ public class SharesFragment extends Fragment {
|
||||||
protected Void doInBackground() throws Throwable
|
protected Void doInBackground() throws Throwable
|
||||||
{
|
{
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.deleteShare(share.getId(), getContext());
|
musicService.deleteShare(share.getId());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ public class SharesFragment extends Fragment {
|
||||||
String description = shareDescriptionText != null ? shareDescriptionText.toString() : null;
|
String description = shareDescriptionText != null ? shareDescriptionText.toString() : null;
|
||||||
|
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
musicService.updateShare(share.getId(), description, millis, getContext());
|
musicService.updateShare(share.getId(), description, millis);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class UltrasonicAppWidgetProvider extends AppWidgetProvider
|
||||||
// Set the cover art
|
// Set the cover art
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Bitmap bitmap = currentSong == null ? null : FileUtil.getAlbumArtBitmap(context, currentSong, 240, true);
|
Bitmap bitmap = currentSong == null ? null : FileUtil.getAlbumArtBitmap(currentSong, 240, true);
|
||||||
|
|
||||||
if (bitmap == null)
|
if (bitmap == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.moire.ultrasonic.service;
|
package org.moire.ultrasonic.service;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
import org.moire.ultrasonic.data.ActiveServerProvider;
|
import org.moire.ultrasonic.data.ActiveServerProvider;
|
||||||
|
@ -210,77 +209,77 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SearchResult search(SearchCriteria criteria, Context context) throws Exception
|
public SearchResult search(SearchCriteria criteria) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.search(criteria, context);
|
return musicService.search(criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getPlaylist(String id, String name, Context context) throws Exception
|
public MusicDirectory getPlaylist(String id, String name) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getPlaylist(id, name, context);
|
return musicService.getPlaylist(id, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PodcastsChannel> getPodcastsChannels(boolean refresh, Context context) throws Exception {
|
public List<PodcastsChannel> getPodcastsChannels(boolean refresh) throws Exception {
|
||||||
checkSettingsChanged();
|
checkSettingsChanged();
|
||||||
List<PodcastsChannel> result = refresh ? null : cachedPodcastsChannels.get();
|
List<PodcastsChannel> result = refresh ? null : cachedPodcastsChannels.get();
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = musicService.getPodcastsChannels(refresh, context);
|
result = musicService.getPodcastsChannels(refresh);
|
||||||
cachedPodcastsChannels.set(result);
|
cachedPodcastsChannels.set(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getPodcastEpisodes(String podcastChannelId, Context context) throws Exception {
|
public MusicDirectory getPodcastEpisodes(String podcastChannelId) throws Exception {
|
||||||
return musicService.getPodcastEpisodes(podcastChannelId,context);
|
return musicService.getPodcastEpisodes(podcastChannelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Playlist> getPlaylists(boolean refresh, Context context) throws Exception
|
public List<Playlist> getPlaylists(boolean refresh) throws Exception
|
||||||
{
|
{
|
||||||
checkSettingsChanged();
|
checkSettingsChanged();
|
||||||
List<Playlist> result = refresh ? null : cachedPlaylists.get();
|
List<Playlist> result = refresh ? null : cachedPlaylists.get();
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = musicService.getPlaylists(refresh, context);
|
result = musicService.getPlaylists(refresh);
|
||||||
cachedPlaylists.set(result);
|
cachedPlaylists.set(result);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries, Context context) throws Exception
|
public void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries) throws Exception
|
||||||
{
|
{
|
||||||
cachedPlaylists.clear();
|
cachedPlaylists.clear();
|
||||||
musicService.createPlaylist(id, name, entries, context);
|
musicService.createPlaylist(id, name, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePlaylist(String id, Context context) throws Exception
|
public void deletePlaylist(String id) throws Exception
|
||||||
{
|
{
|
||||||
musicService.deletePlaylist(id, context);
|
musicService.deletePlaylist(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context) throws Exception
|
public void updatePlaylist(String id, String name, String comment, boolean pub) throws Exception
|
||||||
{
|
{
|
||||||
musicService.updatePlaylist(id, name, comment, pub, context);
|
musicService.updatePlaylist(id, name, comment, pub);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Lyrics getLyrics(String artist, String title, Context context) throws Exception
|
public Lyrics getLyrics(String artist, String title) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getLyrics(artist, title, context);
|
return musicService.getLyrics(artist, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrobble(String id, boolean submission, Context context) throws Exception
|
public void scrobble(String id, boolean submission) throws Exception
|
||||||
{
|
{
|
||||||
musicService.scrobble(id, submission, context);
|
musicService.scrobble(id, submission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -296,9 +295,9 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getRandomSongs(int size, Context context) throws Exception
|
public MusicDirectory getRandomSongs(int size) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getRandomSongs(size, context);
|
return musicService.getRandomSongs(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -314,9 +313,9 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getCoverArt(Context context, MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality) throws Exception
|
public Bitmap getCoverArt(MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getCoverArt(context, entry, size, saveToFile, highQuality);
|
return musicService.getCoverArt(entry, size, saveToFile, highQuality);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -326,45 +325,45 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVideoUrl(Context context, String id, boolean useFlash) throws Exception
|
public String getVideoUrl(String id, boolean useFlash) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getVideoUrl(context, id, useFlash);
|
return musicService.getVideoUrl(id, useFlash);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context) throws Exception
|
public JukeboxStatus updateJukeboxPlaylist(List<String> ids) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.updateJukeboxPlaylist(ids, context);
|
return musicService.updateJukeboxPlaylist(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus skipJukebox(int index, int offsetSeconds, Context context) throws Exception
|
public JukeboxStatus skipJukebox(int index, int offsetSeconds) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.skipJukebox(index, offsetSeconds, context);
|
return musicService.skipJukebox(index, offsetSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus stopJukebox(Context context) throws Exception
|
public JukeboxStatus stopJukebox() throws Exception
|
||||||
{
|
{
|
||||||
return musicService.stopJukebox(context);
|
return musicService.stopJukebox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus startJukebox(Context context) throws Exception
|
public JukeboxStatus startJukebox() throws Exception
|
||||||
{
|
{
|
||||||
return musicService.startJukebox(context);
|
return musicService.startJukebox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus getJukeboxStatus(Context context) throws Exception
|
public JukeboxStatus getJukeboxStatus() throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getJukeboxStatus(context);
|
return musicService.getJukeboxStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus setJukeboxGain(float gain, Context context) throws Exception
|
public JukeboxStatus setJukeboxGain(float gain) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.setJukeboxGain(gain, context);
|
return musicService.setJukeboxGain(gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkSettingsChanged()
|
private void checkSettingsChanged()
|
||||||
|
@ -434,49 +433,49 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getSongsByGenre(String genre, int count, int offset, Context context) throws Exception
|
public MusicDirectory getSongsByGenre(String genre, int count, int offset) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getSongsByGenre(genre, count, offset, context);
|
return musicService.getSongsByGenre(genre, count, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Share> getShares(boolean refresh, Context context) throws Exception
|
public List<Share> getShares(boolean refresh) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getShares(refresh, context);
|
return musicService.getShares(refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChatMessage> getChatMessages(Long since, Context context) throws Exception
|
public List<ChatMessage> getChatMessages(Long since) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getChatMessages(since, context);
|
return musicService.getChatMessages(since);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChatMessage(String message, Context context) throws Exception
|
public void addChatMessage(String message) throws Exception
|
||||||
{
|
{
|
||||||
musicService.addChatMessage(message, context);
|
musicService.addChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Bookmark> getBookmarks(Context context) throws Exception
|
public List<Bookmark> getBookmarks() throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getBookmarks(context);
|
return musicService.getBookmarks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteBookmark(String id, Context context) throws Exception
|
public void deleteBookmark(String id) throws Exception
|
||||||
{
|
{
|
||||||
musicService.deleteBookmark(id, context);
|
musicService.deleteBookmark(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBookmark(String id, int position, Context context) throws Exception
|
public void createBookmark(String id, int position) throws Exception
|
||||||
{
|
{
|
||||||
musicService.createBookmark(id, position, context);
|
musicService.createBookmark(id, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getVideos(boolean refresh, Context context) throws Exception
|
public MusicDirectory getVideos(boolean refresh) throws Exception
|
||||||
{
|
{
|
||||||
checkSettingsChanged();
|
checkSettingsChanged();
|
||||||
TimeLimitedCache<MusicDirectory> cache = refresh ? null : cachedMusicDirectories.get(Constants.INTENT_EXTRA_NAME_VIDEOS);
|
TimeLimitedCache<MusicDirectory> cache = refresh ? null : cachedMusicDirectories.get(Constants.INTENT_EXTRA_NAME_VIDEOS);
|
||||||
|
@ -485,7 +484,7 @@ public class CachedMusicService implements MusicService
|
||||||
|
|
||||||
if (dir == null)
|
if (dir == null)
|
||||||
{
|
{
|
||||||
dir = musicService.getVideos(refresh, context);
|
dir = musicService.getVideos(refresh);
|
||||||
cache = new TimeLimitedCache<>(Util.getDirectoryCacheTime(), TimeUnit.SECONDS);
|
cache = new TimeLimitedCache<>(Util.getDirectoryCacheTime(), TimeUnit.SECONDS);
|
||||||
cache.set(dir);
|
cache.set(dir);
|
||||||
cachedMusicDirectories.put(Constants.INTENT_EXTRA_NAME_VIDEOS, cache);
|
cachedMusicDirectories.put(Constants.INTENT_EXTRA_NAME_VIDEOS, cache);
|
||||||
|
@ -495,7 +494,7 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserInfo getUser(String username, Context context) throws Exception
|
public UserInfo getUser(String username) throws Exception
|
||||||
{
|
{
|
||||||
checkSettingsChanged();
|
checkSettingsChanged();
|
||||||
|
|
||||||
|
@ -505,7 +504,7 @@ public class CachedMusicService implements MusicService
|
||||||
|
|
||||||
if (userInfo == null)
|
if (userInfo == null)
|
||||||
{
|
{
|
||||||
userInfo = musicService.getUser(username, context);
|
userInfo = musicService.getUser(username);
|
||||||
cache = new TimeLimitedCache<>(Util.getDirectoryCacheTime(), TimeUnit.SECONDS);
|
cache = new TimeLimitedCache<>(Util.getDirectoryCacheTime(), TimeUnit.SECONDS);
|
||||||
cache.set(userInfo);
|
cache.set(userInfo);
|
||||||
cachedUserInfo.put(username, cache);
|
cachedUserInfo.put(username, cache);
|
||||||
|
@ -515,26 +514,26 @@ public class CachedMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Share> createShare(List<String> ids, String description, Long expires, Context context) throws Exception
|
public List<Share> createShare(List<String> ids, String description, Long expires) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.createShare(ids, description, expires, context);
|
return musicService.createShare(ids, description, expires);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteShare(String id, Context context) throws Exception
|
public void deleteShare(String id) throws Exception
|
||||||
{
|
{
|
||||||
musicService.deleteShare(id, context);
|
musicService.deleteShare(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateShare(String id, String description, Long expires, Context context) throws Exception
|
public void updateShare(String id, String description, Long expires) throws Exception
|
||||||
{
|
{
|
||||||
musicService.updateShare(id, description, expires, context);
|
musicService.updateShare(id, description, expires);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getAvatar(Context context, String username, int size, boolean saveToFile, boolean highQuality) throws Exception
|
public Bitmap getAvatar(String username, int size, boolean saveToFile, boolean highQuality) throws Exception
|
||||||
{
|
{
|
||||||
return musicService.getAvatar(context, username, size, saveToFile, highQuality);
|
return musicService.getAvatar(username, size, saveToFile, highQuality);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -397,7 +397,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().getJukeboxStatus(context);
|
return getMusicService().getJukeboxStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().updateJukeboxPlaylist(ids, context);
|
return getMusicService().updateJukeboxPlaylist(ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +431,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().skipJukebox(index, offsetSeconds, context);
|
return getMusicService().skipJukebox(index, offsetSeconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().stopJukebox(context);
|
return getMusicService().stopJukebox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,7 +449,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().startJukebox(context);
|
return getMusicService().startJukebox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ public class JukeboxMediaPlayer
|
||||||
@Override
|
@Override
|
||||||
JukeboxStatus execute() throws Exception
|
JukeboxStatus execute() throws Exception
|
||||||
{
|
{
|
||||||
return getMusicService().setJukeboxGain(gain, context);
|
return getMusicService().setJukeboxGain(gain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -527,7 +527,7 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String username = activeServerProvider.getValue().getActiveServer().getUserName();
|
String username = activeServerProvider.getValue().getActiveServer().getUserName();
|
||||||
UserInfo user = MusicServiceFactory.getMusicService().getUser(username, context);
|
UserInfo user = MusicServiceFactory.getMusicService().getUser(username);
|
||||||
return user.getJukeboxRole();
|
return user.getJukeboxRole();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.moire.ultrasonic.service;
|
package org.moire.ultrasonic.service;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
|
|
||||||
import org.moire.ultrasonic.domain.Bookmark;
|
import org.moire.ultrasonic.domain.Bookmark;
|
||||||
|
@ -71,82 +70,82 @@ public interface MusicService
|
||||||
|
|
||||||
MusicDirectory getAlbum(String id, String name, boolean refresh) throws Exception;
|
MusicDirectory getAlbum(String id, String name, boolean refresh) throws Exception;
|
||||||
|
|
||||||
SearchResult search(SearchCriteria criteria, Context context) throws Exception;
|
SearchResult search(SearchCriteria criteria) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getPlaylist(String id, String name, Context context) throws Exception;
|
MusicDirectory getPlaylist(String id, String name) throws Exception;
|
||||||
|
|
||||||
List<PodcastsChannel> getPodcastsChannels(boolean refresh, Context context) throws Exception;
|
List<PodcastsChannel> getPodcastsChannels(boolean refresh) throws Exception;
|
||||||
|
|
||||||
List<Playlist> getPlaylists(boolean refresh, Context context) throws Exception;
|
List<Playlist> getPlaylists(boolean refresh) throws Exception;
|
||||||
|
|
||||||
void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries, Context context) throws Exception;
|
void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries) throws Exception;
|
||||||
|
|
||||||
void deletePlaylist(String id, Context context) throws Exception;
|
void deletePlaylist(String id) throws Exception;
|
||||||
|
|
||||||
void updatePlaylist(String id, String name, String comment, boolean pub, Context context) throws Exception;
|
void updatePlaylist(String id, String name, String comment, boolean pub) throws Exception;
|
||||||
|
|
||||||
Lyrics getLyrics(String artist, String title, Context context) throws Exception;
|
Lyrics getLyrics(String artist, String title) throws Exception;
|
||||||
|
|
||||||
void scrobble(String id, boolean submission, Context context) throws Exception;
|
void scrobble(String id, boolean submission) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getAlbumList(String type, int size, int offset, String musicFolderId) throws Exception;
|
MusicDirectory getAlbumList(String type, int size, int offset, String musicFolderId) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getAlbumList2(String type, int size, int offset, String musicFolderId) throws Exception;
|
MusicDirectory getAlbumList2(String type, int size, int offset, String musicFolderId) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getRandomSongs(int size, Context context) throws Exception;
|
MusicDirectory getRandomSongs(int size) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getSongsByGenre(String genre, int count, int offset, Context context) throws Exception;
|
MusicDirectory getSongsByGenre(String genre, int count, int offset) throws Exception;
|
||||||
|
|
||||||
SearchResult getStarred() throws Exception;
|
SearchResult getStarred() throws Exception;
|
||||||
|
|
||||||
SearchResult getStarred2() throws Exception;
|
SearchResult getStarred2() throws Exception;
|
||||||
|
|
||||||
Bitmap getCoverArt(Context context, MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality) throws Exception;
|
Bitmap getCoverArt(MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality) throws Exception;
|
||||||
|
|
||||||
/**
|
Bitmap getAvatar(String username, int size, boolean saveToFile, boolean highQuality) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
* Return response {@link InputStream} and a {@link Boolean} that indicates if this response is
|
* Return response {@link InputStream} and a {@link Boolean} that indicates if this response is
|
||||||
* partial.
|
* partial.
|
||||||
*/
|
*/
|
||||||
Pair<InputStream, Boolean> getDownloadInputStream(MusicDirectory.Entry song, long offset, int maxBitrate) throws Exception;
|
Pair<InputStream, Boolean> getDownloadInputStream(MusicDirectory.Entry song, long offset, int maxBitrate) throws Exception;
|
||||||
|
|
||||||
// TODO: Refactor and remove this call (see RestMusicService implementation)
|
// TODO: Refactor and remove this call (see RestMusicService implementation)
|
||||||
String getVideoUrl(Context context, String id, boolean useFlash) throws Exception;
|
String getVideoUrl(String id, boolean useFlash) throws Exception;
|
||||||
|
|
||||||
JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context) throws Exception;
|
JukeboxStatus updateJukeboxPlaylist(List<String> ids) throws Exception;
|
||||||
|
|
||||||
JukeboxStatus skipJukebox(int index, int offsetSeconds, Context context) throws Exception;
|
JukeboxStatus skipJukebox(int index, int offsetSeconds) throws Exception;
|
||||||
|
|
||||||
JukeboxStatus stopJukebox(Context context) throws Exception;
|
JukeboxStatus stopJukebox() throws Exception;
|
||||||
|
|
||||||
JukeboxStatus startJukebox(Context context) throws Exception;
|
JukeboxStatus startJukebox() throws Exception;
|
||||||
|
|
||||||
JukeboxStatus getJukeboxStatus(Context context) throws Exception;
|
JukeboxStatus getJukeboxStatus() throws Exception;
|
||||||
|
|
||||||
JukeboxStatus setJukeboxGain(float gain, Context context) throws Exception;
|
JukeboxStatus setJukeboxGain(float gain) throws Exception;
|
||||||
|
|
||||||
List<Share> getShares(boolean refresh, Context context) throws Exception;
|
List<Share> getShares(boolean refresh) throws Exception;
|
||||||
|
|
||||||
List<ChatMessage> getChatMessages(Long since, Context context) throws Exception;
|
List<ChatMessage> getChatMessages(Long since) throws Exception;
|
||||||
|
|
||||||
void addChatMessage(String message, Context context) throws Exception;
|
void addChatMessage(String message) throws Exception;
|
||||||
|
|
||||||
List<Bookmark> getBookmarks(Context context) throws Exception;
|
List<Bookmark> getBookmarks() throws Exception;
|
||||||
|
|
||||||
void deleteBookmark(String id, Context context) throws Exception;
|
void deleteBookmark(String id) throws Exception;
|
||||||
|
|
||||||
void createBookmark(String id, int position, Context context) throws Exception;
|
void createBookmark(String id, int position) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getVideos(boolean refresh, Context context) throws Exception;
|
MusicDirectory getVideos(boolean refresh) throws Exception;
|
||||||
|
|
||||||
UserInfo getUser(String username, Context context) throws Exception;
|
UserInfo getUser(String username) throws Exception;
|
||||||
|
|
||||||
List<Share> createShare(List<String> ids, String description, Long expires, Context context) throws Exception;
|
List<Share> createShare(List<String> ids, String description, Long expires) throws Exception;
|
||||||
|
|
||||||
void deleteShare(String id, Context context) throws Exception;
|
void deleteShare(String id) throws Exception;
|
||||||
|
|
||||||
void updateShare(String id, String description, Long expires, Context context) throws Exception;
|
void updateShare(String id, String description, Long expires) throws Exception;
|
||||||
|
|
||||||
Bitmap getAvatar(Context context, String username, int size, boolean saveToFile, boolean highQuality) throws Exception;
|
MusicDirectory getPodcastEpisodes(String podcastChannelId) throws Exception;
|
||||||
|
|
||||||
MusicDirectory getPodcastEpisodes(String podcastChannelId, Context context) throws Exception;
|
|
||||||
}
|
}
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.moire.ultrasonic.service;
|
package org.moire.ultrasonic.service;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.media.MediaMetadataRetriever;
|
import android.media.MediaMetadataRetriever;
|
||||||
|
|
||||||
|
@ -333,7 +332,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getAvatar(Context context, String username, int size, boolean saveToFile, boolean highQuality)
|
public Bitmap getAvatar(String username, int size, boolean saveToFile, boolean highQuality)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -347,11 +346,11 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Bitmap getCoverArt(Context context, MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality)
|
public Bitmap getCoverArt(MusicDirectory.Entry entry, int size, boolean saveToFile, boolean highQuality)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Bitmap bitmap = FileUtil.getAlbumArtBitmap(context, entry, size, highQuality);
|
Bitmap bitmap = FileUtil.getAlbumArtBitmap(entry, size, highQuality);
|
||||||
return Util.scaleBitmap(bitmap, size);
|
return Util.scaleBitmap(bitmap, size);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -361,7 +360,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SearchResult search(SearchCriteria criteria, Context context)
|
public SearchResult search(SearchCriteria criteria)
|
||||||
{
|
{
|
||||||
List<Artist> artists = new ArrayList<>();
|
List<Artist> artists = new ArrayList<>();
|
||||||
List<MusicDirectory.Entry> albums = new ArrayList<>();
|
List<MusicDirectory.Entry> albums = new ArrayList<>();
|
||||||
|
@ -384,7 +383,7 @@ public class OfflineMusicService implements MusicService
|
||||||
artists.add(artist);
|
artists.add(artist);
|
||||||
}
|
}
|
||||||
|
|
||||||
recursiveAlbumSearch(artistName, artistFile, criteria, context, albums, songs);
|
recursiveAlbumSearch(artistName, artistFile, criteria, albums, songs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +430,7 @@ public class OfflineMusicService implements MusicService
|
||||||
return new SearchResult(artists, albums, songs);
|
return new SearchResult(artists, albums, songs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void recursiveAlbumSearch(String artistName, File file, SearchCriteria criteria, Context context, List<MusicDirectory.Entry> albums, List<MusicDirectory.Entry> songs)
|
private static void recursiveAlbumSearch(String artistName, File file, SearchCriteria criteria, List<MusicDirectory.Entry> albums, List<MusicDirectory.Entry> songs)
|
||||||
{
|
{
|
||||||
int closeness;
|
int closeness;
|
||||||
|
|
||||||
|
@ -454,7 +453,7 @@ public class OfflineMusicService implements MusicService
|
||||||
|
|
||||||
if (songFile.isDirectory())
|
if (songFile.isDirectory())
|
||||||
{
|
{
|
||||||
recursiveAlbumSearch(artistName, songFile, criteria, context, albums, songs);
|
recursiveAlbumSearch(artistName, songFile, criteria, albums, songs);
|
||||||
}
|
}
|
||||||
else if ((closeness = matchCriteria(criteria, songName)) > 0)
|
else if ((closeness = matchCriteria(criteria, songName)) > 0)
|
||||||
{
|
{
|
||||||
|
@ -505,7 +504,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Playlist> getPlaylists(boolean refresh, Context context)
|
public List<Playlist> getPlaylists(boolean refresh)
|
||||||
{
|
{
|
||||||
List<Playlist> playlists = new ArrayList<>();
|
List<Playlist> playlists = new ArrayList<>();
|
||||||
File root = FileUtil.getPlaylistDirectory();
|
File root = FileUtil.getPlaylistDirectory();
|
||||||
|
@ -564,7 +563,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getPlaylist(String id, String name, Context context) throws Exception
|
public MusicDirectory getPlaylist(String id, String name) throws Exception
|
||||||
{
|
{
|
||||||
Reader reader = null;
|
Reader reader = null;
|
||||||
BufferedReader buffer = null;
|
BufferedReader buffer = null;
|
||||||
|
@ -606,7 +605,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries, Context context) throws Exception
|
public void createPlaylist(String id, String name, List<MusicDirectory.Entry> entries) throws Exception
|
||||||
{
|
{
|
||||||
File playlistFile = FileUtil.getPlaylistFile(activeServerProvider.getValue().getActiveServer().getName(), name);
|
File playlistFile = FileUtil.getPlaylistFile(activeServerProvider.getValue().getActiveServer().getName(), name);
|
||||||
FileWriter fw = new FileWriter(playlistFile);
|
FileWriter fw = new FileWriter(playlistFile);
|
||||||
|
@ -639,7 +638,7 @@ public class OfflineMusicService implements MusicService
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getRandomSongs(int size, Context context)
|
public MusicDirectory getRandomSongs(int size)
|
||||||
{
|
{
|
||||||
File root = FileUtil.getMusicDirectory();
|
File root = FileUtil.getMusicDirectory();
|
||||||
List<File> children = new LinkedList<>();
|
List<File> children = new LinkedList<>();
|
||||||
|
@ -677,25 +676,25 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deletePlaylist(String id, Context context) throws Exception
|
public void deletePlaylist(String id) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Playlists not available in offline mode");
|
throw new OfflineException("Playlists not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePlaylist(String id, String name, String comment, boolean pub, Context context) throws Exception
|
public void updatePlaylist(String id, String name, String comment, boolean pub) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Updating playlist not available in offline mode");
|
throw new OfflineException("Updating playlist not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Lyrics getLyrics(String artist, String title, Context context) throws Exception
|
public Lyrics getLyrics(String artist, String title) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Lyrics not available in offline mode");
|
throw new OfflineException("Lyrics not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrobble(String id, boolean submission, Context context) throws Exception
|
public void scrobble(String id, boolean submission) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Scrobbling not available in offline mode");
|
throw new OfflineException("Scrobbling not available in offline mode");
|
||||||
}
|
}
|
||||||
|
@ -707,37 +706,37 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus updateJukeboxPlaylist(List<String> ids, Context context) throws Exception
|
public JukeboxStatus updateJukeboxPlaylist(List<String> ids) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus skipJukebox(int index, int offsetSeconds, Context context) throws Exception
|
public JukeboxStatus skipJukebox(int index, int offsetSeconds) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus stopJukebox(Context context) throws Exception
|
public JukeboxStatus stopJukebox() throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus startJukebox(Context context) throws Exception
|
public JukeboxStatus startJukebox() throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus getJukeboxStatus(Context context) throws Exception
|
public JukeboxStatus getJukeboxStatus() throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JukeboxStatus setJukeboxGain(float gain, Context context) throws Exception
|
public JukeboxStatus setJukeboxGain(float gain) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Jukebox not available in offline mode");
|
throw new OfflineException("Jukebox not available in offline mode");
|
||||||
}
|
}
|
||||||
|
@ -749,7 +748,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getSongsByGenre(String genre, int count, int offset, Context context) throws Exception
|
public MusicDirectory getSongsByGenre(String genre, int count, int offset) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Getting Songs By Genre not available in offline mode");
|
throw new OfflineException("Getting Songs By Genre not available in offline mode");
|
||||||
}
|
}
|
||||||
|
@ -761,31 +760,31 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserInfo getUser(String username, Context context) throws Exception
|
public UserInfo getUser(String username) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Getting user info not available in offline mode");
|
throw new OfflineException("Getting user info not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Share> createShare(List<String> ids, String description, Long expires, Context context) throws Exception
|
public List<Share> createShare(List<String> ids, String description, Long expires) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Creating shares not available in offline mode");
|
throw new OfflineException("Creating shares not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Share> getShares(boolean refresh, Context context) throws Exception
|
public List<Share> getShares(boolean refresh) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Getting shares not available in offline mode");
|
throw new OfflineException("Getting shares not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteShare(String id, Context context) throws Exception
|
public void deleteShare(String id) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Deleting shares not available in offline mode");
|
throw new OfflineException("Deleting shares not available in offline mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateShare(String id, String description, Long expires, Context context) throws Exception
|
public void updateShare(String id, String description, Long expires) throws Exception
|
||||||
{
|
{
|
||||||
throw new OfflineException("Updating shares not available in offline mode");
|
throw new OfflineException("Updating shares not available in offline mode");
|
||||||
}
|
}
|
||||||
|
@ -814,40 +813,40 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVideoUrl(Context context, String id, boolean useFlash) {
|
public String getVideoUrl(String id, boolean useFlash) {
|
||||||
Timber.w("OfflineMusicService.getVideoUrl was called but it isn't available");
|
Timber.w("OfflineMusicService.getVideoUrl was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ChatMessage> getChatMessages(Long since, Context context) {
|
public List<ChatMessage> getChatMessages(Long since) {
|
||||||
Timber.w("OfflineMusicService.getChatMessages was called but it isn't available");
|
Timber.w("OfflineMusicService.getChatMessages was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addChatMessage(String message, Context context) {
|
public void addChatMessage(String message) {
|
||||||
Timber.w("OfflineMusicService.addChatMessage was called but it isn't available");
|
Timber.w("OfflineMusicService.addChatMessage was called but it isn't available");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Bookmark> getBookmarks(Context context) {
|
public List<Bookmark> getBookmarks() {
|
||||||
Timber.w("OfflineMusicService.getBookmarks was called but it isn't available");
|
Timber.w("OfflineMusicService.getBookmarks was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteBookmark(String id, Context context) {
|
public void deleteBookmark(String id) {
|
||||||
Timber.w("OfflineMusicService.deleteBookmark was called but it isn't available");
|
Timber.w("OfflineMusicService.deleteBookmark was called but it isn't available");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createBookmark(String id, int position, Context context) {
|
public void createBookmark(String id, int position) {
|
||||||
Timber.w("OfflineMusicService.createBookmark was called but it isn't available");
|
Timber.w("OfflineMusicService.createBookmark was called but it isn't available");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getVideos(boolean refresh, Context context) {
|
public MusicDirectory getVideos(boolean refresh) {
|
||||||
Timber.w("OfflineMusicService.getVideos was called but it isn't available");
|
Timber.w("OfflineMusicService.getVideos was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -886,7 +885,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MusicDirectory getPodcastEpisodes(String podcastChannelId, Context context) {
|
public MusicDirectory getPodcastEpisodes(String podcastChannelId) {
|
||||||
Timber.w("OfflineMusicService.getPodcastEpisodes was called but it isn't available");
|
Timber.w("OfflineMusicService.getPodcastEpisodes was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -903,7 +902,7 @@ public class OfflineMusicService implements MusicService
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PodcastsChannel> getPodcastsChannels(boolean refresh, Context context) {
|
public List<PodcastsChannel> getPodcastsChannels(boolean refresh) {
|
||||||
Timber.w("OfflineMusicService.getPodcastsChannels was called but it isn't available");
|
Timber.w("OfflineMusicService.getPodcastsChannels was called but it isn't available");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class Scrobbler
|
||||||
MusicService service = MusicServiceFactory.getMusicService();
|
MusicService service = MusicServiceFactory.getMusicService();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
service.scrobble(id, submission, context);
|
service.scrobble(id, submission);
|
||||||
Timber.i("Scrobbled '%s' for %s", submission ? "submission" : "now playing", song);
|
Timber.i("Scrobbled '%s' for %s", submission ? "submission" : "now playing", song);
|
||||||
}
|
}
|
||||||
catch (Exception x)
|
catch (Exception x)
|
||||||
|
|
|
@ -214,7 +214,7 @@ public class FileUtil
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap getAlbumArtBitmap(Context context, MusicDirectory.Entry entry, int size, boolean highQuality)
|
public static Bitmap getAlbumArtBitmap(MusicDirectory.Entry entry, int size, boolean highQuality)
|
||||||
{
|
{
|
||||||
if (entry == null) return null;
|
if (entry == null) return null;
|
||||||
|
|
||||||
|
|
|
@ -419,8 +419,8 @@ public class LegacyImageLoader implements Runnable, ImageLoader {
|
||||||
MusicService musicService = MusicServiceFactory.getMusicService();
|
MusicService musicService = MusicServiceFactory.getMusicService();
|
||||||
final boolean isAvatar = this.username != null && this.entry == null;
|
final boolean isAvatar = this.username != null && this.entry == null;
|
||||||
final Bitmap bitmap = this.entry != null ?
|
final Bitmap bitmap = this.entry != null ?
|
||||||
musicService.getCoverArt(view.getContext(), entry, size, saveToFile, highQuality) :
|
musicService.getCoverArt(entry, size, saveToFile, highQuality) :
|
||||||
musicService.getAvatar(view.getContext(), username, size, saveToFile, highQuality);
|
musicService.getAvatar(username, size, saveToFile, highQuality);
|
||||||
|
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
Timber.d("Found empty album art.");
|
Timber.d("Found empty album art.");
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class ShufflePlayBuffer
|
||||||
{
|
{
|
||||||
MusicService service = MusicServiceFactory.getMusicService();
|
MusicService service = MusicServiceFactory.getMusicService();
|
||||||
int n = CAPACITY - buffer.size();
|
int n = CAPACITY - buffer.size();
|
||||||
MusicDirectory songs = service.getRandomSongs(n, context);
|
MusicDirectory songs = service.getRandomSongs(n);
|
||||||
|
|
||||||
synchronized (buffer)
|
synchronized (buffer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,7 +137,6 @@ public class Util
|
||||||
return preferences.getBoolean(Constants.PREFERENCES_KEY_ALWAYS_SHOW_NOTIFICATION, false);
|
return preferences.getBoolean(Constants.PREFERENCES_KEY_ALWAYS_SHOW_NOTIFICATION, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({"BooleanMethodIsAlwaysInverted"}) // It is inverted for readability
|
|
||||||
public static boolean isLockScreenEnabled()
|
public static boolean isLockScreenEnabled()
|
||||||
{
|
{
|
||||||
SharedPreferences preferences = getPreferences();
|
SharedPreferences preferences = getPreferences();
|
||||||
|
@ -1061,7 +1060,7 @@ public class Util
|
||||||
return preferences.getBoolean(Constants.PREFERENCES_KEY_ID3_TAGS, false);
|
return preferences.getBoolean(Constants.PREFERENCES_KEY_ID3_TAGS, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean getShouldShowArtistPicture(Context context)
|
public static boolean getShouldShowArtistPicture()
|
||||||
{
|
{
|
||||||
SharedPreferences preferences = getPreferences();
|
SharedPreferences preferences = getPreferences();
|
||||||
boolean isOffline = ActiveServerProvider.Companion.isOffline();
|
boolean isOffline = ActiveServerProvider.Companion.isOffline();
|
||||||
|
@ -1082,7 +1081,6 @@ public class Util
|
||||||
return Integer.parseInt(preferences.getString(Constants.PREFERENCES_KEY_DIRECTORY_CACHE_TIME, "300"));
|
return Integer.parseInt(preferences.getString(Constants.PREFERENCES_KEY_DIRECTORY_CACHE_TIME, "300"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted") // Inverted for readability
|
|
||||||
public static boolean isNullOrWhiteSpace(String string)
|
public static boolean isNullOrWhiteSpace(String string)
|
||||||
{
|
{
|
||||||
return string == null || string.isEmpty() || string.trim().isEmpty();
|
return string == null || string.isEmpty() || string.trim().isEmpty();
|
||||||
|
|
|
@ -79,7 +79,7 @@ public enum VideoPlayerType
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setPackage(installedPro ? PACKAGE_NAME_MX_PRO : PACKAGE_NAME_MX_AD);
|
intent.setPackage(installedPro ? PACKAGE_NAME_MX_PRO : PACKAGE_NAME_MX_AD);
|
||||||
intent.putExtra("title", entry.getTitle());
|
intent.putExtra("title", entry.getTitle());
|
||||||
intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(context, entry.getId(), false)), "video/*");
|
intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(entry.getId(), false)), "video/*");
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public enum VideoPlayerType
|
||||||
public void playVideo(Context context, MusicDirectory.Entry entry) throws Exception
|
public void playVideo(Context context, MusicDirectory.Entry entry) throws Exception
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setData(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(context, entry.getId(), true)));
|
intent.setData(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(entry.getId(), true)));
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ public enum VideoPlayerType
|
||||||
public void playVideo(Context context, MusicDirectory.Entry entry) throws Exception
|
public void playVideo(Context context, MusicDirectory.Entry entry) throws Exception
|
||||||
{
|
{
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(context, entry.getId(), false)), "video/*");
|
intent.setDataAndType(Uri.parse(MusicServiceFactory.getMusicService().getVideoUrl(entry.getId(), false)), "video/*");
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,7 +98,7 @@ class ArtistRowAdapter(
|
||||||
holder.layout.setOnLongClickListener { view -> createPopupMenu(view, listPosition) }
|
holder.layout.setOnLongClickListener { view -> createPopupMenu(view, listPosition) }
|
||||||
holder.coverArtId = artistList[listPosition].coverArt
|
holder.coverArtId = artistList[listPosition].coverArt
|
||||||
|
|
||||||
if (Util.getShouldShowArtistPicture(holder.coverArt.context)) {
|
if (Util.getShouldShowArtistPicture()) {
|
||||||
holder.coverArt.visibility = View.VISIBLE
|
holder.coverArt.visibility = View.VISIBLE
|
||||||
imageLoader.loadImage(
|
imageLoader.loadImage(
|
||||||
holder.coverArt,
|
holder.coverArt,
|
||||||
|
|
|
@ -200,7 +200,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
suspend fun getSongsForGenre(genre: String, count: Int, offset: Int) {
|
suspend fun getSongsForGenre(genre: String, count: Int, offset: Int) {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getSongsByGenre(genre, count, offset, context)
|
val musicDirectory = service.getSongsByGenre(genre, count, offset)
|
||||||
songsForGenre.postValue(musicDirectory)
|
songsForGenre.postValue(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
currentDirectory.postValue(service.getVideos(refresh, context))
|
currentDirectory.postValue(service.getVideos(refresh))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getRandomSongs(size, context)
|
val musicDirectory = service.getRandomSongs(size)
|
||||||
|
|
||||||
currentDirectoryIsSortable = false
|
currentDirectoryIsSortable = false
|
||||||
currentDirectory.postValue(musicDirectory)
|
currentDirectory.postValue(musicDirectory)
|
||||||
|
@ -246,7 +246,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getPlaylist(playlistId, playlistName, context)
|
val musicDirectory = service.getPlaylist(playlistId, playlistName)
|
||||||
|
|
||||||
currentDirectory.postValue(musicDirectory)
|
currentDirectory.postValue(musicDirectory)
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
|
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = service.getPodcastEpisodes(podcastChannelId, context)
|
val musicDirectory = service.getPodcastEpisodes(podcastChannelId)
|
||||||
currentDirectory.postValue(musicDirectory)
|
currentDirectory.postValue(musicDirectory)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||||
val service = MusicServiceFactory.getMusicService()
|
val service = MusicServiceFactory.getMusicService()
|
||||||
val musicDirectory = MusicDirectory()
|
val musicDirectory = MusicDirectory()
|
||||||
|
|
||||||
val shares = service.getShares(true, context)
|
val shares = service.getShares(true)
|
||||||
|
|
||||||
for (share in shares) {
|
for (share in shares) {
|
||||||
if (share.id == shareId) {
|
if (share.id == shareId) {
|
||||||
|
|
|
@ -330,7 +330,7 @@ class DownloadFile(
|
||||||
try {
|
try {
|
||||||
if (!TextUtils.isEmpty(song.coverArt)) {
|
if (!TextUtils.isEmpty(song.coverArt)) {
|
||||||
val size = Util.getMinDisplayMetric(context)
|
val size = Util.getMinDisplayMetric(context)
|
||||||
musicService.getCoverArt(context, song, size, true, true)
|
musicService.getCoverArt(song, size, true, true)
|
||||||
}
|
}
|
||||||
} catch (x: Exception) {
|
} catch (x: Exception) {
|
||||||
Timber.e(x, "Failed to get cover art.")
|
Timber.e(x, "Failed to get cover art.")
|
||||||
|
|
|
@ -417,14 +417,13 @@ class MediaPlayerService : Service() {
|
||||||
private fun setupOnSongCompletedHandler() {
|
private fun setupOnSongCompletedHandler() {
|
||||||
localMediaPlayer.onSongCompleted = { currentPlaying: DownloadFile? ->
|
localMediaPlayer.onSongCompleted = { currentPlaying: DownloadFile? ->
|
||||||
val index = downloader.currentPlayingIndex
|
val index = downloader.currentPlayingIndex
|
||||||
val context = this@MediaPlayerService
|
|
||||||
|
|
||||||
if (currentPlaying != null) {
|
if (currentPlaying != null) {
|
||||||
val song = currentPlaying.song
|
val song = currentPlaying.song
|
||||||
if (song.bookmarkPosition > 0 && Util.getShouldClearBookmark()) {
|
if (song.bookmarkPosition > 0 && Util.getShouldClearBookmark()) {
|
||||||
val musicService = getMusicService()
|
val musicService = getMusicService()
|
||||||
try {
|
try {
|
||||||
musicService.deleteBookmark(song.id, context)
|
musicService.deleteBookmark(song.id)
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,8 +479,8 @@ class MediaPlayerService : Service() {
|
||||||
try {
|
try {
|
||||||
val song = currentPlaying.song
|
val song = currentPlaying.song
|
||||||
val cover = FileUtil.getAlbumArtBitmap(
|
val cover = FileUtil.getAlbumArtBitmap(
|
||||||
context, song,
|
song, Util.getMinDisplayMetric(context),
|
||||||
Util.getMinDisplayMetric(context), true
|
true
|
||||||
)
|
)
|
||||||
metadata.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, -1L)
|
metadata.putLong(MediaMetadataCompat.METADATA_KEY_DURATION, -1L)
|
||||||
metadata.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, song.artist)
|
metadata.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, song.artist)
|
||||||
|
@ -648,7 +647,7 @@ class MediaPlayerService : Service() {
|
||||||
// Set song title, artist and cover if possible
|
// Set song title, artist and cover if possible
|
||||||
if (song != null) {
|
if (song != null) {
|
||||||
val iconSize = (256 * context.resources.displayMetrics.density).toInt()
|
val iconSize = (256 * context.resources.displayMetrics.density).toInt()
|
||||||
val bitmap = FileUtil.getAlbumArtBitmap(context, song, iconSize, true)
|
val bitmap = FileUtil.getAlbumArtBitmap(song, iconSize, true)
|
||||||
notificationBuilder!!.setContentTitle(song.title)
|
notificationBuilder!!.setContentTitle(song.title)
|
||||||
notificationBuilder!!.setContentText(song.artist)
|
notificationBuilder!!.setContentText(song.artist)
|
||||||
notificationBuilder!!.setLargeIcon(bitmap)
|
notificationBuilder!!.setLargeIcon(bitmap)
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.moire.ultrasonic.service
|
package org.moire.ultrasonic.service
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import java.io.BufferedWriter
|
import java.io.BufferedWriter
|
||||||
|
@ -204,8 +203,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun search(
|
override fun search(
|
||||||
criteria: SearchCriteria,
|
criteria: SearchCriteria
|
||||||
context: Context
|
|
||||||
): SearchResult {
|
): SearchResult {
|
||||||
return try {
|
return try {
|
||||||
if (
|
if (
|
||||||
|
@ -270,8 +268,7 @@ open class RESTMusicService(
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getPlaylist(
|
override fun getPlaylist(
|
||||||
id: String,
|
id: String,
|
||||||
name: String?,
|
name: String?
|
||||||
context: Context
|
|
||||||
): MusicDirectory {
|
): MusicDirectory {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getPlaylist(id).execute()
|
api.getPlaylist(id).execute()
|
||||||
|
@ -318,8 +315,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getPlaylists(
|
override fun getPlaylists(
|
||||||
refresh: Boolean,
|
refresh: Boolean
|
||||||
context: Context
|
|
||||||
): List<Playlist> {
|
): List<Playlist> {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getPlaylists(null).execute()
|
api.getPlaylists(null).execute()
|
||||||
|
@ -332,8 +328,7 @@ open class RESTMusicService(
|
||||||
override fun createPlaylist(
|
override fun createPlaylist(
|
||||||
id: String?,
|
id: String?,
|
||||||
name: String?,
|
name: String?,
|
||||||
entries: List<MusicDirectory.Entry>,
|
entries: List<MusicDirectory.Entry>
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
val pSongIds: MutableList<String> = ArrayList(entries.size)
|
val pSongIds: MutableList<String> = ArrayList(entries.size)
|
||||||
|
|
||||||
|
@ -349,8 +344,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun deletePlaylist(
|
override fun deletePlaylist(
|
||||||
id: String,
|
id: String
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api -> api.deletePlaylist(id).execute() }
|
responseChecker.callWithResponseCheck { api -> api.deletePlaylist(id).execute() }
|
||||||
}
|
}
|
||||||
|
@ -360,8 +354,7 @@ open class RESTMusicService(
|
||||||
id: String,
|
id: String,
|
||||||
name: String?,
|
name: String?,
|
||||||
comment: String?,
|
comment: String?,
|
||||||
pub: Boolean,
|
pub: Boolean
|
||||||
context: Context?
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api ->
|
responseChecker.callWithResponseCheck { api ->
|
||||||
api.updatePlaylist(id, name, comment, pub, null, null)
|
api.updatePlaylist(id, name, comment, pub, null, null)
|
||||||
|
@ -371,8 +364,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getPodcastsChannels(
|
override fun getPodcastsChannels(
|
||||||
refresh: Boolean,
|
refresh: Boolean
|
||||||
context: Context
|
|
||||||
): List<PodcastsChannel> {
|
): List<PodcastsChannel> {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getPodcasts(false, null).execute()
|
api.getPodcasts(false, null).execute()
|
||||||
|
@ -383,8 +375,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getPodcastEpisodes(
|
override fun getPodcastEpisodes(
|
||||||
podcastChannelId: String?,
|
podcastChannelId: String?
|
||||||
context: Context
|
|
||||||
): MusicDirectory {
|
): MusicDirectory {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getPodcasts(true, podcastChannelId).execute()
|
api.getPodcasts(true, podcastChannelId).execute()
|
||||||
|
@ -410,8 +401,7 @@ open class RESTMusicService(
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getLyrics(
|
override fun getLyrics(
|
||||||
artist: String?,
|
artist: String?,
|
||||||
title: String?,
|
title: String?
|
||||||
context: Context
|
|
||||||
): Lyrics {
|
): Lyrics {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getLyrics(artist, title).execute()
|
api.getLyrics(artist, title).execute()
|
||||||
|
@ -423,8 +413,7 @@ open class RESTMusicService(
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun scrobble(
|
override fun scrobble(
|
||||||
id: String,
|
id: String,
|
||||||
submission: Boolean,
|
submission: Boolean
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api ->
|
responseChecker.callWithResponseCheck { api ->
|
||||||
api.scrobble(id, null, submission).execute()
|
api.scrobble(id, null, submission).execute()
|
||||||
|
@ -477,8 +466,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getRandomSongs(
|
override fun getRandomSongs(
|
||||||
size: Int,
|
size: Int
|
||||||
context: Context
|
|
||||||
): MusicDirectory {
|
): MusicDirectory {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getRandomSongs(
|
api.getRandomSongs(
|
||||||
|
@ -516,7 +504,6 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getCoverArt(
|
override fun getCoverArt(
|
||||||
context: Context,
|
|
||||||
entry: MusicDirectory.Entry?,
|
entry: MusicDirectory.Entry?,
|
||||||
size: Int,
|
size: Int,
|
||||||
saveToFile: Boolean,
|
saveToFile: Boolean,
|
||||||
|
@ -530,7 +517,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
synchronized(entry) {
|
synchronized(entry) {
|
||||||
// Use cached file, if existing.
|
// Use cached file, if existing.
|
||||||
var bitmap = FileUtil.getAlbumArtBitmap(context, entry, size, highQuality)
|
var bitmap = FileUtil.getAlbumArtBitmap(entry, size, highQuality)
|
||||||
val serverScaling = isServerScalingEnabled()
|
val serverScaling = isServerScalingEnabled()
|
||||||
|
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
|
@ -613,7 +600,6 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getVideoUrl(
|
override fun getVideoUrl(
|
||||||
context: Context,
|
|
||||||
id: String,
|
id: String,
|
||||||
useFlash: Boolean
|
useFlash: Boolean
|
||||||
): String {
|
): String {
|
||||||
|
@ -641,8 +627,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun updateJukeboxPlaylist(
|
override fun updateJukeboxPlaylist(
|
||||||
ids: List<String>?,
|
ids: List<String>?
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
): JukeboxStatus {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.SET, null, null, ids, null)
|
api.jukeboxControl(JukeboxAction.SET, null, null, ids, null)
|
||||||
|
@ -655,8 +640,7 @@ open class RESTMusicService(
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun skipJukebox(
|
override fun skipJukebox(
|
||||||
index: Int,
|
index: Int,
|
||||||
offsetSeconds: Int,
|
offsetSeconds: Int
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
): JukeboxStatus {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.SKIP, index, offsetSeconds, null, null)
|
api.jukeboxControl(JukeboxAction.SKIP, index, offsetSeconds, null, null)
|
||||||
|
@ -667,9 +651,7 @@ open class RESTMusicService(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun stopJukebox(
|
override fun stopJukebox(): JukeboxStatus {
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.STOP, null, null, null, null)
|
api.jukeboxControl(JukeboxAction.STOP, null, null, null, null)
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -679,9 +661,7 @@ open class RESTMusicService(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun startJukebox(
|
override fun startJukebox(): JukeboxStatus {
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.START, null, null, null, null)
|
api.jukeboxControl(JukeboxAction.START, null, null, null, null)
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -691,9 +671,7 @@ open class RESTMusicService(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getJukeboxStatus(
|
override fun getJukeboxStatus(): JukeboxStatus {
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.STATUS, null, null, null, null)
|
api.jukeboxControl(JukeboxAction.STATUS, null, null, null, null)
|
||||||
.execute()
|
.execute()
|
||||||
|
@ -704,8 +682,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun setJukeboxGain(
|
override fun setJukeboxGain(
|
||||||
gain: Float,
|
gain: Float
|
||||||
context: Context
|
|
||||||
): JukeboxStatus {
|
): JukeboxStatus {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.jukeboxControl(JukeboxAction.SET_GAIN, null, null, null, gain)
|
api.jukeboxControl(JukeboxAction.SET_GAIN, null, null, null, gain)
|
||||||
|
@ -717,8 +694,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getShares(
|
override fun getShares(
|
||||||
refresh: Boolean,
|
refresh: Boolean
|
||||||
context: Context
|
|
||||||
): List<Share> {
|
): List<Share> {
|
||||||
val response = responseChecker.callWithResponseCheck { api -> api.getShares().execute() }
|
val response = responseChecker.callWithResponseCheck { api -> api.getShares().execute() }
|
||||||
|
|
||||||
|
@ -738,8 +714,7 @@ open class RESTMusicService(
|
||||||
override fun getSongsByGenre(
|
override fun getSongsByGenre(
|
||||||
genre: String,
|
genre: String,
|
||||||
count: Int,
|
count: Int,
|
||||||
offset: Int,
|
offset: Int
|
||||||
context: Context
|
|
||||||
): MusicDirectory {
|
): MusicDirectory {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getSongsByGenre(genre, count, offset, null).execute()
|
api.getSongsByGenre(genre, count, offset, null).execute()
|
||||||
|
@ -753,8 +728,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getUser(
|
override fun getUser(
|
||||||
username: String,
|
username: String
|
||||||
context: Context
|
|
||||||
): UserInfo {
|
): UserInfo {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getUser(username).execute()
|
api.getUser(username).execute()
|
||||||
|
@ -765,8 +739,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getChatMessages(
|
override fun getChatMessages(
|
||||||
since: Long?,
|
since: Long?
|
||||||
context: Context
|
|
||||||
): List<ChatMessage> {
|
): List<ChatMessage> {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.getChatMessages(since).execute()
|
api.getChatMessages(since).execute()
|
||||||
|
@ -777,16 +750,13 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun addChatMessage(
|
override fun addChatMessage(
|
||||||
message: String,
|
message: String
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api -> api.addChatMessage(message).execute() }
|
responseChecker.callWithResponseCheck { api -> api.addChatMessage(message).execute() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getBookmarks(
|
override fun getBookmarks(): List<Bookmark> {
|
||||||
context: Context
|
|
||||||
): List<Bookmark> {
|
|
||||||
val response = responseChecker.callWithResponseCheck { api -> api.getBookmarks().execute() }
|
val response = responseChecker.callWithResponseCheck { api -> api.getBookmarks().execute() }
|
||||||
|
|
||||||
return response.body()!!.bookmarkList.toDomainEntitiesList()
|
return response.body()!!.bookmarkList.toDomainEntitiesList()
|
||||||
|
@ -795,8 +765,7 @@ open class RESTMusicService(
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun createBookmark(
|
override fun createBookmark(
|
||||||
id: String,
|
id: String,
|
||||||
position: Int,
|
position: Int
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api ->
|
responseChecker.callWithResponseCheck { api ->
|
||||||
api.createBookmark(id, position.toLong(), null).execute()
|
api.createBookmark(id, position.toLong(), null).execute()
|
||||||
|
@ -805,16 +774,14 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun deleteBookmark(
|
override fun deleteBookmark(
|
||||||
id: String,
|
id: String
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api -> api.deleteBookmark(id).execute() }
|
responseChecker.callWithResponseCheck { api -> api.deleteBookmark(id).execute() }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getVideos(
|
override fun getVideos(
|
||||||
refresh: Boolean,
|
refresh: Boolean
|
||||||
context: Context
|
|
||||||
): MusicDirectory {
|
): MusicDirectory {
|
||||||
val response = responseChecker.callWithResponseCheck { api -> api.getVideos().execute() }
|
val response = responseChecker.callWithResponseCheck { api -> api.getVideos().execute() }
|
||||||
|
|
||||||
|
@ -828,8 +795,7 @@ open class RESTMusicService(
|
||||||
override fun createShare(
|
override fun createShare(
|
||||||
ids: List<String>,
|
ids: List<String>,
|
||||||
description: String?,
|
description: String?,
|
||||||
expires: Long?,
|
expires: Long?
|
||||||
context: Context
|
|
||||||
): List<Share> {
|
): List<Share> {
|
||||||
val response = responseChecker.callWithResponseCheck { api ->
|
val response = responseChecker.callWithResponseCheck { api ->
|
||||||
api.createShare(ids, description, expires).execute()
|
api.createShare(ids, description, expires).execute()
|
||||||
|
@ -840,8 +806,7 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun deleteShare(
|
override fun deleteShare(
|
||||||
id: String,
|
id: String
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
responseChecker.callWithResponseCheck { api -> api.deleteShare(id).execute() }
|
responseChecker.callWithResponseCheck { api -> api.deleteShare(id).execute() }
|
||||||
}
|
}
|
||||||
|
@ -850,8 +815,7 @@ open class RESTMusicService(
|
||||||
override fun updateShare(
|
override fun updateShare(
|
||||||
id: String,
|
id: String,
|
||||||
description: String?,
|
description: String?,
|
||||||
expires: Long?,
|
expires: Long?
|
||||||
context: Context
|
|
||||||
) {
|
) {
|
||||||
var expiresValue: Long? = expires
|
var expiresValue: Long? = expires
|
||||||
if (expires != null && expires == 0L) {
|
if (expires != null && expires == 0L) {
|
||||||
|
@ -865,7 +829,6 @@ open class RESTMusicService(
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
override fun getAvatar(
|
override fun getAvatar(
|
||||||
context: Context,
|
|
||||||
username: String?,
|
username: String?,
|
||||||
size: Int,
|
size: Int,
|
||||||
saveToFile: Boolean,
|
saveToFile: Boolean,
|
||||||
|
|
|
@ -215,7 +215,7 @@ class DownloadHandler(
|
||||||
musicService.getMusicDirectory(id, name, false)
|
musicService.getMusicDirectory(id, name, false)
|
||||||
} else if (isShare) {
|
} else if (isShare) {
|
||||||
root = MusicDirectory()
|
root = MusicDirectory()
|
||||||
val shares = musicService.getShares(true, activity)
|
val shares = musicService.getShares(true)
|
||||||
for (share in shares) {
|
for (share in shares) {
|
||||||
if (share.id == id) {
|
if (share.id == id) {
|
||||||
for (entry in share.getEntries()) {
|
for (entry in share.getEntries()) {
|
||||||
|
@ -225,7 +225,7 @@ class DownloadHandler(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
root = musicService.getPlaylist(id, name, activity)
|
root = musicService.getPlaylist(id, name)
|
||||||
}
|
}
|
||||||
getSongsRecursively(root, songs)
|
getSongsRecursively(root, songs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ class ShareHandler(val context: Context) {
|
||||||
timeInMillis = shareDetails.Expiration
|
timeInMillis = shareDetails.Expiration
|
||||||
}
|
}
|
||||||
val shares =
|
val shares =
|
||||||
musicService.createShare(ids, shareDetails.Description, timeInMillis, context)
|
musicService.createShare(ids, shareDetails.Description, timeInMillis)
|
||||||
return shares[0]
|
return shares[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue