From b160274859220589509a7c78a080f098acd60d7c Mon Sep 17 00:00:00 2001 From: antonio Date: Sun, 13 Aug 2023 23:17:24 +0200 Subject: [PATCH] feat: added options in settings to define codec and bitrate for downloaded tracks --- .../tempo/util/Preferences.kt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt index ae41fa9c..00782079 100644 --- a/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt +++ b/app/src/main/java/com/cappielloantonio/tempo/util/Preferences.kt @@ -35,6 +35,10 @@ object Preferences { private const val AUDIO_TRANSCODE_PRIORITY = "audio_transcode_priority" private const val DOWNLOAD_STORAGE = "download_storage" private const val DEFAULT_DOWNLOAD_VIEW_TYPE = "default_download_view_type" + private const val AUDIO_TRANSCODE_DOWNLOAD = "audio_transcode_download" + private const val AUDIO_TRANSCODE_DOWNLOAD_PRIORITY = "audio_transcode_download_priority" + private const val MAX_BITRATE_DOWNLOAD = "max_bitrate_download" + private const val AUDIO_TRANSCODE_FORMAT_DOWNLOAD = "audio_transcode_format_download" @JvmStatic fun getServer(): String? { @@ -289,4 +293,24 @@ object Preferences { viewType ).apply() } + + @JvmStatic + fun preferTranscodedDownload(): Boolean { + return App.getInstance().preferences.getBoolean(AUDIO_TRANSCODE_DOWNLOAD, false) + } + + @JvmStatic + fun isServerPrioritizedInTranscodedDownload(): Boolean { + return App.getInstance().preferences.getBoolean(AUDIO_TRANSCODE_DOWNLOAD_PRIORITY, false) + } + + @JvmStatic + fun getBitrateTranscodedDownload(): String { + return App.getInstance().preferences.getString(MAX_BITRATE_DOWNLOAD, "0")!! + } + + @JvmStatic + fun getAudioTranscodeFormatTranscodedDownload(): String { + return App.getInstance().preferences.getString(AUDIO_TRANSCODE_FORMAT_DOWNLOAD, "raw")!! + } } \ No newline at end of file