From 50f2584405a8fc0bbcb0b367a27ba4646cd5d77d Mon Sep 17 00:00:00 2001
From: martel800 <142445201+martel800@users.noreply.github.com>
Date: Thu, 27 Jun 2024 11:25:53 +0200
Subject: [PATCH 1/3] Update README.md
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 4e22f926019..2e5cdc49288 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
+Mod for automated downloads based on criteria, instead of clicking through the download popup (name, audio/video, format, bitrate, etc.).
+
We are planning to rewrite large chunks of the codebase, to bring about a new, modern and stable NewPipe!
Please do not open pull requests for new features now, only bugfix PRs will be accepted.
From 5f79582d2ccc3c0dd49eee7ef5b66f890696659f Mon Sep 17 00:00:00 2001
From: martel
Date: Thu, 27 Jun 2024 15:35:46 +0200
Subject: [PATCH 2/3] Add an option to save data even on WiFi.
---
app/build.gradle | 12 ++++++------
.../java/org/schabi/newpipe/util/ListHelper.java | 9 ++++++---
app/src/main/res/values/settings_keys.xml | 1 +
app/src/main/res/values/strings.xml | 1 +
app/src/main/res/xml/video_audio_settings.xml | 7 +++++++
5 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 28a20819511..24312931eae 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -17,7 +17,7 @@ android {
defaultConfig {
applicationId "org.schabi.newpipe"
- resValue "string", "app_name", "NewPipe"
+ resValue "string", "app_name", "NewPipeAutoDL"
minSdk 21
targetSdk 33
versionCode 997
@@ -42,19 +42,19 @@ android {
if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev") {
// default values when branch name could not be determined or is master or dev
applicationIdSuffix ".debug"
- resValue "string", "app_name", "NewPipe Debug"
+ resValue "string", "app_name", "NewPipeAutoDLNewPipe Debug"
} else {
applicationIdSuffix ".debug." + normalizedWorkingBranch
- resValue "string", "app_name", "NewPipe " + workingBranch
- archivesBaseName = 'NewPipe_' + normalizedWorkingBranch
+ resValue "string", "app_name", "NewPipeAutoDL " + workingBranch
+ archivesBaseName = 'NewPipeAutoDL_' + normalizedWorkingBranch
}
}
release {
if (System.properties.containsKey('packageSuffix')) {
applicationIdSuffix System.getProperty('packageSuffix')
- resValue "string", "app_name", "NewPipe " + System.getProperty('packageSuffix')
- archivesBaseName = 'NewPipe_' + System.getProperty('packageSuffix')
+ resValue "string", "app_name", "NewPipeAutoDL " + System.getProperty('packageSuffix')
+ archivesBaseName = 'NewPipeAutoDL_' + System.getProperty('packageSuffix')
}
minifyEnabled true
shrinkResources false // disabled to fix F-Droid's reproducible build
diff --git a/app/src/main/java/org/schabi/newpipe/util/ListHelper.java b/app/src/main/java/org/schabi/newpipe/util/ListHelper.java
index f1904565d3b..f1149cda878 100644
--- a/app/src/main/java/org/schabi/newpipe/util/ListHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/util/ListHelper.java
@@ -705,9 +705,12 @@ static boolean isLimitingDataUsage(@NonNull final Context context) {
*/
private static String getResolutionLimit(@NonNull final Context context) {
String resolutionLimit = null;
- if (isMeteredNetwork(context)) {
- final SharedPreferences preferences =
- PreferenceManager.getDefaultSharedPreferences(context);
+ final SharedPreferences preferences =
+ PreferenceManager.getDefaultSharedPreferences(context);
+ final boolean treatAllNetworksAsMobileData =
+ preferences.getBoolean(context.getString(R.string.treat_all_networks_as_mobile_key),
+ false);
+ if (isMeteredNetwork(context) || treatAllNetworksAsMobileData) {
final String defValue = context.getString(R.string.limit_data_usage_none_key);
final String value = preferences.getString(
context.getString(R.string.limit_mobile_data_usage_key), defValue);
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index fb68a464d5a..510b7f67f4f 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -120,6 +120,7 @@
default_resolution
720p60
show_higher_resolutions
+ treat_all_networks_as_mobile
default_popup_resolution
480p
best_resolution
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 56140441cd0..abae6e0fb8a 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -45,6 +45,7 @@
Choose download folder for audio files
Default resolution
Default popup resolution
+ Treat all networks as mobile
Show higher resolutions
Only some devices can play 2K/4K videos
Play with Kodi
diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml
index 727ce4df40a..977fd3a05a6 100644
--- a/app/src/main/res/xml/video_audio_settings.xml
+++ b/app/src/main/res/xml/video_audio_settings.xml
@@ -33,6 +33,13 @@
app:iconSpaceReserved="false"
app:useSimpleSummaryProvider="true" />
+
+
Date: Fri, 28 Jun 2024 11:26:05 +0200
Subject: [PATCH 3/3] Automate the download dialog
---
README.md | 3 +-
.../newpipe/download/DownloadDialog.java | 28 ++++++++++++++++++-
app/src/main/res/values/settings_keys.xml | 1 +
app/src/main/res/values/strings.xml | 1 +
app/src/main/res/xml/video_audio_settings.xml | 7 +++++
5 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 2e5cdc49288..9731c40e793 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
-Mod for automated downloads based on criteria, instead of clicking through the download popup (name, audio/video, format, bitrate, etc.).
+A mod for more automated downloads. For use with Youtube's "Share" button from a browser, essentially using NewPipe like a downloader "plugin" (a replacement for TubeMate, which is a freaking Adware, if not worse).
+Introduces two new "Video and Audio" settings, one for treating all networks as metered, and another for automatically OK'ing the download dialog.
We are planning to rewrite large chunks of the codebase, to bring about a new, modern and stable NewPipe!
Please do not open pull requests for new features now, only bugfix PRs will be accepted.
diff --git a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java
index db2066b2782..8fd33a8b25d 100644
--- a/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java
+++ b/app/src/main/java/org/schabi/newpipe/download/DownloadDialog.java
@@ -13,6 +13,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.os.Handler;
import android.os.IBinder;
import android.provider.Settings;
import android.util.Log;
@@ -28,6 +29,7 @@
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult;
import androidx.annotation.IdRes;
+import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
@@ -110,6 +112,8 @@ public class DownloadDialog extends DialogFragment
int selectedAudioIndex = 0; // default to the first item
@State
int selectedSubtitleIndex = 0; // default to the first item
+ @State
+ boolean okClicked = false; // guard
private StoredDirectoryHelper mainStorageAudio = null;
private StoredDirectoryHelper mainStorageVideo = null;
@@ -350,13 +354,35 @@ private void initToolbar(final Toolbar toolbar) {
toolbar.setOnMenuItemClickListener(item -> {
if (item.getItemId() == R.id.okay) {
- prepareSelectedDownload();
+ if (!this.okClicked) {
+ this.okClicked = true;
+ prepareSelectedDownload();
+ }
return true;
}
return false;
});
}
+ @MainThread
+ @Override
+ public void onStart() {
+ super.onStart();
+ final boolean autoOkDownloadDialog =
+ PreferenceManager.getDefaultSharedPreferences(requireContext()).getBoolean(
+ context.getString(R.string.auto_ok_download_dialog_key), false);
+ if (autoOkDownloadDialog) {
+ final Handler timerHandler = new Handler();
+ final Runnable timerRunnable = new Runnable() {
+ @Override
+ public void run() {
+ okButton.performClick();
+ }
+ };
+ timerHandler.postDelayed(timerRunnable, 500);
+ }
+ }
+
@Override
public void onDestroy() {
super.onDestroy();
diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml
index 510b7f67f4f..936ba164ff2 100644
--- a/app/src/main/res/values/settings_keys.xml
+++ b/app/src/main/res/values/settings_keys.xml
@@ -121,6 +121,7 @@
720p60
show_higher_resolutions
treat_all_networks_as_mobile
+ auto_ok_download_dialog
default_popup_resolution
480p
best_resolution
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index abae6e0fb8a..43e0da2f7d9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -46,6 +46,7 @@
Default resolution
Default popup resolution
Treat all networks as mobile
+ Automatically OK download dialog
Show higher resolutions
Only some devices can play 2K/4K videos
Play with Kodi
diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml
index 977fd3a05a6..a7c50188bb1 100644
--- a/app/src/main/res/xml/video_audio_settings.xml
+++ b/app/src/main/res/xml/video_audio_settings.xml
@@ -40,6 +40,13 @@
app:singleLineTitle="false"
app:iconSpaceReserved="false" />
+
+