From cf598dc3cbb29052e96e7d857a9a7fc70d1205fa Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 26 Mar 2022 21:20:41 +0100 Subject: [PATCH 1/3] Update extractor to latest dev-Version --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7ec17044e..259fe3a89 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -190,7 +190,7 @@ 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' - implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.14' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:5a1873084' /** Checkstyle **/ checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" From 102c05e92759ecfd896c192cb24401480e7138d9 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 26 Mar 2022 21:21:07 +0100 Subject: [PATCH 2/3] FIx breaking changes --- .../newpipe/fragments/detail/DescriptionFragment.java | 2 +- .../newpipe/settings/PeertubeInstanceListFragment.java | 2 +- .../java/us/shandian/giga/get/DownloadMissionRecover.java | 2 +- .../main/java/us/shandian/giga/get/MissionRecoveryInfo.kt | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java index 9b1bf121b..d57ddb02d 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/DescriptionFragment.java @@ -84,7 +84,7 @@ public class DescriptionFragment extends BaseFragment { private void setupDescription() { final Description description = streamInfo.getDescription(); if (description == null || isEmpty(description.getContent()) - || description == Description.emptyDescription) { + || description == Description.EMPTY_DESCRIPTION) { binding.detailDescriptionView.setVisibility(View.GONE); binding.detailSelectDescriptionButton.setVisibility(View.GONE); return; diff --git a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java index 5767d266f..c7eb0be40 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java @@ -185,7 +185,7 @@ public class PeertubeInstanceListFragment extends Fragment { .setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok, (dialog, which) -> { sharedPreferences.edit().remove(savedInstanceListKey).apply(); - selectInstance(PeertubeInstance.defaultInstance); + selectInstance(PeertubeInstance.DEFAULT_INSTANCE); updateInstanceList(); instanceListAdapter.notifyDataSetChanged(); }) diff --git a/app/src/main/java/us/shandian/giga/get/DownloadMissionRecover.java b/app/src/main/java/us/shandian/giga/get/DownloadMissionRecover.java index 5b2858aa2..90886b63c 100644 --- a/app/src/main/java/us/shandian/giga/get/DownloadMissionRecover.java +++ b/app/src/main/java/us/shandian/giga/get/DownloadMissionRecover.java @@ -132,7 +132,7 @@ public class DownloadMissionRecover extends Thread { switch (mRecovery.getKind()) { case 'a': for (AudioStream audio : mExtractor.getAudioStreams()) { - if (audio.average_bitrate == mRecovery.getDesiredBitrate() && audio.getFormat() == mRecovery.getFormat()) { + if (audio.getAverageBitrate() == mRecovery.getDesiredBitrate() && audio.getFormat() == mRecovery.getFormat()) { url = audio.getUrl(); break; } diff --git a/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt b/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt index 403eee0c7..11293a610 100644 --- a/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt +++ b/app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt @@ -21,13 +21,13 @@ class MissionRecoveryInfo( constructor(stream: Stream) : this(format = stream.getFormat()!!) { when (stream) { is AudioStream -> { - desiredBitrate = stream.average_bitrate + desiredBitrate = stream.averageBitrate isDesired2 = false kind = 'a' } is VideoStream -> { - desired = stream.getResolution() - isDesired2 = stream.isVideoOnly() + desired = stream.resolution + isDesired2 = stream.isVideoOnly kind = 'v' } is SubtitlesStream -> { From 93deaa568781a85934549c0427abb20f7c43e232 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sat, 26 Mar 2022 21:44:16 +0100 Subject: [PATCH 3/3] Fixed test compilation --- .../schabi/newpipe/util/ListHelperTest.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/app/src/test/java/org/schabi/newpipe/util/ListHelperTest.java b/app/src/test/java/org/schabi/newpipe/util/ListHelperTest.java index f72d08c13..531837ea2 100644 --- a/app/src/test/java/org/schabi/newpipe/util/ListHelperTest.java +++ b/app/src/test/java/org/schabi/newpipe/util/ListHelperTest.java @@ -199,17 +199,17 @@ public class ListHelperTest { public void getHighestQualityAudioFormatTest() { AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex( MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST)); - assertEquals(320, stream.average_bitrate); + assertEquals(320, stream.getAverageBitrate()); assertEquals(MediaFormat.M4A, stream.getFormat()); stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex( MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST)); - assertEquals(320, stream.average_bitrate); + assertEquals(320, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex( MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.MP3, stream.getFormat()); } @@ -227,7 +227,7 @@ public class ListHelperTest { // It should fallback to the highest bitrate audio no matter what format it is AudioStream stream = testList.get(ListHelper.getHighestQualityAudioIndex( MediaFormat.MP3, testList)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); //////////////////////////////////////////////////////// @@ -245,14 +245,14 @@ public class ListHelperTest { // List doesn't contains this format, it should fallback to the highest bitrate audio and // the highest quality format. stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.M4A, stream.getFormat()); // Adding a new format and bitrate. Adding another stream will have no impact since // it's not a preferred format. testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 192)); stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.M4A, stream.getFormat()); } @@ -266,17 +266,17 @@ public class ListHelperTest { public void getLowestQualityAudioFormatTest() { AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex( MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST)); - assertEquals(128, stream.average_bitrate); + assertEquals(128, stream.getAverageBitrate()); assertEquals(MediaFormat.M4A, stream.getFormat()); stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex( MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST)); - assertEquals(64, stream.average_bitrate); + assertEquals(64, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex( MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST)); - assertEquals(64, stream.average_bitrate); + assertEquals(64, stream.getAverageBitrate()); assertEquals(MediaFormat.MP3, stream.getFormat()); } @@ -294,13 +294,13 @@ public class ListHelperTest { // It should fallback to the most compact audio no matter what format it is. AudioStream stream = testList.get(ListHelper.getMostCompactAudioIndex( MediaFormat.MP3, testList)); - assertEquals(128, stream.average_bitrate); + assertEquals(128, stream.getAverageBitrate()); assertEquals(MediaFormat.M4A, stream.getFormat()); // WEBMA is more compact than M4A testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 128)); stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList)); - assertEquals(128, stream.average_bitrate); + assertEquals(128, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); //////////////////////////////////////////////////////// @@ -317,12 +317,12 @@ public class ListHelperTest { // List doesn't contain this format // It should fallback to the most compact audio no matter what format it is. stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); // Should be same as above stream = testList.get(ListHelper.getMostCompactAudioIndex(null, testList)); - assertEquals(192, stream.average_bitrate); + assertEquals(192, stream.getAverageBitrate()); assertEquals(MediaFormat.WEBMA, stream.getFormat()); }