Merge pull request #8115 from litetex/update-newpipe-extractor

Update NewpipeExtractor
This commit is contained in:
Stypox 2022-04-01 10:50:39 +02:00 committed by GitHub
commit ac00c8f6ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 20 deletions

View File

@ -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}"

View File

@ -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;

View File

@ -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();
})

View File

@ -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;
}

View File

@ -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 -> {

View File

@ -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());
}