Skip to content

Commit

Permalink
Merge pull request #8115 from litetex/update-newpipe-extractor
Browse files Browse the repository at this point in the history
Update NewpipeExtractor
  • Loading branch information
Stypox authored Apr 1, 2022
2 parents 1ecb0ca + 93deaa5 commit ac00c8f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void setupUploadDate() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private void restoreDefaults() {
.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();
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void resolveStream() throws IOException, ExtractionException, HttpError
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;
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/us/shandian/giga/get/MissionRecoveryInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down
26 changes: 13 additions & 13 deletions app/src/test/java/org/schabi/newpipe/util/ListHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ public void getDefaultResolutionTest() {
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());
}

Expand All @@ -227,7 +227,7 @@ public void getHighestQualityAudioFormatPreferredAbsent() {
// 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());

////////////////////////////////////////////////////////
Expand All @@ -245,14 +245,14 @@ public void getHighestQualityAudioFormatPreferredAbsent() {
// 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());
}

Expand All @@ -266,17 +266,17 @@ public void getHighestQualityAudioNull() {
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());
}

Expand All @@ -294,13 +294,13 @@ public void getLowestQualityAudioFormatPreferredAbsent() {
// 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());

////////////////////////////////////////////////////////
Expand All @@ -317,12 +317,12 @@ public void getLowestQualityAudioFormatPreferredAbsent() {
// 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());
}

Expand Down

0 comments on commit ac00c8f

Please sign in to comment.