Skip to content

Commit 57e66b1

Browse files
committed
Merge branch 'master' into dev
2 parents 1408150 + d298a12 commit 57e66b1

39 files changed

Lines changed: 401 additions & 82 deletions

File tree

app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ android {
2323
if (System.properties.containsKey('versionCodeOverride')) {
2424
versionCode System.getProperty('versionCodeOverride') as Integer
2525
} else {
26-
versionCode 999
26+
versionCode 1000
2727
}
28-
versionName "0.27.2"
28+
versionName "0.27.3"
2929
if (System.properties.containsKey('versionNameSuffix')) {
3030
versionNameSuffix System.getProperty('versionNameSuffix')
3131
}
@@ -206,8 +206,9 @@ dependencies {
206206
// name and the commit hash with the commit hash of the (pushed) commit you want to test
207207
// This works thanks to JitPack: https://jitpack.io/
208208
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
209-
// WORKAROUND: v0.24.2 can't be resolved by jitpack -> use git commit hash instead
210-
implementation 'com.github.TeamNewPipe:NewPipeExtractor:ea1a1d1375efd5936ed2609d0fa3e31d5097a835'
209+
// WORKAROUND: if you get errors with the NewPipeExtractor dependency, replace `v0.24.3` with
210+
// the corresponding commit hash, since JitPack is sometimes buggy
211+
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.24.3'
211212
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'
212213

213214
/** Checkstyle **/

app/src/main/java/org/schabi/newpipe/local/feed/service/FeedLoadManager.kt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import org.schabi.newpipe.database.subscription.NotificationMode
1717
import org.schabi.newpipe.database.subscription.SubscriptionEntity
1818
import org.schabi.newpipe.extractor.Info
1919
import org.schabi.newpipe.extractor.NewPipe
20+
import org.schabi.newpipe.extractor.ServiceList
2021
import org.schabi.newpipe.extractor.feed.FeedInfo
2122
import org.schabi.newpipe.extractor.stream.StreamInfoItem
2223
import org.schabi.newpipe.ktx.getStringSafe
@@ -90,6 +91,10 @@ class FeedLoadManager(private val context: Context) {
9091
else -> feedDatabaseManager.outdatedSubscriptionsForGroup(groupId, outdatedThreshold)
9192
}
9293

94+
// like `currentProgress`, but counts the number of YouTube extractions that have begun, so
95+
// they can be properly throttled every once in a while (see doOnNext below)
96+
val youtubeExtractionCount = AtomicInteger()
97+
9398
return outdatedSubscriptions
9499
.take(1)
95100
.doOnNext {
@@ -105,6 +110,15 @@ class FeedLoadManager(private val context: Context) {
105110
.observeOn(Schedulers.io())
106111
.flatMap { Flowable.fromIterable(it) }
107112
.takeWhile { !cancelSignal.get() }
113+
.doOnNext { subscriptionEntity ->
114+
// throttle YouTube extractions once every BATCH_SIZE to avoid being rate limited
115+
if (subscriptionEntity.serviceId == ServiceList.YouTube.serviceId) {
116+
val previousCount = youtubeExtractionCount.getAndIncrement()
117+
if (previousCount != 0 && previousCount % BATCH_SIZE == 0) {
118+
Thread.sleep(DELAY_BETWEEN_BATCHES_MILLIS.random())
119+
}
120+
}
121+
}
108122
.parallel(PARALLEL_EXTRACTIONS, PARALLEL_EXTRACTIONS * 2)
109123
.runOn(Schedulers.io(), PARALLEL_EXTRACTIONS * 2)
110124
.filter { !cancelSignal.get() }
@@ -328,7 +342,19 @@ class FeedLoadManager(private val context: Context) {
328342
/**
329343
* How many extractions will be running in parallel.
330344
*/
331-
private const val PARALLEL_EXTRACTIONS = 6
345+
private const val PARALLEL_EXTRACTIONS = 3
346+
347+
/**
348+
* How many YouTube extractions to perform before waiting [DELAY_BETWEEN_BATCHES_MILLIS]
349+
* to avoid being rate limited
350+
*/
351+
private const val BATCH_SIZE = 50
352+
353+
/**
354+
* Wait a random delay in this range once every [BATCH_SIZE] YouTube extractions to avoid
355+
* being rate limited
356+
*/
357+
private val DELAY_BETWEEN_BATCHES_MILLIS = (6000L..12000L)
332358

333359
/**
334360
* Number of items to buffer to mass-insert in the database.

app/src/main/java/org/schabi/newpipe/util/ListHelper.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ public final class ListHelper {
4848
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
4949
// Audio track types in order of priority. 0=lowest, n=highest
5050
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING =
51-
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.DUBBED, AudioTrackType.ORIGINAL);
51+
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.SECONDARY, AudioTrackType.DUBBED,
52+
AudioTrackType.ORIGINAL);
5253
// Audio track types in order of priority when descriptive audio is preferred.
5354
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING_DESCRIPTIVE =
54-
List.of(AudioTrackType.ORIGINAL, AudioTrackType.DUBBED, AudioTrackType.DESCRIPTIVE);
55+
List.of(AudioTrackType.SECONDARY, AudioTrackType.DUBBED, AudioTrackType.ORIGINAL,
56+
AudioTrackType.DESCRIPTIVE);
5557

5658
/**
5759
* List of supported YouTube Itag ids.

app/src/main/java/org/schabi/newpipe/util/Localization.java

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,25 +327,20 @@ public static String audioTrackName(@NonNull final Context context, final AudioS
327327

328328
if (track.getAudioTrackType() != null) {
329329
final String trackType = audioTrackType(context, track.getAudioTrackType());
330-
if (trackType != null) {
331-
return context.getString(R.string.audio_track_name, name, trackType);
332-
}
330+
return context.getString(R.string.audio_track_name, name, trackType);
333331
}
334332
return name;
335333
}
336334

337-
@Nullable
335+
@NonNull
338336
private static String audioTrackType(@NonNull final Context context,
339-
final AudioTrackType trackType) {
340-
switch (trackType) {
341-
case ORIGINAL:
342-
return context.getString(R.string.audio_track_type_original);
343-
case DUBBED:
344-
return context.getString(R.string.audio_track_type_dubbed);
345-
case DESCRIPTIVE:
346-
return context.getString(R.string.audio_track_type_descriptive);
347-
}
348-
return null;
337+
@NonNull final AudioTrackType trackType) {
338+
return switch (trackType) {
339+
case ORIGINAL -> context.getString(R.string.audio_track_type_original);
340+
case DUBBED -> context.getString(R.string.audio_track_type_dubbed);
341+
case DESCRIPTIVE -> context.getString(R.string.audio_track_type_descriptive);
342+
case SECONDARY -> context.getString(R.string.audio_track_type_secondary);
343+
};
349344
}
350345

351346
/*//////////////////////////////////////////////////////////////////////////

app/src/main/res/values-de/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
<string name="drawer_close">Navigationsleiste schließen</string>
205205
<string name="video_player">Video-Player</string>
206206
<string name="background_player">Wiedergabe im Hintergrund</string>
207-
<string name="popup_player">Popup-Player</string>
207+
<string name="popup_player">Pop-up-Player</string>
208208
<string name="preferred_player_fetcher_notification_title">Erhalte Informationen …</string>
209209
<string name="preferred_player_fetcher_notification_message">Gewünschten Inhalt laden</string>
210210
<string name="import_data_title">Datenbank importieren</string>

app/src/main/res/values-es/strings.xml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@
328328
<string name="minimize_on_exit_popup_description">Minimizar al reproductor emergente</string>
329329
<string name="skip_silence_checkbox">Avance rápido durante el silencio</string>
330330
<string name="playback_step">Paso</string>
331-
<string name="playback_reset">Reiniciar</string>
331+
<string name="playback_reset">Restablecer</string>
332332
<string name="channels">Canales</string>
333333
<string name="users">Usuarios</string>
334334
<string name="playlists">Listas de reproducción</string>
@@ -392,7 +392,7 @@
392392
<string name="app_update_notification_channel_name">Notificación de actualización de la aplicación</string>
393393
<string name="app_update_notification_channel_description">Notificaciones de nuevas versiones de NewPipe</string>
394394
<string name="download_to_sdcard_error_title">Almacenamiento externo no disponible</string>
395-
<string name="download_to_sdcard_error_message">No es posible descargar a una tarjeta SD externa. \¿Restablecer la ubicación de la carpeta de descarga\?</string>
395+
<string name="download_to_sdcard_error_message">No es posible descargar a una tarjeta SD externa. ¿Restablecer la ubicación de la carpeta de descarga?</string>
396396
<string name="saved_tabs_invalid_json">No se pudo leer las pestañas guardadas, se usarán las pestañas predefinidas</string>
397397
<string name="restore_defaults">Restaurar valores predefinidos</string>
398398
<string name="restore_defaults_confirmation">¿Quieres restaurar los valores predefinidos\?</string>
@@ -492,7 +492,7 @@
492492
<item quantity="other">%d seleccionados</item>
493493
</plurals>
494494
<string name="feed_group_dialog_empty_name">Nombre de grupo vacío</string>
495-
<string name="feed_group_dialog_delete_message">¿Borrar este grupo\?</string>
495+
<string name="feed_group_dialog_delete_message">¿Quieres borrar este grupo?</string>
496496
<string name="feed_create_new_group_button_title">Nuevo</string>
497497
<string name="settings_category_feed_title">Fuente</string>
498498
<string name="feed_update_threshold_title">Velocidad de actualización del contenido</string>
@@ -627,9 +627,7 @@
627627
<string name="feed_load_error_account_info">No fue posible cargar el muro por \'%s\'.</string>
628628
<string name="account_terminated">Cuenta cancelada</string>
629629
<string name="feed_load_error_fast_unknown">El modo de muro rápido no arroja más información sobre esto.</string>
630-
<string name="feed_load_error_terminated">La cuenta del autor ha sido cancelada.
631-
\nNewPipe no podrá acceder a ella en el futuro.
632-
\n¿Desea desuscribirse de este canal\?</string>
630+
<string name="feed_load_error_terminated">La cuenta del autor ha sido cancelada.\nNewPipe no podrá acceder a ella en el futuro.\n¿Quieres desuscribirte de este canal?</string>
633631
<string name="feed_load_error">Error al cargar el muro</string>
634632
<string name="downloads_storage_use_saf_summary_api_29">Desde Android 10 solo el \'Sistema de Acceso al Almacenamiento\' es soportado</string>
635633
<string name="downloads_storage_ask_summary_no_saf_notice">Se le preguntará dónde guardar cada descarga</string>
@@ -737,7 +735,7 @@
737735
<string name="ignore_hardware_media_buttons_summary">Útil, por ejemplo, si está utilizando un auricular con botones físicos rotos</string>
738736
<string name="ignore_hardware_media_buttons_title">Ignorar eventos para botones multimedia de hardware</string>
739737
<string name="remove_duplicates_title">¿Eliminar los duplicados\?</string>
740-
<string name="remove_duplicates_message">¿Desea eliminar todas las secuencias duplicadas de esta lista de reproducción\?</string>
738+
<string name="remove_duplicates_message">¿Quieres eliminar todas las secuencias duplicadas de esta lista de reproducción?</string>
741739
<string name="feed_hide_streams_title">Mostrar las siguientes secuencias</string>
742740
<string name="feed_show_hide_streams">Mostrar/Ocultar secuencias</string>
743741
<string name="feed_show_upcoming">Próximamente</string>
@@ -767,7 +765,7 @@
767765
<string name="audio_track_type_dubbed">doblado</string>
768766
<string name="audio_track_type_descriptive">descriptivo</string>
769767
<string name="progressive_load_interval_summary">Cambia el tamaño del intervalo de carga en contenidos progresivos (actualmente %s). Un valor más bajo puede acelerar la carga inicial</string>
770-
<string name="settings_category_exoplayer_title">Ajustes para ExoPlayer</string>
768+
<string name="settings_category_exoplayer_title">Ajustes de ExoPlayer</string>
771769
<string name="settings_category_exoplayer_summary">Gestiona algunos ajustes de ExoPlayer. Estos cambios requieren reiniciar el reproductor para que surtan efecto</string>
772770
<string name="use_exoplayer_decoder_fallback_summary">Habilite esta opción si tiene problemas con la inicialización del decodificador recurriendo a decodificadores de menor prioridad si el decodificador principal no se inicializa. Esto puede dar como resultado un rendimiento de reproducción más bajo que cuando se usan decodificadores primarios</string>
773771
<string name="always_use_exoplayer_set_output_surface_workaround_summary">Esta solución alternativa libera los códecs de video y los vuelve a instanciar cuando cambia la máscara, en lugar de configurar la máscara directamente en el códec. ExoPlayer ya usa esta configuración en algunos dispositivos con este problema y solo afecta a Android 6 y versiones posteriores
@@ -832,7 +830,7 @@
832830
<string name="notification_actions_summary_android13">Edite cada acción de notificación pulsando sobre ella. Las tres primeras acciones (reproducir/pausa, anterior y siguiente) las establece el sistema y no se pueden personalizar.</string>
833831
<string name="error_insufficient_storage">No hay suficiente espacio libre en el dispositivo</string>
834832
<string name="settings_category_backup_restore_title">Respaldar y restaurar</string>
835-
<string name="reset_settings_title">Reiniciar ajustes</string>
833+
<string name="reset_settings_title">Restablecer ajustes</string>
836834
<string name="reset_settings_summary">Restablecer todos los ajustes a sus valores predeterminados</string>
837835
<string name="reset_all_settings">Restablecer todos los ajustes descartará todos sus ajustes preferidos y reiniciará la aplicación.
838836
\n

0 commit comments

Comments
 (0)