feat: added setting to request estimated duration of transcoded file

This commit is contained in:
antonio 2023-09-17 19:12:45 +02:00
parent 0fe4636fe1
commit e762c91ff3
4 changed files with 20 additions and 2 deletions

View file

@ -50,12 +50,11 @@ public class MusicUtil {
uri.append("&maxBitRate=").append(getBitratePreference());
if (!Preferences.isServerPrioritized())
uri.append("&format=").append(getTranscodingFormatPreference());
if (false)
if (Preferences.askForEstimateContentLength())
uri.append("&estimateContentLength=true");
uri.append("&id=").append(id);
Log.d(TAG, "getStreamUri: " + uri);
return Uri.parse(uri.toString());

View file

@ -40,6 +40,7 @@ object Preferences {
private const val MAX_BITRATE_DOWNLOAD = "max_bitrate_download"
private const val AUDIO_TRANSCODE_FORMAT_DOWNLOAD = "audio_transcode_format_download"
private const val SHARE = "share"
private const val ESTIMATE_CONTENT_LENGTH = "estimate_content_length"
@JvmStatic
fun getServer(): String? {
@ -319,4 +320,9 @@ object Preferences {
fun isSharingEnabled(): Boolean {
return App.getInstance().preferences.getBoolean(SHARE, false)
}
@JvmStatic
fun askForEstimateContentLength(): Boolean {
return App.getInstance().preferences.getBoolean(ESTIMATE_CONTENT_LENGTH, false)
}
}

View file

@ -190,6 +190,8 @@
<string name="settings_audio_transcode_download_summary">If enabled, Tempo will download transcoded tracks.</string>
<string name="settings_audio_transcode_download_title">Download transcoded tracks</string>
<string name="settings_audio_transcode_download_format">Transcode format</string>
<string name="settings_audio_transcode_estimate_content_length_summary">If enabled, the server will be asked for the estimated duration of the track.</string>
<string name="settings_audio_transcode_estimate_content_length_title">Estimate content length</string>
<string name="settings_audio_transcode_priority_summary">If enabled, Tempo will not force stream the track with the transcode settings below.</string>
<string name="settings_audio_transcode_priority_title">Prioritize server transcode settings</string>
<string name="settings_audio_transcode_priority_toast">Priority on transcoding of track given to server</string>
@ -234,6 +236,7 @@
<string name="settings_summary_share">Allows the user to share music via a link. The functionality must be supported and enabled server-side and is limited to individual tracks, albums and playlists.</string>
<string name="settings_summary_syncing">Returns the state of the play queue for this user. This includes the tracks in the play queue, the currently playing track, and the position within this track. The server must support this feature.</string>
<string name="settings_summary_transcoding">Priority given to the transcoding mode. If set to \"Direct play\" the bitrate of the file will not be changed.</string>
<string name="settings_summary_transcoding_estimate_content_length">When the file is transcoded on the fly, the client usually does not show the track length. It is possible to request the servers that support the functionality to estimate the duration of the track being played, but the response times may take longer.</string>
<string name="settings_summary_transcoding_download">Download transcoded media. If enabled, the download endpoint will not be used, but the following settings. \n\n If \"Transcode format\" is set to \"Direct play\" the bitrate of the file will not be changed.</string>
<string name="settings_sync_starred_tracks_for_offline_use_summary">If enabled, starred tracks will be downloaded for offline use.</string>
<string name="settings_sync_starred_tracks_for_offline_use_title">Sync starred tracks for offline use</string>

View file

@ -158,6 +158,16 @@
app:key="max_bitrate_mobile"
app:title="@string/settings_max_bitrate_mobile"
app:useSimpleSummaryProvider="true" />
<SwitchPreference
android:title="@string/settings_audio_transcode_estimate_content_length_title"
android:defaultValue="false"
android:summary="@string/settings_audio_transcode_estimate_content_length_summary"
android:key="estimate_content_length" />
<Preference
app:selectable="false"
app:summary="@string/settings_summary_transcoding_estimate_content_length" />
</PreferenceCategory>
<PreferenceCategory app:title="@string/settings_title_transcoding_download">