Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Stypox committed Nov 24, 2024
2 parents 1408150 + d298a12 commit 57e66b1
Show file tree
Hide file tree
Showing 39 changed files with 401 additions and 82 deletions.
9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ android {
if (System.properties.containsKey('versionCodeOverride')) {
versionCode System.getProperty('versionCodeOverride') as Integer
} else {
versionCode 999
versionCode 1000
}
versionName "0.27.2"
versionName "0.27.3"
if (System.properties.containsKey('versionNameSuffix')) {
versionNameSuffix System.getProperty('versionNameSuffix')
}
Expand Down Expand Up @@ -206,8 +206,9 @@ dependencies {
// name and the commit hash with the commit hash of the (pushed) commit you want to test
// This works thanks to JitPack: https://jitpack.io/
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
// WORKAROUND: v0.24.2 can't be resolved by jitpack -> use git commit hash instead
implementation 'com.github.TeamNewPipe:NewPipeExtractor:ea1a1d1375efd5936ed2609d0fa3e31d5097a835'
// WORKAROUND: if you get errors with the NewPipeExtractor dependency, replace `v0.24.3` with
// the corresponding commit hash, since JitPack is sometimes buggy
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.24.3'
implementation 'com.github.TeamNewPipe:NoNonsense-FilePicker:5.0.0'

/** Checkstyle **/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.schabi.newpipe.database.subscription.NotificationMode
import org.schabi.newpipe.database.subscription.SubscriptionEntity
import org.schabi.newpipe.extractor.Info
import org.schabi.newpipe.extractor.NewPipe
import org.schabi.newpipe.extractor.ServiceList
import org.schabi.newpipe.extractor.feed.FeedInfo
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipe.ktx.getStringSafe
Expand Down Expand Up @@ -90,6 +91,10 @@ class FeedLoadManager(private val context: Context) {
else -> feedDatabaseManager.outdatedSubscriptionsForGroup(groupId, outdatedThreshold)
}

// like `currentProgress`, but counts the number of YouTube extractions that have begun, so
// they can be properly throttled every once in a while (see doOnNext below)
val youtubeExtractionCount = AtomicInteger()

return outdatedSubscriptions
.take(1)
.doOnNext {
Expand All @@ -105,6 +110,15 @@ class FeedLoadManager(private val context: Context) {
.observeOn(Schedulers.io())
.flatMap { Flowable.fromIterable(it) }
.takeWhile { !cancelSignal.get() }
.doOnNext { subscriptionEntity ->
// throttle YouTube extractions once every BATCH_SIZE to avoid being rate limited
if (subscriptionEntity.serviceId == ServiceList.YouTube.serviceId) {
val previousCount = youtubeExtractionCount.getAndIncrement()
if (previousCount != 0 && previousCount % BATCH_SIZE == 0) {
Thread.sleep(DELAY_BETWEEN_BATCHES_MILLIS.random())
}
}
}
.parallel(PARALLEL_EXTRACTIONS, PARALLEL_EXTRACTIONS * 2)
.runOn(Schedulers.io(), PARALLEL_EXTRACTIONS * 2)
.filter { !cancelSignal.get() }
Expand Down Expand Up @@ -328,7 +342,19 @@ class FeedLoadManager(private val context: Context) {
/**
* How many extractions will be running in parallel.
*/
private const val PARALLEL_EXTRACTIONS = 6
private const val PARALLEL_EXTRACTIONS = 3

/**
* How many YouTube extractions to perform before waiting [DELAY_BETWEEN_BATCHES_MILLIS]
* to avoid being rate limited
*/
private const val BATCH_SIZE = 50

/**
* Wait a random delay in this range once every [BATCH_SIZE] YouTube extractions to avoid
* being rate limited
*/
private val DELAY_BETWEEN_BATCHES_MILLIS = (6000L..12000L)

/**
* Number of items to buffer to mass-insert in the database.
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/org/schabi/newpipe/util/ListHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ public final class ListHelper {
private static final Set<String> HIGH_RESOLUTION_LIST = Set.of("1440p", "2160p");
// Audio track types in order of priority. 0=lowest, n=highest
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING =
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.DUBBED, AudioTrackType.ORIGINAL);
List.of(AudioTrackType.DESCRIPTIVE, AudioTrackType.SECONDARY, AudioTrackType.DUBBED,
AudioTrackType.ORIGINAL);
// Audio track types in order of priority when descriptive audio is preferred.
private static final List<AudioTrackType> AUDIO_TRACK_TYPE_RANKING_DESCRIPTIVE =
List.of(AudioTrackType.ORIGINAL, AudioTrackType.DUBBED, AudioTrackType.DESCRIPTIVE);
List.of(AudioTrackType.SECONDARY, AudioTrackType.DUBBED, AudioTrackType.ORIGINAL,
AudioTrackType.DESCRIPTIVE);

/**
* List of supported YouTube Itag ids.
Expand Down
23 changes: 9 additions & 14 deletions app/src/main/java/org/schabi/newpipe/util/Localization.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,25 +327,20 @@ public static String audioTrackName(@NonNull final Context context, final AudioS

if (track.getAudioTrackType() != null) {
final String trackType = audioTrackType(context, track.getAudioTrackType());
if (trackType != null) {
return context.getString(R.string.audio_track_name, name, trackType);
}
return context.getString(R.string.audio_track_name, name, trackType);
}
return name;
}

@Nullable
@NonNull
private static String audioTrackType(@NonNull final Context context,
final AudioTrackType trackType) {
switch (trackType) {
case ORIGINAL:
return context.getString(R.string.audio_track_type_original);
case DUBBED:
return context.getString(R.string.audio_track_type_dubbed);
case DESCRIPTIVE:
return context.getString(R.string.audio_track_type_descriptive);
}
return null;
@NonNull final AudioTrackType trackType) {
return switch (trackType) {
case ORIGINAL -> context.getString(R.string.audio_track_type_original);
case DUBBED -> context.getString(R.string.audio_track_type_dubbed);
case DESCRIPTIVE -> context.getString(R.string.audio_track_type_descriptive);
case SECONDARY -> context.getString(R.string.audio_track_type_secondary);
};
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
<string name="drawer_close">Navigationsleiste schließen</string>
<string name="video_player">Video-Player</string>
<string name="background_player">Wiedergabe im Hintergrund</string>
<string name="popup_player">Popup-Player</string>
<string name="popup_player">Pop-up-Player</string>
<string name="preferred_player_fetcher_notification_title">Erhalte Informationen …</string>
<string name="preferred_player_fetcher_notification_message">Gewünschten Inhalt laden</string>
<string name="import_data_title">Datenbank importieren</string>
Expand Down
16 changes: 7 additions & 9 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
<string name="minimize_on_exit_popup_description">Minimizar al reproductor emergente</string>
<string name="skip_silence_checkbox">Avance rápido durante el silencio</string>
<string name="playback_step">Paso</string>
<string name="playback_reset">Reiniciar</string>
<string name="playback_reset">Restablecer</string>
<string name="channels">Canales</string>
<string name="users">Usuarios</string>
<string name="playlists">Listas de reproducción</string>
Expand Down Expand Up @@ -392,7 +392,7 @@
<string name="app_update_notification_channel_name">Notificación de actualización de la aplicación</string>
<string name="app_update_notification_channel_description">Notificaciones de nuevas versiones de NewPipe</string>
<string name="download_to_sdcard_error_title">Almacenamiento externo no disponible</string>
<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>
<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>
<string name="saved_tabs_invalid_json">No se pudo leer las pestañas guardadas, se usarán las pestañas predefinidas</string>
<string name="restore_defaults">Restaurar valores predefinidos</string>
<string name="restore_defaults_confirmation">¿Quieres restaurar los valores predefinidos\?</string>
Expand Down Expand Up @@ -492,7 +492,7 @@
<item quantity="other">%d seleccionados</item>
</plurals>
<string name="feed_group_dialog_empty_name">Nombre de grupo vacío</string>
<string name="feed_group_dialog_delete_message">¿Borrar este grupo\?</string>
<string name="feed_group_dialog_delete_message">¿Quieres borrar este grupo?</string>
<string name="feed_create_new_group_button_title">Nuevo</string>
<string name="settings_category_feed_title">Fuente</string>
<string name="feed_update_threshold_title">Velocidad de actualización del contenido</string>
Expand Down Expand Up @@ -627,9 +627,7 @@
<string name="feed_load_error_account_info">No fue posible cargar el muro por \'%s\'.</string>
<string name="account_terminated">Cuenta cancelada</string>
<string name="feed_load_error_fast_unknown">El modo de muro rápido no arroja más información sobre esto.</string>
<string name="feed_load_error_terminated">La cuenta del autor ha sido cancelada.
\nNewPipe no podrá acceder a ella en el futuro.
\n¿Desea desuscribirse de este canal\?</string>
<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>
<string name="feed_load_error">Error al cargar el muro</string>
<string name="downloads_storage_use_saf_summary_api_29">Desde Android 10 solo el \'Sistema de Acceso al Almacenamiento\' es soportado</string>
<string name="downloads_storage_ask_summary_no_saf_notice">Se le preguntará dónde guardar cada descarga</string>
Expand Down Expand Up @@ -737,7 +735,7 @@
<string name="ignore_hardware_media_buttons_summary">Útil, por ejemplo, si está utilizando un auricular con botones físicos rotos</string>
<string name="ignore_hardware_media_buttons_title">Ignorar eventos para botones multimedia de hardware</string>
<string name="remove_duplicates_title">¿Eliminar los duplicados\?</string>
<string name="remove_duplicates_message">¿Desea eliminar todas las secuencias duplicadas de esta lista de reproducción\?</string>
<string name="remove_duplicates_message">¿Quieres eliminar todas las secuencias duplicadas de esta lista de reproducción?</string>
<string name="feed_hide_streams_title">Mostrar las siguientes secuencias</string>
<string name="feed_show_hide_streams">Mostrar/Ocultar secuencias</string>
<string name="feed_show_upcoming">Próximamente</string>
Expand Down Expand Up @@ -767,7 +765,7 @@
<string name="audio_track_type_dubbed">doblado</string>
<string name="audio_track_type_descriptive">descriptivo</string>
<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>
<string name="settings_category_exoplayer_title">Ajustes para ExoPlayer</string>
<string name="settings_category_exoplayer_title">Ajustes de ExoPlayer</string>
<string name="settings_category_exoplayer_summary">Gestiona algunos ajustes de ExoPlayer. Estos cambios requieren reiniciar el reproductor para que surtan efecto</string>
<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>
<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
Expand Down Expand Up @@ -832,7 +830,7 @@
<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>
<string name="error_insufficient_storage">No hay suficiente espacio libre en el dispositivo</string>
<string name="settings_category_backup_restore_title">Respaldar y restaurar</string>
<string name="reset_settings_title">Reiniciar ajustes</string>
<string name="reset_settings_title">Restablecer ajustes</string>
<string name="reset_settings_summary">Restablecer todos los ajustes a sus valores predeterminados</string>
<string name="reset_all_settings">Restablecer todos los ajustes descartará todos sus ajustes preferidos y reiniciará la aplicación.
\n
Expand Down
Loading

0 comments on commit 57e66b1

Please sign in to comment.