mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-07-21 19:01:57 +03:00
Compare commits
7 Commits
b0e850d17e
...
4c2c7252c3
Author | SHA1 | Date | |
---|---|---|---|
|
4c2c7252c3 | ||
|
b5dd0fdca2 | ||
|
a7ee33c7c0 | ||
|
7b56017844 | ||
|
0fb345dd24 | ||
|
4faf2db11f | ||
|
c118bd70f9 |
@ -31,12 +31,6 @@ If you want to use the version downloaded from F-Droid or from GitLab with
|
||||
First, see if your issue haven’t been yet reported [here][issues], otherwise
|
||||
open [a new issue][newissue].
|
||||
|
||||
### Known (not our) bugs
|
||||
|
||||
If you are using *Madsonic 5.1.X* several sections of Ultrasonic will not
|
||||
work. This is caused by bad implementation of Subsonic API by Madsonic. For
|
||||
more info about this you can read [this bug][madbug].
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING](CONTRIBUTING.md).
|
||||
@ -62,7 +56,6 @@ Full text of the license is available in the [LICENSE](LICENSE) file and
|
||||
[wikiaa]: https://gitlab.com/ultrasonic/ultrasonic/-/wikis/Using-Ultrasonic-with-Android-Auto
|
||||
[issues]: https://gitlab.com/ultrasonic/ultrasonic/-/issues
|
||||
[newissue]: https://gitlab.com/ultrasonic/ultrasonic/-/issues/new
|
||||
[madbug]: https://gitlab.com/ultrasonic/ultrasonic/-/issues/129
|
||||
[subsonic]: http://www.subsonic.org/
|
||||
[subapi]: http://www.subsonic.org/pages/api.jsp
|
||||
[airsonic]: https://github.com/airsonic-advanced/airsonic-advanced
|
||||
|
@ -12,7 +12,7 @@ preferences = "1.2.0"
|
||||
media3 = "1.0.1"
|
||||
|
||||
androidSupport = "1.6.0"
|
||||
materialDesign = "1.9.0"
|
||||
materialDesign = "1.8.0"
|
||||
constraintLayout = "2.1.4"
|
||||
multidex = "2.0.1"
|
||||
room = "2.5.1"
|
||||
|
@ -115,7 +115,7 @@ class ArtistRowBinder(
|
||||
}
|
||||
|
||||
private fun showArtistPicture(): Boolean {
|
||||
return ActiveServerProvider.isID3Enabled() && Settings.shouldShowArtistPicture
|
||||
return ActiveServerProvider.shouldUseId3Tags() && Settings.shouldShowArtistPicture
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -270,8 +270,8 @@ class ActiveServerProvider(
|
||||
/**
|
||||
* Queries if ID3 tags should be used
|
||||
*/
|
||||
fun isID3Enabled(): Boolean {
|
||||
return Settings.shouldUseId3Tags && (!isOffline() || Settings.useId3TagsOffline)
|
||||
fun shouldUseId3Tags(): Boolean {
|
||||
return Settings.id3TagsEnabledOnline && (!isOffline() || Settings.id3TagsEnabledOffline)
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,8 +138,8 @@ class AlbumListFragment(
|
||||
)
|
||||
|
||||
private fun getListOfSortOrders(): List<SortOrder> {
|
||||
val useId3 = Settings.shouldUseId3Tags
|
||||
val useId3Offline = Settings.useId3TagsOffline
|
||||
val useId3 = Settings.id3TagsEnabledOnline
|
||||
val useId3Offline = Settings.id3TagsEnabledOffline
|
||||
val isOnline = !ActiveServerProvider.isOffline()
|
||||
|
||||
val supported = mutableListOf<SortOrder>()
|
||||
|
@ -16,6 +16,7 @@ import androidx.navigation.fragment.findNavController
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import org.moire.ultrasonic.R
|
||||
import org.moire.ultrasonic.adapters.FolderSelectorBinder
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.domain.Artist
|
||||
import org.moire.ultrasonic.domain.GenericEntry
|
||||
import org.moire.ultrasonic.domain.Identifiable
|
||||
@ -23,7 +24,6 @@ import org.moire.ultrasonic.service.RxBus
|
||||
import org.moire.ultrasonic.service.plusAssign
|
||||
import org.moire.ultrasonic.subsonic.DownloadAction
|
||||
import org.moire.ultrasonic.subsonic.DownloadHandler
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
|
||||
/**
|
||||
* An extension of the MultiListFragment, with a few helper functions geared
|
||||
@ -39,7 +39,7 @@ abstract class EntryListFragment<T : GenericEntry> : MultiListFragment<T>() {
|
||||
*/
|
||||
private fun showFolderHeader(): Boolean {
|
||||
return listModel.showSelectFolderHeader() && !listModel.isOffline() &&
|
||||
!Settings.shouldUseId3Tags
|
||||
!ActiveServerProvider.shouldUseId3Tags()
|
||||
}
|
||||
|
||||
override fun onContextMenuItemSelected(menuItem: MenuItem, item: T): Boolean {
|
||||
|
@ -111,7 +111,7 @@ class NowPlayingFragment : Fragment() {
|
||||
nowPlayingArtist!!.text = artist
|
||||
|
||||
nowPlayingAlbumArtImage!!.setOnClickListener {
|
||||
val id3 = Settings.shouldUseId3Tags
|
||||
val id3 = Settings.id3TagsEnabledOnline
|
||||
val action = NavigationGraphDirections.toTrackCollection(
|
||||
isAlbum = id3,
|
||||
id = if (id3) file.albumId else file.parent,
|
||||
|
@ -34,6 +34,7 @@ import android.widget.SeekBar.OnSeekBarChangeListener
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import android.widget.ViewFlipper
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.core.view.MenuHost
|
||||
import androidx.core.view.MenuProvider
|
||||
@ -53,6 +54,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.LinearSmoothScroller
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
import io.reactivex.rxjava3.disposables.CompositeDisposable
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
@ -78,7 +80,9 @@ import org.moire.ultrasonic.adapters.TrackViewBinder
|
||||
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
|
||||
import org.moire.ultrasonic.audiofx.EqualizerController
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.shouldUseId3Tags
|
||||
import org.moire.ultrasonic.data.RatingUpdate
|
||||
import org.moire.ultrasonic.databinding.CurrentPlayingBinding
|
||||
import org.moire.ultrasonic.domain.Identifiable
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.domain.Track
|
||||
@ -142,6 +146,7 @@ class PlayerFragment :
|
||||
private lateinit var fiveStar5ImageView: ImageView
|
||||
private lateinit var playlistFlipper: ViewFlipper
|
||||
private lateinit var emptyTextView: TextView
|
||||
private lateinit var emptyView: ConstraintLayout
|
||||
private lateinit var songTitleTextView: TextView
|
||||
private lateinit var artistTextView: TextView
|
||||
private lateinit var albumTextView: TextView
|
||||
@ -161,9 +166,15 @@ class PlayerFragment :
|
||||
private lateinit var shuffleButton: View
|
||||
private lateinit var repeatButton: MaterialButton
|
||||
private lateinit var progressBar: SeekBar
|
||||
private lateinit var progressIndicator: CircularProgressIndicator
|
||||
private val hollowStar = R.drawable.ic_star_hollow
|
||||
private val fullStar = R.drawable.ic_star_full
|
||||
|
||||
private var _binding: CurrentPlayingBinding? = null
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewAdapter: BaseAdapter<Identifiable> by lazy {
|
||||
BaseAdapter()
|
||||
}
|
||||
@ -177,13 +188,17 @@ class PlayerFragment :
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
return inflater.inflate(R.layout.current_playing, container, false)
|
||||
): View {
|
||||
_binding = CurrentPlayingBinding.inflate(layoutInflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
// TODO: Switch them all over to use the view binding
|
||||
private fun findViews(view: View) {
|
||||
playlistFlipper = view.findViewById(R.id.current_playing_playlist_flipper)
|
||||
emptyTextView = view.findViewById(R.id.playlist_empty)
|
||||
emptyTextView = view.findViewById(R.id.empty_list_text)
|
||||
emptyView = view.findViewById(R.id.emptyListView)
|
||||
progressIndicator = view.findViewById(R.id.progress_indicator)
|
||||
songTitleTextView = view.findViewById(R.id.current_playing_song)
|
||||
artistTextView = view.findViewById(R.id.current_playing_artist)
|
||||
albumTextView = view.findViewById(R.id.current_playing_album)
|
||||
@ -472,6 +487,7 @@ class PlayerFragment :
|
||||
rxBusSubscription.dispose()
|
||||
cancel("CoroutineScope cancelled because the view was destroyed")
|
||||
cancellationToken.cancel()
|
||||
_binding = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
@ -591,10 +607,10 @@ class PlayerFragment :
|
||||
}
|
||||
}
|
||||
|
||||
if (isOffline() || !Settings.shouldUseId3Tags) {
|
||||
popup.menu.findItem(R.id.menu_show_artist)?.isVisible = false
|
||||
}
|
||||
// Only show the menu if the ID3 tags are available
|
||||
popup.menu.findItem(R.id.menu_show_artist)?.isVisible = shouldUseId3Tags()
|
||||
|
||||
// Only show the lyrics when the user is online
|
||||
popup.menu.findItem(R.id.menu_lyrics)?.isVisible = !isOffline()
|
||||
popup.show()
|
||||
return popup
|
||||
@ -614,7 +630,7 @@ class PlayerFragment :
|
||||
R.id.menu_show_artist -> {
|
||||
if (track == null) return false
|
||||
|
||||
if (Settings.shouldUseId3Tags) {
|
||||
if (Settings.id3TagsEnabledOnline) {
|
||||
val action = PlayerFragmentDirections.playerToAlbumsList(
|
||||
type = AlbumListType.SORTED_BY_NAME,
|
||||
byArtist = true,
|
||||
@ -630,7 +646,7 @@ class PlayerFragment :
|
||||
R.id.menu_show_album -> {
|
||||
if (track == null) return false
|
||||
|
||||
val albumId = if (Settings.shouldUseId3Tags) track.albumId else track.parent
|
||||
val albumId = if (shouldUseId3Tags()) track.albumId else track.parent
|
||||
|
||||
val action = PlayerFragmentDirections.playerToSelectAlbum(
|
||||
id = albumId,
|
||||
@ -1026,10 +1042,9 @@ class PlayerFragment :
|
||||
// Try to display playlist in play order
|
||||
val list = mediaPlayerController.playlistInPlayOrder
|
||||
emptyTextView.setText(R.string.playlist_empty)
|
||||
|
||||
viewAdapter.submitList(list.map(MediaItem::toTrack))
|
||||
|
||||
emptyTextView.isVisible = list.isEmpty()
|
||||
progressIndicator.isVisible = false
|
||||
emptyView.isVisible = list.isEmpty()
|
||||
|
||||
updateRepeatButtonState(mediaPlayerController.repeatMode)
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ import org.moire.ultrasonic.util.ErrorDialog
|
||||
import org.moire.ultrasonic.util.FileUtil.ultrasonicDirectory
|
||||
import org.moire.ultrasonic.util.InfoDialog
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
import org.moire.ultrasonic.util.Settings.id3TagsEnabledOnline
|
||||
import org.moire.ultrasonic.util.Settings.preferences
|
||||
import org.moire.ultrasonic.util.Settings.shouldUseId3Tags
|
||||
import org.moire.ultrasonic.util.Storage
|
||||
import org.moire.ultrasonic.util.TimeSpanPreference
|
||||
import org.moire.ultrasonic.util.TimeSpanPreferenceDialogFragmentCompat
|
||||
@ -354,8 +354,8 @@ class SettingsFragment :
|
||||
debugLogToFile?.summary = ""
|
||||
}
|
||||
|
||||
showArtistPicture?.isEnabled = shouldUseId3Tags
|
||||
useId3TagsOffline?.isEnabled = shouldUseId3Tags
|
||||
showArtistPicture?.isEnabled = id3TagsEnabledOnline
|
||||
useId3TagsOffline?.isEnabled = id3TagsEnabledOnline
|
||||
}
|
||||
|
||||
private fun setHideMedia(hide: Boolean) {
|
||||
|
@ -582,7 +582,7 @@ open class TrackCollectionFragment(
|
||||
} else {
|
||||
setTitle(name)
|
||||
|
||||
if (ActiveServerProvider.isID3Enabled()) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
if (isAlbum) {
|
||||
listModel.getAlbum(refresh2, id, name)
|
||||
} else {
|
||||
|
@ -12,9 +12,9 @@ import androidx.lifecycle.MutableLiveData
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.moire.ultrasonic.api.subsonic.models.AlbumListType
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.domain.Album
|
||||
import org.moire.ultrasonic.service.MusicServiceFactory
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
|
||||
class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||
|
||||
@ -69,7 +69,7 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||
// If appending the existing list, set the offset from where to load
|
||||
if (append) offset += (size + loadedUntil)
|
||||
|
||||
musicDirectory = if (Settings.shouldUseId3Tags) {
|
||||
musicDirectory = if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
service.getAlbumList2(
|
||||
albumListType, size,
|
||||
offset, musicFolderId
|
||||
@ -119,7 +119,7 @@ class AlbumListModel(application: Application) : GenericListModel(application) {
|
||||
val isAlphabetical = (lastType == AlbumListType.SORTED_BY_NAME) ||
|
||||
(lastType == AlbumListType.SORTED_BY_ARTIST)
|
||||
|
||||
return !isOffline() && !Settings.shouldUseId3Tags && isAlphabetical
|
||||
return !isOffline() && !ActiveServerProvider.shouldUseId3Tags() && isAlphabetical
|
||||
}
|
||||
|
||||
private fun isCollectionSortable(albumListType: AlbumListType): Boolean {
|
||||
|
@ -43,7 +43,7 @@ class ArtistListModel(application: Application) : GenericListModel(application)
|
||||
|
||||
val musicFolderId = activeServer.musicFolderId
|
||||
|
||||
val result = if (ActiveServerProvider.isID3Enabled()) {
|
||||
val result = if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
musicService.getArtists(refresh)
|
||||
} else {
|
||||
musicService.getIndexes(musicFolderId, refresh)
|
||||
|
@ -26,7 +26,6 @@ import org.moire.ultrasonic.domain.MusicFolder
|
||||
import org.moire.ultrasonic.service.MusicService
|
||||
import org.moire.ultrasonic.service.MusicServiceFactory
|
||||
import org.moire.ultrasonic.util.CommunicationError
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
|
||||
/**
|
||||
* An abstract Model, which can be extended to retrieve a list of items from the API
|
||||
@ -89,7 +88,7 @@ open class GenericListModel(application: Application) :
|
||||
withContext(Dispatchers.IO) {
|
||||
val musicService = MusicServiceFactory.getMusicService()
|
||||
val isOffline = ActiveServerProvider.isOffline()
|
||||
val useId3Tags = Settings.shouldUseId3Tags
|
||||
val useId3Tags = ActiveServerProvider.shouldUseId3Tags()
|
||||
|
||||
try {
|
||||
load(isOffline, useId3Tags, musicService, refresh)
|
||||
|
@ -13,12 +13,12 @@ import androidx.lifecycle.viewModelScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.domain.Track
|
||||
import org.moire.ultrasonic.service.DownloadService
|
||||
import org.moire.ultrasonic.service.DownloadState
|
||||
import org.moire.ultrasonic.service.MusicServiceFactory
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
import org.moire.ultrasonic.util.Util
|
||||
|
||||
/*
|
||||
@ -72,7 +72,7 @@ class TrackCollectionModel(application: Application) : GenericListModel(applicat
|
||||
val service = MusicServiceFactory.getMusicService()
|
||||
val musicDirectory: MusicDirectory
|
||||
|
||||
musicDirectory = if (Settings.shouldUseId3Tags) {
|
||||
musicDirectory = if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
Util.getSongsFromSearchResult(service.getStarred2())
|
||||
} else {
|
||||
Util.getSongsFromSearchResult(service.getStarred())
|
||||
|
@ -51,7 +51,6 @@ import org.moire.ultrasonic.service.MediaPlayerController
|
||||
import org.moire.ultrasonic.service.MusicServiceFactory
|
||||
import org.moire.ultrasonic.service.RatingManager
|
||||
import org.moire.ultrasonic.util.MainThreadExecutor
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
import org.moire.ultrasonic.util.Util
|
||||
import org.moire.ultrasonic.util.buildMediaItem
|
||||
import org.moire.ultrasonic.util.toMediaItem
|
||||
@ -119,7 +118,6 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
|
||||
private val musicService get() = MusicServiceFactory.getMusicService()
|
||||
private val isOffline get() = ActiveServerProvider.isOffline()
|
||||
private val useId3Tags get() = Settings.shouldUseId3Tags
|
||||
private val musicFolderId get() = activeServerProvider.getActiveServer().musicFolderId
|
||||
|
||||
/**
|
||||
@ -661,7 +659,7 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
var childMediaId: String = MEDIA_ARTIST_ITEM
|
||||
|
||||
var artists = serviceScope.future {
|
||||
if (!isOffline && useId3Tags) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
// TODO this list can be big so we're not refreshing.
|
||||
// Maybe a refresh menu item can be added
|
||||
callWithErrorHandling { musicService.getArtists(false) }
|
||||
@ -716,7 +714,7 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
|
||||
return mainScope.future {
|
||||
val albums = serviceScope.future {
|
||||
if (!isOffline && useId3Tags) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
callWithErrorHandling { musicService.getAlbumsOfArtist(id, name, false) }
|
||||
} else {
|
||||
callWithErrorHandling {
|
||||
@ -788,7 +786,7 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
val offset = (page ?: 0) * DISPLAY_LIMIT
|
||||
|
||||
val albums = serviceScope.future {
|
||||
if (useId3Tags) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
callWithErrorHandling {
|
||||
musicService.getAlbumList2(
|
||||
type, DISPLAY_LIMIT, offset, null
|
||||
@ -1190,7 +1188,7 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
|
||||
private fun listSongsInMusicService(id: String, name: String?): MusicDirectory? {
|
||||
return serviceScope.future {
|
||||
if (!ActiveServerProvider.isOffline() && Settings.shouldUseId3Tags) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
callWithErrorHandling { musicService.getAlbumAsDir(id, name, false) }
|
||||
} else {
|
||||
callWithErrorHandling { musicService.getMusicDirectory(id, name, false) }
|
||||
@ -1200,7 +1198,7 @@ class AutoMediaBrowserCallback(var player: Player, val libraryService: MediaLibr
|
||||
|
||||
private fun listStarredSongsInMusicService(): SearchResult? {
|
||||
return serviceScope.future {
|
||||
if (Settings.shouldUseId3Tags) {
|
||||
if (ActiveServerProvider.shouldUseId3Tags()) {
|
||||
callWithErrorHandling { musicService.getStarred2() }
|
||||
} else {
|
||||
callWithErrorHandling { musicService.getStarred() }
|
||||
|
@ -18,7 +18,7 @@ import org.moire.ultrasonic.api.subsonic.models.JukeboxAction
|
||||
import org.moire.ultrasonic.api.subsonic.throwOnFailure
|
||||
import org.moire.ultrasonic.api.subsonic.toStreamResponse
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.shouldUseId3Tags
|
||||
import org.moire.ultrasonic.domain.Album
|
||||
import org.moire.ultrasonic.domain.Artist
|
||||
import org.moire.ultrasonic.domain.Bookmark
|
||||
@ -44,7 +44,6 @@ import org.moire.ultrasonic.domain.toIndexList
|
||||
import org.moire.ultrasonic.domain.toMusicDirectoryDomainEntity
|
||||
import org.moire.ultrasonic.domain.toTrackEntity
|
||||
import org.moire.ultrasonic.util.FileUtil
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
@ -181,7 +180,7 @@ open class RESTMusicService(
|
||||
criteria: SearchCriteria
|
||||
): SearchResult {
|
||||
return try {
|
||||
if (!isOffline() && Settings.shouldUseId3Tags) {
|
||||
if (shouldUseId3Tags()) {
|
||||
search3(criteria)
|
||||
} else {
|
||||
search2(criteria)
|
||||
|
@ -14,7 +14,7 @@ import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.moire.ultrasonic.R
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.shouldUseId3Tags
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
import org.moire.ultrasonic.domain.Track
|
||||
import org.moire.ultrasonic.service.DownloadService
|
||||
@ -181,11 +181,11 @@ class DownloadHandler(
|
||||
val musicService = getMusicService()
|
||||
val songs: MutableList<Track> = LinkedList()
|
||||
val root: MusicDirectory
|
||||
if (!isOffline() && isArtist && Settings.shouldUseId3Tags) {
|
||||
getSongsForArtist(id, songs)
|
||||
if (shouldUseId3Tags() && isArtist) {
|
||||
return getSongsForArtist(id)
|
||||
} else {
|
||||
if (isDirectory) {
|
||||
root = if (!isOffline() && Settings.shouldUseId3Tags)
|
||||
root = if (shouldUseId3Tags())
|
||||
musicService.getAlbumAsDir(id, name, false)
|
||||
else
|
||||
musicService.getMusicDirectory(id, name, false)
|
||||
@ -219,23 +219,19 @@ class DownloadHandler(
|
||||
}
|
||||
val musicService = getMusicService()
|
||||
for ((id1, _, _, title) in parent.getAlbums()) {
|
||||
val root: MusicDirectory = if (
|
||||
!isOffline() &&
|
||||
Settings.shouldUseId3Tags
|
||||
) musicService.getAlbumAsDir(id1, title, false)
|
||||
else musicService.getMusicDirectory(id1, title, false)
|
||||
val root: MusicDirectory = if (shouldUseId3Tags())
|
||||
musicService.getAlbumAsDir(id1, title, false)
|
||||
else
|
||||
musicService.getMusicDirectory(id1, title, false)
|
||||
getSongsRecursively(root, songs)
|
||||
}
|
||||
}
|
||||
|
||||
@Throws(Exception::class)
|
||||
private fun getSongsForArtist(
|
||||
id: String,
|
||||
songs: MutableCollection<Track>
|
||||
) {
|
||||
if (songs.size > maxSongs) {
|
||||
return
|
||||
}
|
||||
id: String
|
||||
): MutableList<Track> {
|
||||
val songs: MutableList<Track> = LinkedList()
|
||||
val musicService = getMusicService()
|
||||
val artist = musicService.getAlbumsOfArtist(id, "", false)
|
||||
for ((id1) in artist) {
|
||||
@ -250,6 +246,7 @@ class DownloadHandler(
|
||||
}
|
||||
}
|
||||
}
|
||||
return songs
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,11 +168,11 @@ object Settings {
|
||||
// Normally you don't need to use these Settings directly,
|
||||
// use ActiveServerProvider.isID3Enabled() instead
|
||||
@JvmStatic
|
||||
var shouldUseId3Tags by BooleanSetting(getKey(R.string.setting_key_id3_tags), true)
|
||||
var id3TagsEnabledOnline by BooleanSetting(getKey(R.string.setting_key_id3_tags), true)
|
||||
|
||||
// See comment above.
|
||||
@JvmStatic
|
||||
var useId3TagsOffline by BooleanSetting(getKey(R.string.setting_key_id3_tags_offline), true)
|
||||
var id3TagsEnabledOffline by BooleanSetting(getKey(R.string.setting_key_id3_tags_offline), true)
|
||||
|
||||
var activeServer by IntSetting(getKey(R.string.setting_key_server_instance), -1)
|
||||
|
||||
|
@ -119,7 +119,7 @@
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<include layout="@layout/current_playlist" />
|
||||
<include layout="@layout/current_playlist" a:id="@+id/playlist"/>
|
||||
</ViewFlipper>
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -112,7 +112,7 @@
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/current_playlist" />
|
||||
<include layout="@layout/current_playlist" a:id="@+id/playlist"/>
|
||||
</ViewFlipper>
|
||||
|
||||
<include layout="@layout/player_media_info" />
|
||||
|
@ -5,13 +5,17 @@
|
||||
a:layout_height="fill_parent"
|
||||
a:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
a:id="@+id/playlist_empty"
|
||||
a:layout_width="fill_parent"
|
||||
a:layout_height="wrap_content"
|
||||
a:padding="10dip"
|
||||
a:text="@string/playlist.empty" />
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
a:id="@+id/progress_indicator"
|
||||
a:layout_width="wrap_content"
|
||||
a:layout_height="0dip"
|
||||
a:indeterminate="true"
|
||||
a:layout_weight="1"
|
||||
a:layout_gravity="center|center_horizontal|center_vertical" />
|
||||
|
||||
<include
|
||||
a:id="@+id/emptyListView"
|
||||
layout="@layout/list_parts_empty_view" />
|
||||
|
||||
<com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView
|
||||
a:id="@+id/playlist_view"
|
||||
|
Loading…
x
Reference in New Issue
Block a user