Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
16b0df6
Update README.ko.md
seojun0924 Nov 18, 2022
0821f64
Added bottom main-tabs feature
Jan 25, 2023
2b37721
Update app/src/main/res/values/strings.xml
Marius1501 Jan 29, 2023
ee217eb
Merge branch 'TeamNewPipe:dev' into tabs_on_bottom
Marius1501 Jan 31, 2023
38db0cc
Changed the color
Jan 31, 2023
26b29ca
Made the requested color changes
Feb 7, 2023
c8ffe65
Simplify code to set tab layout position
Stypox Feb 26, 2023
65680b2
Only update main tabs position when it changes
Stypox Feb 26, 2023
bb1f5d8
Update README.es.md
rogerjs93 Mar 8, 2023
de7872d
feat: add audio language selector
Theta-Dev Mar 17, 2023
208887d
feat: improve audio track sorting, add prefer_descriptive_audio option
Theta-Dev Mar 18, 2023
dba53d2
fix: remove todo
Theta-Dev Mar 18, 2023
77649d3
fix: reduce complexity
Theta-Dev Mar 18, 2023
366c39d
feat: add language selector to audio player
Theta-Dev Mar 19, 2023
87a88e4
feat: localized audio track names
Theta-Dev Mar 19, 2023
7aed2ee
feat: add prefer original option, improve audio stream ordering
Theta-Dev Mar 19, 2023
ef0a4cf
feat: add external audio playback language selector
Theta-Dev Mar 19, 2023
9b8ffdd
fix: improve track name localization
Theta-Dev Mar 19, 2023
61a1476
fix: ListHelper tests
Theta-Dev Mar 19, 2023
dbd6e4d
fix: sonarcloud lint
Theta-Dev Mar 19, 2023
fdd3b03
fix: audio stream format selection
Theta-Dev Mar 19, 2023
ed06f55
feat: add track selection to downloader
Theta-Dev Mar 20, 2023
694418d
fix: update stream sizes when audio track changed
Theta-Dev Mar 21, 2023
39a5c8b
fix: reset video stream sizes on audio track selection
Theta-Dev Mar 29, 2023
d010384
Merge branch 'dev' of github.com:TeamNewPipe/NewPipe into alang-selector
Theta-Dev Apr 3, 2023
3c74cb3
Created a setting to switch the sides of volume and brightness
Jan 20, 2023
96e9242
Update app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayer…
Marius1501 Jan 20, 2023
c8d54ec
Changed to val
Jan 20, 2023
2ba6499
Updated the gesture-switch-toggle
Jan 21, 2023
759a908
Fixed a bug
Jan 23, 2023
2ded8c7
Made two list options
Jan 29, 2023
72ca52a
Made the requested changes
Marius1501 Feb 7, 2023
32cec6c
Changed the naming
Feb 7, 2023
65d8589
Changed the naming
Feb 10, 2023
7689d1d
Added the migration
Mar 1, 2023
3c72992
Update app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDet…
Marius1501 Feb 26, 2023
d273560
Changed the default of the switches
Apr 3, 2023
704e9bd
Fix checkstyle
Stypox Apr 4, 2023
7350b1f
Add notice to README to not open feature PRs
Stypox Apr 4, 2023
4bb45c0
Fix settings migration
Stypox Apr 4, 2023
445d364
Merge pull request #9708 from Marius1501/switch_setting_brightness_vo…
Stypox Apr 4, 2023
140ea86
Merge pull request #10002 from Stypox/readme-notice
Stypox Apr 4, 2023
c08538d
Remove jsoup files from APK
TobiGr Apr 4, 2023
365bb2d
Merge branch 'dev' of github.com:TeamNewPipe/NewPipe into alang-selector
Theta-Dev Apr 5, 2023
74bd28c
Update AndroidX Core to 1.10.0.
Isira-Seneviratne Apr 9, 2023
29318c6
Merge pull request #10004 from TeamNewPipe/fix/apk-jsoup
Stypox Apr 10, 2023
a4a9957
Add ExoPlayerSettingsFragment and move playback load interval size se…
AudricV Aug 18, 2022
41da8fc
Add ability to use ExoPlayer's decoder fallback option
AudricV Aug 18, 2022
a6ff85a
Move media tunneling setting to ExoPlayer settings and make this sett…
AudricV Aug 18, 2022
a02b92f
Update playback load interval size setting description
AudricV Aug 21, 2022
787758a
[Android 6+] Add ability to always use ExoPlayer's MediaVideoCodecRen…
AudricV Feb 26, 2023
6243f34
Merge pull request #8875 from AudricV/exoplayer-settings
Stypox Apr 10, 2023
acebabd
Use AndroidX's PendingIntentCompat class.
Isira-Seneviratne Apr 9, 2023
20f0011
Fix Sonar failure.
Isira-Seneviratne Apr 13, 2023
ba3afd1
Merge pull request #10021 from Isira-Seneviratne/PendingIntentCompat
Stypox Apr 14, 2023
f8c3ec4
Use a whitelist to filter all streams retrieved by the extractor.
TobiGr Feb 4, 2023
e18a6b0
Apply new itag filter only to YouTube streams
TobiGr Apr 17, 2023
2edc223
Merge branch 'dev' into alang-selector
Theta-Dev Apr 17, 2023
70b3ba3
Upgrade to Gradle 8.0
Stypox Apr 20, 2023
6d98ad7
Further upgrade gradle to 8.1
Stypox Apr 20, 2023
78e1e05
Fix gradle build for Java 17 and 19
Stypox Apr 20, 2023
69ef4a9
Update CI Java version
Stypox Apr 20, 2023
f74d794
Merge pull request #10035 from Stypox/update-gradle
Isira-Seneviratne Apr 20, 2023
da30e53
Merge pull request #9748 from TeamNewPipe/feat/av1-tags
Stypox Apr 20, 2023
b567d42
fix: small codestyle fixes
Theta-Dev Apr 21, 2023
c377ffb
Merge branch 'dev' of github.com:TeamNewPipe/NewPipe into alang-selector
Theta-Dev Apr 21, 2023
60a5d02
add language ߒߞߏ (nqo)
Mibakaba Apr 24, 2023
8519897
Fix ktlint formatter after upgrade to Java 17
Stypox Apr 25, 2023
43b0167
Fix CI command injection vulnerability
Stypox Apr 26, 2023
60fc662
Update settings_keys.xml
Mibakaba Apr 27, 2023
ed17811
Merge pull request from GHSA-r3gv-6fw7-hc52
TobiGr Apr 27, 2023
4e837e8
fix docs in app/src/main/java/org/schabi/newpipe/util/Localization.java
Theta-Dev Apr 30, 2023
22671ca
fix: audio stream cache key, code fmt
Theta-Dev Apr 30, 2023
fb00ee8
[YouTube] Improve download speed (#9948)
Theta-Dev May 1, 2023
d89a3c6
Remove "default" from audio track already present message
AudricV May 1, 2023
023f616
Add Open in browser button to audio external players dialog
AudricV May 1, 2023
2315b08
Merge pull request #9937 from Theta-Dev/alang-selector
Stypox May 2, 2023
e1fd25f
Merge pull request #10046 from Stypox/ktlint-java17
Stypox May 2, 2023
10c42de
Fix uploader and subchannel avatars swapped
Stypox May 3, 2023
9866eab
Update Android Gradle Plugin to 8.0.1
Stypox May 3, 2023
4bf0636
Merge pull request #10067 from Stypox/update-gradle-again
TobiGr May 4, 2023
0bb3e7c
Translated using Weblate (Belarusian)
TobiGr May 5, 2023
51ee6f8
Remove translations of previously deleted string feed_toggle_hide_pla…
TobiGr May 5, 2023
f1524b6
Remove translations of previously deleted string feed_toggle_show_pla…
TobiGr May 5, 2023
e109e8c
Remove translations of previously deleted string volume_gesture_contr…
TobiGr May 5, 2023
e831059
Remove translations of previously deleted string volume_gesture_contr…
TobiGr May 5, 2023
2f31ea8
Remove translations of previously deleted string brightness_gesture_c…
TobiGr May 5, 2023
41038f4
Remove translations of previously deleted string brightness_gesture_c…
TobiGr May 6, 2023
8639972
Merge pull request #10074 from TeamNewPipe/weblate
TobiGr May 6, 2023
df430ba
Merge pull request #10042 from MBKaba/patch-1
TobiGr May 6, 2023
ecbf5d5
Remove unused resources.
Isira-Seneviratne May 7, 2023
0ab9961
Organize the proguard file
TacoTheDank May 12, 2023
fe82029
Fix unresolved extractor
TacoTheDank May 12, 2023
677bb40
Add rewrite announcement to readme
Stypox May 26, 2023
17cdedf
Merge pull request #10119 from Stypox/rewrite-announcement
Stypox May 26, 2023
c8e8915
Move questions to Discussions
Stypox May 26, 2023
c87b42d
Merge pull request #10120 from Stypox/move-questions
TobiGr May 26, 2023
577301c
Proper filename for questions discussion template
Stypox May 26, 2023
1925687
Merge pull request #10089 from TacoTheDank/fixUnresolvedExtractor
Stypox May 26, 2023
4e3bf3c
Update some libraries
TacoTheDank May 30, 2023
ad75db4
Merge pull request #10088 from TacoTheDank/organizeProguard
Isira-Seneviratne Jun 2, 2023
6cf13ed
Merge pull request #10087 from TacoTheDank/bumpLibraries
Isira-Seneviratne Jun 2, 2023
6bcc869
handle links to the PeerTube instance “peertube.stream”
quarthex Jun 5, 2023
42de2c7
Merge pull request #10141 from quarthex/add-peertube.stream
TobiGr Jun 5, 2023
72c6ed2
Merge pull request #10066 from Stypox/swap-subchannel-avatar
TobiGr Jun 5, 2023
1848892
Merge pull request #10076 from Isira-Seneviratne/Remove_unused_resources
Isira-Seneviratne Jun 9, 2023
3622438
Translated using Weblate (Arabic)
TobiGr Jun 14, 2023
3c87462
Merge pull request #10164 from TeamNewPipe/weblate
TobiGr Jun 14, 2023
8bdeed8
Add support for new GitHub assetes URLs in image minimizer workflow
TobiGr Jun 15, 2023
1a2fbd8
Update acra and checkstyle fixing vulnerability in dependency com.goo…
TobiGr Jul 1, 2023
d845a15
Merge pull request #10200 from TeamNewPipe/fix/acra
TobiGr Jul 1, 2023
5716d51
Update screenshots
Stypox Jul 6, 2023
ea0d798
Update README screenshots
Stypox Jul 6, 2023
56eec9f
Add separation between tablet and phone images
Stypox Jul 7, 2023
3bbc606
Update screenshots in translated READMEs
Stypox Jul 7, 2023
62ce0b0
Merge pull request #10213 from Stypox/update-screenshots
TobiGr Jul 8, 2023
e765343
Merge pull request #10166 from TeamNewPipe/fix/image-workflow
Stypox Jul 8, 2023
30724db
Add link to wiki page for APK download
TobiGr Jul 8, 2023
e33bb67
Merge pull request #10219 from TeamNewPipe/PR-template-wiki-link
Stypox Jul 8, 2023
db7de05
Update LeakCanary library
TacoTheDank Jul 12, 2023
c1f0a94
Clean up AlertDialogs
TacoTheDank Jul 12, 2023
5c7a9a5
Merge pull request #10223 from TacoTheDank/cleanAlertDialogs
Stypox Jul 12, 2023
f8599d1
Merge pull request #10085 from TacoTheDank/bumpLeakCanary
Stypox Jul 12, 2023
01b46ed
Fix crash after feed update
Koitharu Jul 14, 2023
8cfba40
Merge pull request #10229 from Koitharu/bugfix/feed_crash
TobiGr Jul 14, 2023
6b7ffbb
[Download] Fix audio stream selection
TobiGr Jul 14, 2023
fdd8b76
Fix DebugApp doing unneeded AppWatcher.manualInstall
Stypox Jul 14, 2023
135f0f7
Make all leak canary libs debugImplementation-only
Stypox Jul 14, 2023
00257e9
Fix PlayerService leakead by Binder instance
Stypox Jul 14, 2023
5d6158e
No need to manually mark fragment as destroyed for LeakCanary
Stypox Jul 14, 2023
d9e2ada
Minimize images in PR descriptions
TobiGr Jul 15, 2023
7742c40
Create individual stream notifications for convenience on Android 7.0…
Isira-Seneviratne May 3, 2023
795bc82
Show number of new streams in the collapsed summary notification.
Isira-Seneviratne May 7, 2023
eeec6fd
Replace null check with use of NotificationManagerCompat.from
TobiGr Jul 16, 2023
05cc520
Fix pure logo
TobiGr Jul 16, 2023
d25e84a
Merge pull request #9897 from rogerjs93/patch-1
TobiGr Jul 16, 2023
d80e531
Merge pull request #9421 from seojun0924/patch-2
TobiGr Jul 17, 2023
3e87c40
Add Italian README
TobiGr Jul 17, 2023
a4453bc
Add Punjabi README
TobiGr Jul 17, 2023
b6bdd35
Add Assamese README
TobiGr Jul 17, 2023
2f0ed7f
Merge pull request #10232 from Stypox/leakcanary-fix
TobiGr Jul 17, 2023
ddef550
Add French README
TobiGr Jul 17, 2023
2377d85
Add German README
TobiGr Jul 17, 2023
25fea73
Add Russian README
TobiGr Jul 17, 2023
ec21200
Add links to all READMEs
TobiGr Jul 17, 2023
4c17c7b
Merge pull request #10240 from TeamNewPipe/readmes
TobiGr Jul 17, 2023
bf22515
Fix README
TobiGr Jul 17, 2023
43ef852
Merge pull request #10230 from TeamNewPipe/fix/offline-stream-chooser
TobiGr Jul 17, 2023
3f944c1
Fix MigrationTestHelper deprecation
TacoTheDank Jul 18, 2023
a01e59e
Update AndroidX Room library
TacoTheDank Jul 18, 2023
90bc190
Create SubscriptionManagerTest.java
SydneyDrone May 29, 2022
528bd50
Improve SubscriptionManager tests
Stypox Jul 20, 2022
5706447
Merge pull request #8456 from SydneyDrone/database_tests
TobiGr Jul 18, 2023
4711370
Merge pull request #9719 from Marius1501/tabs_on_bottom
TobiGr Jul 18, 2023
cd2884d
Merge pull request #10235 from TacoTheDank/bumpRoom
TobiGr Jul 18, 2023
cb00c57
Set channel icon for stream notifications
Isira-Seneviratne Jul 18, 2023
5ab3a4a
Refactor Player.useVideoSource logic and improve its comments
AudricV Jun 28, 2023
c658f28
Merge pull request #10078 from Isira-Seneviratne/Improve_feed_notific…
Isira-Seneviratne Jul 20, 2023
3243f97
Merge pull request #10233 from TeamNewPipe/actions/mimmizer-pr
TobiGr Jul 20, 2023
3edd4c0
Merge pull request #10195 from AudricV/player_refactor-renderers-acti…
TobiGr Jul 22, 2023
ec7d01b
Translated using Weblate (Swedish)
weblate Jul 24, 2023
cbc7b8c
Fix wrongly formatted string resource `audio_track_name`
TobiGr Jul 24, 2023
54f3003
Added Uchinaguchi README
TobiGr Jul 24, 2023
e4d3b74
Added Uchinaguchi translation
kuragehimekurara1 Jul 23, 2023
38d3b3c
Added Uchinaguchi (ryu) to language selector
kuragehimekurara1 Jul 22, 2023
9eedbae
Fix ryu translation syntax
TobiGr Jul 24, 2023
96a7cc2
Merge pull request #10250 from kuragehimekurara1/dev
TobiGr Jul 24, 2023
78e577d
Make some constants private and annotate params
TobiGr May 26, 2023
8b63b43
Disable media tunneling if the device is known for not supporting it
TobiGr Jul 18, 2023
1db7337
Ensure that imports handle disabling media tunneling correctly
TobiGr Jul 29, 2023
40d102f
Disable media tunneling by default on new devices
TobiGr Jul 18, 2023
428a7d4
Update com.squareup.okio:okio to 3.4.0
TobiGr Jul 31, 2023
d6a1170
Replace settings migration with automatic check for device blacklist …
TobiGr Jul 31, 2023
6b3f51e
Merge pull request #10281 from TeamNewPipe/okio
TobiGr Jul 31, 2023
3c91ec3
Merge pull request #10122 from TeamNewPipe/fix/media-tunneling
TobiGr Jul 31, 2023
0195655
Add changelog for NewPipe 0.25.2 (994)
TobiGr Jul 31, 2023
b56f3b3
Translated using Weblate (Punjabi)
weblate Jul 31, 2023
27f7751
Update NewPipe Extractor to 39a911db9f
TobiGr Jul 31, 2023
8f644e8
Translated using Weblate (Urdu)
weblate Aug 2, 2023
3f0f66f
Bump version to 0.25.2 (994)
TobiGr Jul 31, 2023
d4019f4
Update NewPipeExtractor to v0.22.7
Stypox Aug 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
### Please do **not** open pull requests for *new features* now, as we are planning to rewrite large chunks of the code. Only bugfix PRs will be accepted. More details will be announced soon!

NewPipe contribution guidelines
===============================

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Question
description: Ask about anything NewPipe-related
labels: [question, needs triage]
labels: [question]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this issue! :hugs:
Thanks for taking the time to fill out this form! :hugs:

Note that you can also ask questions on our [IRC channel](https://web.libera.chat/#newpipe).

Expand All @@ -14,7 +14,7 @@ body:
attributes:
label: "Checklist"
options:
- label: "I made sure that there are *no existing issues* - [open](https://github.com/TeamNewPipe/NewPipe/issues) or [closed](https://github.com/TeamNewPipe/NewPipe/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
- label: "I made sure that there are *no existing issues or discussions* - [open](https://github.com/TeamNewPipe/NewPipe/issues) or [closed](https://github.com/TeamNewPipe/NewPipe/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
required: true
- label: "I have read the [FAQ](https://newpipe.net/FAQ/) and my question isn't listed."
required: true
Expand Down
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: ❓ Question
url: https://github.com/TeamNewPipe/NewPipe/discussions/new?category=questions
about: Ask about anything NewPipe-related
- name: 💬 IRC
url: https://web.libera.chat/#newpipe
about: Chat with us via IRC for quick Q/A
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#### APK testing
<!-- Use a new, meaningfully named branch. The name is used as a suffix for the app ID to allow installing and testing multiple versions of NewPipe, e.g. "commentfix", if your PR implements a bugfix for comments. (No names like "patch-0" and "feature-1".) -->
<!-- Remove the following line if you directly link the APK created by the CI pipeline. Directly linking is preferred if you need to let users test.-->
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration [on this wiki page](https://github.com/TeamNewPipe/NewPipe/wiki/Download-APK-for-PR).

#### Due diligence
- [ ] I read the [contribution guidelines](https://github.com/TeamNewPipe/NewPipe/blob/HEAD/.github/CONTRIBUTING.md).
29 changes: 18 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ jobs:
- name: create and checkout branch
# push events already checked out the branch
if: github.event_name == 'pull_request'
run: git checkout -B ${{ github.head_ref }}
env:
BRANCH: ${{ github.head_ref }}
run: git checkout -B "$BRANCH"

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: "temurin"
cache: 'gradle'

Expand All @@ -66,28 +68,33 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
# api-level 19 is min sdk, but throws errors related to desugaring
api-level: [ 21, 29 ]
include:
- api-level: 21
target: default
arch: x86
- api-level: 33
target: google_apis # emulator API 33 only exists with Google APIs
arch: x86_64

permissions:
contents: read

steps:
- uses: actions/checkout@v3

- name: set up JDK 11
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: "temurin"
cache: 'gradle'

- name: Run android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
# workaround to emulator bug: https://github.com/ReactiveCircus/android-emulator-runner/issues/160
emulator-build: 7425822
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
script: ./gradlew connectedCheck --stacktrace

- name: Upload test report when tests fail # because the printed out stacktrace (console) is too short, see also #7553
Expand All @@ -108,10 +115,10 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11 # Sonar requires JDK 11
java-version: 17
distribution: "temurin"
cache: 'gradle'

Expand Down
113 changes: 64 additions & 49 deletions .github/workflows/image-minimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module.exports = async ({github, context}) => {
initialBody = context.payload.comment.body;
} else if (context.eventName == 'issues') {
initialBody = context.payload.issue.body;
} else if (context.eventName == 'pull_request') {
initialBody = context.payload.pull_request.body;
} else {
console.log('Aborting: No body found');
return;
Expand All @@ -30,10 +32,12 @@ module.exports = async ({github, context}) => {
}

// Regex for finding images (simple variant) ![ALT_TEXT](https://*.githubusercontent.com/<number>/<variousHexStringsAnd->.<fileExtension>)
const REGEX_IMAGE_LOOKUP = /\!\[(.*)\]\((https:\/\/[-a-z0-9]+\.githubusercontent\.com\/\d+\/[-0-9a-f]{32,512}\.(jpg|gif|png))\)/gm;
const REGEX_USER_CONTENT_IMAGE_LOOKUP = /\!\[(.*)\]\((https:\/\/[-a-z0-9]+\.githubusercontent\.com\/\d+\/[-0-9a-f]{32,512}\.(jpg|gif|png))\)/gm;
const REGEX_ASSETS_IMAGE_LOCKUP = /\!\[(.*)\]\((https:\/\/github\.com\/[-\w\d]+\/[-\w\d]+\/assets\/\d+\/[\-0-9a-f]{32,512})\)/gm;

// Check if we found something
let foundSimpleImages = REGEX_IMAGE_LOOKUP.test(initialBody);
let foundSimpleImages = REGEX_USER_CONTENT_IMAGE_LOOKUP.test(initialBody)
|| REGEX_ASSETS_IMAGE_LOCKUP.test(initialBody);
if (!foundSimpleImages) {
console.log('Found no simple images to process');
return;
Expand All @@ -47,53 +51,8 @@ module.exports = async ({github, context}) => {
var wasMatchModified = false;

// Try to find and replace the images with minimized ones
let newBody = await replaceAsync(initialBody, REGEX_IMAGE_LOOKUP, async (match, g1, g2) => {
console.log(`Found match '${match}'`);

if (g1.endsWith(IGNORE_ALT_NAME_END)) {
console.log(`Ignoring match '${match}': IGNORE_ALT_NAME_END`);
return match;
}

let probeAspectRatio = 0;
let shouldModify = false;
try {
console.log(`Probing ${g2}`);
let probeResult = await probe(g2);
if (probeResult == null) {
throw 'No probeResult';
}
if (probeResult.hUnits != 'px') {
throw `Unexpected probeResult.hUnits (expected px but got ${probeResult.hUnits})`;
}
if (probeResult.height <= 0) {
throw `Unexpected probeResult.height (height is invalid: ${probeResult.height})`;
}
if (probeResult.wUnits != 'px') {
throw `Unexpected probeResult.wUnits (expected px but got ${probeResult.wUnits})`;
}
if (probeResult.width <= 0) {
throw `Unexpected probeResult.width (width is invalid: ${probeResult.width})`;
}
console.log(`Probing resulted in ${probeResult.width}x${probeResult.height}px`);

probeAspectRatio = probeResult.width / probeResult.height;
shouldModify = probeResult.height > IMG_MAX_HEIGHT_PX && probeAspectRatio < MIN_ASPECT_RATIO;
} catch(e) {
console.log('Probing failed:', e);
// Immediately abort
return match;
}

if (shouldModify) {
wasMatchModified = true;
console.log(`Modifying match '${match}'`);
return `<img alt="${g1}" src="${g2}" width=${Math.min(600, (IMG_MAX_HEIGHT_PX * probeAspectRatio).toFixed(0))} />`;
}

console.log(`Match '${match}' is ok/will not be modified`);
return match;
});
let newBody = await replaceAsync(initialBody, REGEX_USER_CONTENT_IMAGE_LOOKUP, minimizeAsync);
newBody = await replaceAsync(newBody, REGEX_ASSETS_IMAGE_LOCKUP, minimizeAsync);

if (!wasMatchModified) {
console.log('Nothing was modified. Skipping update');
Expand All @@ -117,6 +76,14 @@ module.exports = async ({github, context}) => {
repo: context.repo.repo,
body: newBody
});
} else if (context.eventName == 'pull_request') {
console.log('Updating pull request', context.payload.pull_request.number);
await github.rest.pulls.update({
pull_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: newBody
});
}

// Asnyc replace function from https://stackoverflow.com/a/48032528
Expand All @@ -129,4 +96,52 @@ module.exports = async ({github, context}) => {
const data = await Promise.all(promises);
return str.replace(regex, () => data.shift());
}

async function minimizeAsync(match, g1, g2) {
console.log(`Found match '${match}'`);

if (g1.endsWith(IGNORE_ALT_NAME_END)) {
console.log(`Ignoring match '${match}': IGNORE_ALT_NAME_END`);
return match;
}

let probeAspectRatio = 0;
let shouldModify = false;
try {
console.log(`Probing ${g2}`);
let probeResult = await probe(g2);
if (probeResult == null) {
throw 'No probeResult';
}
if (probeResult.hUnits != 'px') {
throw `Unexpected probeResult.hUnits (expected px but got ${probeResult.hUnits})`;
}
if (probeResult.height <= 0) {
throw `Unexpected probeResult.height (height is invalid: ${probeResult.height})`;
}
if (probeResult.wUnits != 'px') {
throw `Unexpected probeResult.wUnits (expected px but got ${probeResult.wUnits})`;
}
if (probeResult.width <= 0) {
throw `Unexpected probeResult.width (width is invalid: ${probeResult.width})`;
}
console.log(`Probing resulted in ${probeResult.width}x${probeResult.height}px`);

probeAspectRatio = probeResult.width / probeResult.height;
shouldModify = probeResult.height > IMG_MAX_HEIGHT_PX && probeAspectRatio < MIN_ASPECT_RATIO;
} catch(e) {
console.log('Probing failed:', e);
// Immediately abort
return match;
}

if (shouldModify) {
wasMatchModified = true;
console.log(`Modifying match '${match}'`);
return `<img alt="${g1}" src="${g2}" width=${Math.min(600, (IMG_MAX_HEIGHT_PX * probeAspectRatio).toFixed(0))} />`;
}

console.log(`Match '${match}' is ok/will not be modified`);
return match;
}
}
2 changes: 2 additions & 0 deletions .github/workflows/image-minimizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
types: [created, edited]
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]

permissions:
issues: write
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<h3 align="center">We are planning to <i>rewrite</i> large chunks of the codebase, to bring about <a href="https://github.com/TeamNewPipe/NewPipe/discussions/10118">a new, modern and stable NewPipe</a>!</h3>
<h4 align="center">Please do <b>not</b> open pull requests for <i>new features</i> now, only bugfix PRs will be accepted.</h4>

<p align="center"><a href="https://newpipe.net"><img src="assets/new_pipe_icon_5.png" width="150"></a></p>
<h2 align="center"><b>NewPipe</b></h2>
<h4 align="center">A libre lightweight streaming front-end for Android.</h4>
Expand All @@ -17,26 +20,26 @@
<p align="center"><a href="https://newpipe.net">Website</a> &bull; <a href="https://newpipe.net/blog/">Blog</a> &bull; <a href="https://newpipe.net/FAQ/">FAQ</a> &bull; <a href="https://newpipe.net/press/">Press</a></p>
<hr>

*Read this in other languages: [English](README.md), [Español](doc/README.es.md), [हिन्दी](doc/README.hi.md), [한국어](doc/README.ko.md), [Soomaali](doc/README.so.md), [Português Brasil](doc/README.pt_BR.md), [Polski](doc/README.pl.md), [日本語](doc/README.ja.md), [Română](doc/README.ro.md), [Türkçe](doc/README.tr.md), [正體中文](doc/README.zh_TW.md).*
*Read this document in other languages: [Deutsch](doc/README.de.md), [English](README.md), [Español](doc/README.es.md), [Français](doc/README.fr.md), [हिन्दी](doc/README.hi.md), [Italiano](doc/README.it.md), [한국어](doc/README.ko.md), [Português Brasil](doc/README.pt_BR.md), [Polski](doc/README.pl.md), [ਪੰਜਾਬੀ ](doc/README.pa.md), [日本語](doc/README.ja.md), [Română](doc/README.ro.md), [Soomaali](doc/README.so.md), [Türkçe](doc/README.tr.md), [正體中文](doc/README.zh_TW.md), [অসমীয়া](doc/README.asm.md)*

<b>WARNING: THIS APP IS IN BETA, SO YOU MAY ENCOUNTER BUGS. IF YOU DO, OPEN AN ISSUE IN OUR GITHUB REPOSITORY BY FILLING OUT THE ISSUE TEMPLATE.</b>

<b>PUTTING NEWPIPE, OR ANY FORK OF IT, INTO THE GOOGLE PLAY STORE VIOLATES THEIR TERMS AND CONDITIONS.</b>

## Screenshots

[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_01.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_01.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_02.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_02.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_03.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_03.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_04.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_04.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_05.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_05.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_06.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_06.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_07.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_07.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_08.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_08.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_09.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_09.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/shot_10.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/shot_10.png)
[<img src="fastlane/metadata/android/en-US/images/tenInchScreenshots/shot_11.png" width=405>](fastlane/metadata/android/en-US/images/tenInchScreenshots/shot_11.png)
[<img src="fastlane/metadata/android/en-US/images/tenInchScreenshots/shot_12.png" width=405>](fastlane/metadata/android/en-US/images/tenInchScreenshots/shot_12.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/00.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/00.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/01.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/01.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/02.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/02.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/03.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/03.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/04.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/04.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/05.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/05.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/06.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/06.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/07.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/07.png)
[<img src="fastlane/metadata/android/en-US/images/phoneScreenshots/08.png" width=160>](fastlane/metadata/android/en-US/images/phoneScreenshots/08.png)
<br/><br/>
[<img src="fastlane/metadata/android/en-US/images/tenInchScreenshots/09.png" width=405>](fastlane/metadata/android/en-US/images/tenInchScreenshots/09.png)
[<img src="fastlane/metadata/android/en-US/images/tenInchScreenshots/10.png" width=405>](fastlane/metadata/android/en-US/images/tenInchScreenshots/10.png)

### Supported Services

Expand Down
Loading