Make Id3 offline dependent on Id3
This commit is contained in:
parent
b11694d6a2
commit
b955d77152
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* ArtistRowAdapter.kt
|
* ArtistRowBinder.kt
|
||||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||||
*
|
*
|
||||||
* Distributed under terms of the GNU GPLv3 license.
|
* Distributed under terms of the GNU GPLv3 license.
|
||||||
*/
|
*/
|
||||||
|
@ -110,11 +110,7 @@ class ArtistRowBinder(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showArtistPicture(): Boolean {
|
private fun showArtistPicture(): Boolean {
|
||||||
val isOnline = !ActiveServerProvider.isOffline()
|
return ActiveServerProvider.isID3Enabled() && Settings.shouldShowArtistPicture
|
||||||
val shouldShowArtistPicture = Settings.shouldShowArtistPicture
|
|
||||||
|
|
||||||
val id3Enabled = (isOnline && Settings.shouldUseId3Tags) || Settings.useId3TagsOffline
|
|
||||||
return id3Enabled && shouldShowArtistPicture
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -249,6 +249,13 @@ class ActiveServerProvider(
|
||||||
return preferences.getBoolean(Constants.PREFERENCES_KEY_SCROBBLE, false)
|
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
|
* Queries if Server Scaling is enabled
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* TrackCollectionFragment.kt
|
* TrackCollectionFragment.kt
|
||||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||||
*
|
*
|
||||||
* Distributed under terms of the GNU GPLv3 license.
|
* 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.AlbumRowBinder
|
||||||
import org.moire.ultrasonic.adapters.HeaderViewBinder
|
import org.moire.ultrasonic.adapters.HeaderViewBinder
|
||||||
import org.moire.ultrasonic.adapters.TrackViewBinder
|
import org.moire.ultrasonic.adapters.TrackViewBinder
|
||||||
|
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||||
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
import org.moire.ultrasonic.data.ActiveServerProvider.Companion.isOffline
|
||||||
import org.moire.ultrasonic.domain.Identifiable
|
import org.moire.ultrasonic.domain.Identifiable
|
||||||
import org.moire.ultrasonic.domain.MusicDirectory
|
import org.moire.ultrasonic.domain.MusicDirectory
|
||||||
|
@ -604,7 +605,7 @@ open class TrackCollectionFragment : MultiListFragment<MusicDirectory.Child>() {
|
||||||
listModel.getRandom(albumListSize)
|
listModel.getRandom(albumListSize)
|
||||||
} else {
|
} else {
|
||||||
setTitle(name)
|
setTitle(name)
|
||||||
if (!isOffline() && Settings.shouldUseId3Tags || Settings.useId3TagsOffline) {
|
if (ActiveServerProvider.isID3Enabled()) {
|
||||||
if (isAlbum) {
|
if (isAlbum) {
|
||||||
listModel.getAlbum(refresh2, id!!, name)
|
listModel.getAlbum(refresh2, id!!, name)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,20 +1,8 @@
|
||||||
/*
|
/*
|
||||||
This file is part of Subsonic.
|
* ArtistListModel.kt
|
||||||
|
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||||
Subsonic is free software: you can redistribute it and/or modify
|
*
|
||||||
it under the terms of the GNU General Public License as published by
|
* Distributed under terms of the GNU GPLv3 license.
|
||||||
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
|
|
||||||
*/
|
*/
|
||||||
package org.moire.ultrasonic.model
|
package org.moire.ultrasonic.model
|
||||||
|
|
||||||
|
@ -24,9 +12,9 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import java.text.Collator
|
import java.text.Collator
|
||||||
|
import org.moire.ultrasonic.data.ActiveServerProvider
|
||||||
import org.moire.ultrasonic.domain.ArtistOrIndex
|
import org.moire.ultrasonic.domain.ArtistOrIndex
|
||||||
import org.moire.ultrasonic.service.MusicService
|
import org.moire.ultrasonic.service.MusicService
|
||||||
import org.moire.ultrasonic.util.Settings
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides ViewModel which contains the list of available Artists
|
* Provides ViewModel which contains the list of available Artists
|
||||||
|
@ -57,12 +45,10 @@ class ArtistListModel(application: Application) : GenericListModel(application)
|
||||||
|
|
||||||
val musicFolderId = activeServer.musicFolderId
|
val musicFolderId = activeServer.musicFolderId
|
||||||
|
|
||||||
val result: List<ArtistOrIndex>
|
val result = if (ActiveServerProvider.isID3Enabled()) {
|
||||||
|
musicService.getArtists(refresh)
|
||||||
if (!isOffline && useId3Tags || Settings.useId3TagsOffline) {
|
|
||||||
result = musicService.getArtists(refresh)
|
|
||||||
} else {
|
} else {
|
||||||
result = musicService.getIndexes(musicFolderId, refresh)
|
musicService.getIndexes(musicFolderId, refresh)
|
||||||
}
|
}
|
||||||
|
|
||||||
artists.postValue(result.toMutableList().sortedWith(comparator))
|
artists.postValue(result.toMutableList().sortedWith(comparator))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Settings.kt
|
* Settings.kt
|
||||||
* Copyright (C) 2009-2021 Ultrasonic developers
|
* Copyright (C) 2009-2022 Ultrasonic developers
|
||||||
*
|
*
|
||||||
* Distributed under terms of the GNU GPLv3 license.
|
* Distributed under terms of the GNU GPLv3 license.
|
||||||
*/
|
*/
|
||||||
|
@ -160,9 +160,12 @@ object Settings {
|
||||||
var showNowPlayingDetails
|
var showNowPlayingDetails
|
||||||
by BooleanSetting(Constants.PREFERENCES_KEY_SHOW_NOW_PLAYING_DETAILS, false)
|
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
|
@JvmStatic
|
||||||
var shouldUseId3Tags by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false)
|
var shouldUseId3Tags by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS, false)
|
||||||
|
|
||||||
|
// See comment above.
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
var useId3TagsOffline by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS_OFFLINE, false)
|
var useId3TagsOffline by BooleanSetting(Constants.PREFERENCES_KEY_ID3_TAGS_OFFLINE, false)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue