1
0
Fork 0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2025-10-02 17:29:31 +02:00

Compare commits

...

4 commits

Author SHA1 Message Date
Stypox
3a2d427a46
Merge pull request #12642 from Stypox/fireos-SAF 2025-10-01 16:28:12 +02:00
Tobi
c25f83da6c
Merge pull request #12671 from TransZAllen/SRT_numbering
Fix initial numbering of frames in TTML to SRT converter
2025-10-01 02:42:33 -07:00
TransZAllen
980e8f3951 [YouTube] *.srt numbering start at 1 instead of 0. (issue: https://github.com/TeamNewPipe/NewPipe/issues/12670)
- The SubRip (.srt) specification requires subtitle numbering to begin from 1.
- Please refer to https://en.wikipedia.org/wiki/SubRip
- Previously numbering started from 0, which is accepted by most
  players (tested on mpv, VLC, MPlayer, Totem) but not strictly compliant.
2025-09-29 18:04:35 +08:00
Stypox
4e9a480fdd
Enforce using SAF on FireOS TVs with Android 10+
Even if SAF is bugged there, there is no other way to open a file dialog, since NewPipe does not have permissions, see #10643
2025-09-17 12:24:18 +02:00
2 changed files with 12 additions and 7 deletions

View file

@ -103,12 +103,12 @@ public final class NewPipeSettings {
}
public static boolean useStorageAccessFramework(final Context context) {
// There's a FireOS bug which prevents SAF open/close dialogs from being confirmed with a
// remote (see #6455).
if (DeviceUtils.isFireTv()) {
return false;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
return true;
} else if (DeviceUtils.isFireTv()) {
// There's a FireOS bug which prevents SAF open/close dialogs from being confirmed with
// a remote (see #6455).
return false;
}
final String key = context.getString(R.string.storage_use_saf);

View file

@ -24,7 +24,11 @@ public class SrtFromTtmlWriter {
private final boolean ignoreEmptyFrames;
private final Charset charset = StandardCharsets.UTF_8;
private int frameIndex = 0;
// According to the SubRip (.srt) specification, subtitle
// numbering must start from 1.
// Some players accept 0 or even negative indices,
// but to ensure compliance we start at 1.
private int frameIndex = 1;
public SrtFromTtmlWriter(final SharpStream out, final boolean ignoreEmptyFrames) {
this.out = out;
@ -39,7 +43,8 @@ public class SrtFromTtmlWriter {
private void writeFrame(final String begin, final String end, final StringBuilder text)
throws IOException {
writeString(String.valueOf(frameIndex++));
writeString(String.valueOf(frameIndex));
frameIndex += 1;
writeString(NEW_LINE);
writeString(begin);
writeString(" --> ");