mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Merge pull request #8115 from litetex/update-newpipe-extractor
Update NewpipeExtractor
This commit is contained in:
commit
ac00c8f6ae
@ -190,7 +190,7 @@ dependencies {
|
|||||||
// name and the commit hash with the commit hash of the (pushed) commit you want to test
|
// 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/
|
// This works thanks to JitPack: https://jitpack.io/
|
||||||
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
|
implementation 'com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751'
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:v0.21.14'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:5a1873084'
|
||||||
|
|
||||||
/** Checkstyle **/
|
/** Checkstyle **/
|
||||||
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}"
|
||||||
|
@ -84,7 +84,7 @@ public class DescriptionFragment extends BaseFragment {
|
|||||||
private void setupDescription() {
|
private void setupDescription() {
|
||||||
final Description description = streamInfo.getDescription();
|
final Description description = streamInfo.getDescription();
|
||||||
if (description == null || isEmpty(description.getContent())
|
if (description == null || isEmpty(description.getContent())
|
||||||
|| description == Description.emptyDescription) {
|
|| description == Description.EMPTY_DESCRIPTION) {
|
||||||
binding.detailDescriptionView.setVisibility(View.GONE);
|
binding.detailDescriptionView.setVisibility(View.GONE);
|
||||||
binding.detailSelectDescriptionButton.setVisibility(View.GONE);
|
binding.detailSelectDescriptionButton.setVisibility(View.GONE);
|
||||||
return;
|
return;
|
||||||
|
@ -185,7 +185,7 @@ public class PeertubeInstanceListFragment extends Fragment {
|
|||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
.setPositiveButton(R.string.ok, (dialog, which) -> {
|
||||||
sharedPreferences.edit().remove(savedInstanceListKey).apply();
|
sharedPreferences.edit().remove(savedInstanceListKey).apply();
|
||||||
selectInstance(PeertubeInstance.defaultInstance);
|
selectInstance(PeertubeInstance.DEFAULT_INSTANCE);
|
||||||
updateInstanceList();
|
updateInstanceList();
|
||||||
instanceListAdapter.notifyDataSetChanged();
|
instanceListAdapter.notifyDataSetChanged();
|
||||||
})
|
})
|
||||||
|
@ -132,7 +132,7 @@ public class DownloadMissionRecover extends Thread {
|
|||||||
switch (mRecovery.getKind()) {
|
switch (mRecovery.getKind()) {
|
||||||
case 'a':
|
case 'a':
|
||||||
for (AudioStream audio : mExtractor.getAudioStreams()) {
|
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();
|
url = audio.getUrl();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,13 +21,13 @@ class MissionRecoveryInfo(
|
|||||||
constructor(stream: Stream) : this(format = stream.getFormat()!!) {
|
constructor(stream: Stream) : this(format = stream.getFormat()!!) {
|
||||||
when (stream) {
|
when (stream) {
|
||||||
is AudioStream -> {
|
is AudioStream -> {
|
||||||
desiredBitrate = stream.average_bitrate
|
desiredBitrate = stream.averageBitrate
|
||||||
isDesired2 = false
|
isDesired2 = false
|
||||||
kind = 'a'
|
kind = 'a'
|
||||||
}
|
}
|
||||||
is VideoStream -> {
|
is VideoStream -> {
|
||||||
desired = stream.getResolution()
|
desired = stream.resolution
|
||||||
isDesired2 = stream.isVideoOnly()
|
isDesired2 = stream.isVideoOnly
|
||||||
kind = 'v'
|
kind = 'v'
|
||||||
}
|
}
|
||||||
is SubtitlesStream -> {
|
is SubtitlesStream -> {
|
||||||
|
@ -199,17 +199,17 @@ public class ListHelperTest {
|
|||||||
public void getHighestQualityAudioFormatTest() {
|
public void getHighestQualityAudioFormatTest() {
|
||||||
AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
||||||
MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(320, stream.average_bitrate);
|
assertEquals(320, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||||
|
|
||||||
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
||||||
MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(320, stream.average_bitrate);
|
assertEquals(320, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
||||||
|
|
||||||
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getHighestQualityAudioIndex(
|
||||||
MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.MP3, stream.getFormat());
|
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
|
// It should fallback to the highest bitrate audio no matter what format it is
|
||||||
AudioStream stream = testList.get(ListHelper.getHighestQualityAudioIndex(
|
AudioStream stream = testList.get(ListHelper.getHighestQualityAudioIndex(
|
||||||
MediaFormat.MP3, testList));
|
MediaFormat.MP3, testList));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
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
|
// List doesn't contains this format, it should fallback to the highest bitrate audio and
|
||||||
// the highest quality format.
|
// the highest quality format.
|
||||||
stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList));
|
stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||||
|
|
||||||
// Adding a new format and bitrate. Adding another stream will have no impact since
|
// Adding a new format and bitrate. Adding another stream will have no impact since
|
||||||
// it's not a preferred format.
|
// it's not a preferred format.
|
||||||
testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 192));
|
testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 192));
|
||||||
stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList));
|
stream = testList.get(ListHelper.getHighestQualityAudioIndex(MediaFormat.MP3, testList));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,17 +266,17 @@ public class ListHelperTest {
|
|||||||
public void getLowestQualityAudioFormatTest() {
|
public void getLowestQualityAudioFormatTest() {
|
||||||
AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
AudioStream stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
||||||
MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.M4A, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(128, stream.average_bitrate);
|
assertEquals(128, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||||
|
|
||||||
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
||||||
MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.WEBMA, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(64, stream.average_bitrate);
|
assertEquals(64, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
||||||
|
|
||||||
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
stream = AUDIO_STREAMS_TEST_LIST.get(ListHelper.getMostCompactAudioIndex(
|
||||||
MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST));
|
MediaFormat.MP3, AUDIO_STREAMS_TEST_LIST));
|
||||||
assertEquals(64, stream.average_bitrate);
|
assertEquals(64, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.MP3, stream.getFormat());
|
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.
|
// It should fallback to the most compact audio no matter what format it is.
|
||||||
AudioStream stream = testList.get(ListHelper.getMostCompactAudioIndex(
|
AudioStream stream = testList.get(ListHelper.getMostCompactAudioIndex(
|
||||||
MediaFormat.MP3, testList));
|
MediaFormat.MP3, testList));
|
||||||
assertEquals(128, stream.average_bitrate);
|
assertEquals(128, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.M4A, stream.getFormat());
|
assertEquals(MediaFormat.M4A, stream.getFormat());
|
||||||
|
|
||||||
// WEBMA is more compact than M4A
|
// WEBMA is more compact than M4A
|
||||||
testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 128));
|
testList.add(new AudioStream("", MediaFormat.WEBMA, /**/ 128));
|
||||||
stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList));
|
stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList));
|
||||||
assertEquals(128, stream.average_bitrate);
|
assertEquals(128, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
||||||
|
|
||||||
////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////
|
||||||
@ -317,12 +317,12 @@ public class ListHelperTest {
|
|||||||
// List doesn't contain this format
|
// List doesn't contain this format
|
||||||
// It should fallback to the most compact audio no matter what format it is.
|
// It should fallback to the most compact audio no matter what format it is.
|
||||||
stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList));
|
stream = testList.get(ListHelper.getMostCompactAudioIndex(MediaFormat.MP3, testList));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
||||||
|
|
||||||
// Should be same as above
|
// Should be same as above
|
||||||
stream = testList.get(ListHelper.getMostCompactAudioIndex(null, testList));
|
stream = testList.get(ListHelper.getMostCompactAudioIndex(null, testList));
|
||||||
assertEquals(192, stream.average_bitrate);
|
assertEquals(192, stream.getAverageBitrate());
|
||||||
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
assertEquals(MediaFormat.WEBMA, stream.getFormat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user