mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-14 18:50:51 +01:00
Merge branch 'develop' into dependabot/gradle/com.android.tools.build-gradle-4.2.0
This commit is contained in:
commit
dcd5cc8feb
@ -27,7 +27,6 @@ jobs:
|
||||
command: |
|
||||
./gradlew ciTest testDebugUnitTest
|
||||
./gradlew jacocoFullReport
|
||||
bash <(curl -s https://codecov.io/bash)
|
||||
- run:
|
||||
name: lint
|
||||
command: ./gradlew :ultrasonic:lintRelease
|
||||
|
@ -42,6 +42,7 @@ See [CONTRIBUTING](CONTRIBUTING.md).
|
||||
- [Subsonic](http://www.subsonic.org/pages/index.jsp)
|
||||
- [Airsonic](https://github.com/airsonic/airsonic)
|
||||
- [Supysonic](https://github.com/spl0k/supysonic)
|
||||
- [Ampache](https://ampache.org/)
|
||||
|
||||
Other *Subsonic API* implementations should work as well as long as they follow API
|
||||
[documentation](http://www.subsonic.org/pages/api.jsp).
|
||||
|
@ -25,7 +25,7 @@ ext.versions = [
|
||||
kotlinxCoroutines : "1.3.9",
|
||||
viewModelKtx : "2.2.0",
|
||||
|
||||
retrofit : "2.4.0",
|
||||
retrofit : "2.6.4",
|
||||
jackson : "2.9.5",
|
||||
okhttp : "3.12.13",
|
||||
semver : "1.0.0",
|
||||
|
@ -320,7 +320,7 @@ class EditServerFragment : Fragment(), OnBackPressedHandler {
|
||||
// Execute a ping to retrieve the API version.
|
||||
// This is accepted to fail if the authentication is incorrect yet.
|
||||
var pingResponse = subsonicApiClient.api.ping().execute()
|
||||
if (pingResponse?.body() != null) {
|
||||
if (pingResponse.body() != null) {
|
||||
val restApiVersion = pingResponse.body()!!.version.restApiVersion
|
||||
currentServerSetting!!.minimumApiVersion = restApiVersion
|
||||
Timber.i("Server minimum API version set to %s", restApiVersion)
|
||||
|
@ -93,7 +93,6 @@ class SelectAlbumFragment : Fragment() {
|
||||
private var cancellationToken: CancellationToken? = null
|
||||
private val activeServerProvider: ActiveServerProvider by inject()
|
||||
|
||||
private val serverSettingsModel: ServerSettingsModel by viewModel()
|
||||
private val model: SelectAlbumModel by viewModels()
|
||||
|
||||
private val random: Random = SecureRandom()
|
||||
@ -133,6 +132,7 @@ class SelectAlbumFragment : Fragment() {
|
||||
requireContext(), view as ViewGroup
|
||||
) { selectedFolderId ->
|
||||
if (!isOffline(context)) {
|
||||
val serverSettingsModel: ServerSettingsModel by viewModel()
|
||||
val currentSetting = activeServerProvider.getActiveServer()
|
||||
currentSetting.musicFolderId = selectedFolderId
|
||||
serverSettingsModel.updateItem(currentSetting)
|
||||
@ -230,31 +230,32 @@ class SelectAlbumFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun updateDisplay(refresh: Boolean) {
|
||||
val id = requireArguments().getString(Constants.INTENT_EXTRA_NAME_ID)
|
||||
val isAlbum = requireArguments().getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
|
||||
val name = requireArguments().getString(Constants.INTENT_EXTRA_NAME_NAME)
|
||||
val parentId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PARENT_ID)
|
||||
val playlistId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
|
||||
val podcastChannelId = requireArguments().getString(
|
||||
val args = requireArguments()
|
||||
val id = args.getString(Constants.INTENT_EXTRA_NAME_ID)
|
||||
val isAlbum = args.getBoolean(Constants.INTENT_EXTRA_NAME_IS_ALBUM, false)
|
||||
val name = args.getString(Constants.INTENT_EXTRA_NAME_NAME)
|
||||
val parentId = args.getString(Constants.INTENT_EXTRA_NAME_PARENT_ID)
|
||||
val playlistId = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_ID)
|
||||
val podcastChannelId = args.getString(
|
||||
Constants.INTENT_EXTRA_NAME_PODCAST_CHANNEL_ID
|
||||
)
|
||||
val playlistName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
|
||||
val shareId = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
|
||||
val shareName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
|
||||
val albumListType = requireArguments().getString(
|
||||
val playlistName = args.getString(Constants.INTENT_EXTRA_NAME_PLAYLIST_NAME)
|
||||
val shareId = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_ID)
|
||||
val shareName = args.getString(Constants.INTENT_EXTRA_NAME_SHARE_NAME)
|
||||
val albumListType = args.getString(
|
||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE
|
||||
)
|
||||
val genreName = requireArguments().getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
|
||||
val albumListTitle = requireArguments().getInt(
|
||||
val genreName = args.getString(Constants.INTENT_EXTRA_NAME_GENRE_NAME)
|
||||
val albumListTitle = args.getInt(
|
||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TITLE, 0
|
||||
)
|
||||
val getStarredTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
|
||||
val getVideos = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
|
||||
val getRandomTracks = requireArguments().getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
|
||||
val albumListSize = requireArguments().getInt(
|
||||
val getStarredTracks = args.getInt(Constants.INTENT_EXTRA_NAME_STARRED, 0)
|
||||
val getVideos = args.getInt(Constants.INTENT_EXTRA_NAME_VIDEOS, 0)
|
||||
val getRandomTracks = args.getInt(Constants.INTENT_EXTRA_NAME_RANDOM, 0)
|
||||
val albumListSize = args.getInt(
|
||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, 0
|
||||
)
|
||||
val albumListOffset = requireArguments().getInt(
|
||||
val albumListOffset = args.getInt(
|
||||
Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0
|
||||
)
|
||||
|
||||
|
@ -54,7 +54,7 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
parentId: String?
|
||||
) {
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
|
||||
var root = MusicDirectory()
|
||||
@ -99,7 +99,6 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Given a Music directory "songs" it recursively adds all children to "songs"
|
||||
private fun getSongsRecursively(
|
||||
@ -128,7 +127,6 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
suspend fun getArtist(refresh: Boolean, id: String?, name: String?) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
|
||||
var root = MusicDirectory()
|
||||
@ -157,12 +155,10 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(root)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getAlbum(refresh: Boolean, id: String?, name: String?, parentId: String?) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
|
||||
@ -200,22 +196,18 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getSongsForGenre(genre: String, count: Int, offset: Int) {
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory = service.getSongsByGenre(genre, count, offset, context)
|
||||
songsForGenre.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getStarred() {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory: MusicDirectory
|
||||
@ -230,23 +222,19 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getVideos(refresh: Boolean) {
|
||||
showHeader = false
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
currentDirectory.postValue(service.getVideos(refresh, context))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getRandom(size: Int) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory = service.getRandomSongs(size, context)
|
||||
|
||||
@ -254,35 +242,29 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getPlaylist(playlistId: String, playlistName: String?) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory = service.getPlaylist(playlistId, playlistName, context)
|
||||
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getPodcastEpisodes(podcastChannelId: String) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory = service.getPodcastEpisodes(podcastChannelId, context)
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getShare(shareId: String) {
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory = MusicDirectory()
|
||||
|
||||
@ -299,7 +281,6 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
currentDirectory.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun getAlbumList(albumListType: String, size: Int, offset: Int) {
|
||||
|
||||
@ -311,7 +292,6 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
)
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
if (!ActiveServerProvider.isOffline(context)) {
|
||||
val service = MusicServiceFactory.getMusicService(context)
|
||||
val musicDirectory: MusicDirectory
|
||||
val musicFolderId = if (showSelectFolderHeader) {
|
||||
@ -336,7 +316,6 @@ class SelectAlbumModel(application: Application) : AndroidViewModel(application)
|
||||
albumList.postValue(musicDirectory)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun sortableCollection(albumListType: String): Boolean {
|
||||
return albumListType != "newest" && albumListType != "random" &&
|
||||
|
@ -26,7 +26,7 @@ class ApiCallResponseChecker(
|
||||
if (activeServerProvider.getActiveServer().minimumApiVersion == null) {
|
||||
try {
|
||||
val response = subsonicAPIClient.api.ping().execute()
|
||||
if (response?.body() != null) {
|
||||
if (response.body() != null) {
|
||||
val restApiVersion = response.body()!!.version.restApiVersion
|
||||
Timber.i("Server minimum API version set to %s", restApiVersion)
|
||||
activeServerProvider.setMinimumApiVersion(restApiVersion)
|
||||
|
Loading…
x
Reference in New Issue
Block a user