feat(downloader): Restrict parallel downloads to unmetered sources (#1137)

Co-authored-by: jmir1 <jhmiramon@gmail.com>
This commit is contained in:
Secozzi 2023-09-29 13:38:31 +00:00 committed by GitHub
parent 6554900024
commit 861a5ad913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -69,8 +69,9 @@ object SettingsDownloadScreen : SearchableSettings {
Preference.PreferenceItem.ListPreference(
pref = downloadPreferences.numberOfDownloads(),
title = stringResource(R.string.pref_download_slots),
entries = listOf(1, 2, 3).associateWith { it.toString() },
entries = (1..5).associateWith { it.toString() },
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.download_slots_info)),
getDeleteChaptersGroup(
downloadPreferences = downloadPreferences,
categories = allCategories,

View file

@ -216,10 +216,14 @@ class AnimeDownloader(
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
},
downloadPreferences.numberOfDownloads().get(),
if (sourceManager.get(bySource.key.id) is UnmeteredSource) {
downloadPreferences.numberOfDownloads().get()
} else {
1
},
)
},
3,
5,
)
.subscribe(
{ completedDownload ->

View file

@ -339,4 +339,5 @@
<string name="resmush">resmush.it</string>
<string name="bandwidth_data_saver_server">Bandwidth Hero Proxy Server</string>
<string name="data_saver_server_summary">Put Bandwidth Hero Proxy server url here</string>
<string name="download_slots_info">Will only download concurrently from self-hosted or unmetered sources</string>
</resources>