mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-04-17 01:32:23 +03:00
Make Id3 offline dependent on Id3
This commit is contained in:
parent
b11694d6a2
commit
b955d77152
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ArtistRowAdapter.kt
|
||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
||||
* ArtistRowBinder.kt
|
||||
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||
*
|
||||
* Distributed under terms of the GNU GPLv3 license.
|
||||
*/
|
||||
@ -110,11 +110,7 @@ class ArtistRowBinder(
|
||||
}
|
||||
|
||||
private fun showArtistPicture(): Boolean {
|
||||
val isOnline = !ActiveServerProvider.isOffline()
|
||||
val shouldShowArtistPicture = Settings.shouldShowArtistPicture
|
||||
|
||||
val id3Enabled = (isOnline && Settings.shouldUseId3Tags) || Settings.useId3TagsOffline
|
||||
return id3Enabled && shouldShowArtistPicture
|
||||
return ActiveServerProvider.isID3Enabled() && Settings.shouldShowArtistPicture
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,6 +249,13 @@ class ActiveServerProvider(
|
||||
return preferences.getBoolean(Constants.PREFERENCES_KEY_SCROBBLE, false)
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries if ID3 tags should be used
|
||||
*/
|
||||
fun isID3Enabled(): Boolean {
|
||||
return Settings.shouldUseId3Tags && (!isOffline() || Settings.useId3TagsOffline)
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries if Server Scaling is enabled
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* TrackCollectionFragment.kt
|
||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
||||
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||
*
|
||||
* Distributed under terms of the GNU GPLv3 license.
|
||||
*/
|
||||
@ -31,6 +31,7 @@ import org.moire.ultrasonic.adapters.AlbumHeader
|
||||
import org.moire.ultrasonic.adapters.AlbumRowBinder
|
||||
import org.moire.ultrasonic.adapters.HeaderViewBinder
|
||||
import org.moire.ultrasonic.adapters.TrackViewBinder
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||
import org.moire.ultrasonic.domain.Identifiable
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
@ -604,7 +605,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||
listModel.getRandom(albumListSize)
|
||||
} else {
|
||||
setTitle(name)
|
||||
if (!isOffline() && Settings.shouldUseId3Tags || Settings.useId3TagsOffline) {
|
||||
if (ActiveServerProvider.isID3Enabled()) {
|
||||
if (isAlbum) {
|
||||
listModel.getAlbum(refresh2, id!!, name)
|
||||
} else {
|
||||
|
@ -1,20 +1,8 @@
|
||||
/*
|
||||
This file is part of Subsonic.
|
||||
|
||||
Subsonic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Subsonic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Copyright 2020 (C) Jozsef Varga
|
||||
* ArtistListModel.kt
|
||||
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||
*
|
||||
* Distributed under terms of the GNU GPLv3 license.
|
||||
*/
|
||||
package org.moire.ultrasonic.model
|
||||
|
||||
@ -24,9 +12,9 @@ import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import java.text.Collator
|
||||
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||
import org.moire.ultrasonic.domain.ArtistOrIndex
|
||||
import org.moire.ultrasonic.service.MusicService
|
||||
import org.moire.ultrasonic.util.Settings
|
||||
|
||||
/**
|
||||
* Provides ViewModel which contains the list of available Artists
|
||||
@ -57,12 +45,10 @@ class ArtistListModel(application: Application) : GenericListModel(application)
|
||||
|
||||
val musicFolderId = activeServer.musicFolderId
|
||||
|
||||
val result: List<ArtistOrIndex>
|
||||
|
||||
if (!isOffline && useId3Tags || Settings.useId3TagsOffline) {
|
||||
result = musicService.getArtists(refresh)
|
||||
val result = if (ActiveServerProvider.isID3Enabled()) {
|
||||
musicService.getArtists(refresh)
|
||||
} else {
|
||||
result = musicService.getIndexes(musicFolderId, refresh)
|
||||
musicService.getIndexes(musicFolderId, refresh)
|
||||
}
|
||||
|
||||
artists.postValue(result.toMutableList().sortedWith(comparator))
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Settings.kt
|
||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
||||
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||
*
|
||||
* Distributed under terms of the GNU GPLv3 license.
|
||||
*/
|
||||
@ -160,9 +160,12 @@ object Settings {
|
||||
var showNowPlayingDetails
|
||||
by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING_DETAILS, false)
|
||||
|
||||
// Normally you don't need to use these Settings directly,
|
||||
// use ActiveServerProvider.isID3Enabled() instead
|
||||
@JvmStatic
|
||||
var shouldUseId3Tags by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false)
|
||||
|
||||
// See comment above.
|
||||
@JvmStatic
|
||||
var useId3TagsOffline by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS_OFFLINE, false)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user