mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-10-31 23:26:21 +00:00
further compatiblity fix for meadic.ccc
This commit is contained in:
parent
568cf9c259
commit
1ae54f6f8c
@ -57,7 +57,7 @@ dependencies {
|
|||||||
exclude module: 'support-annotations'
|
exclude module: 'support-annotations'
|
||||||
})
|
})
|
||||||
|
|
||||||
implementation 'com.github.TeamNewPipe:NewPipeExtractor:f7c7b9df1a'
|
implementation 'com.github.TeamNewPipe:NewPipeExtractor:73232a7ba'
|
||||||
|
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
testImplementation 'org.mockito:mockito-core:2.23.0'
|
testImplementation 'org.mockito:mockito-core:2.23.0'
|
||||||
|
@ -55,6 +55,7 @@ import org.schabi.newpipe.ReCaptchaActivity;
|
|||||||
import org.schabi.newpipe.download.DownloadDialog;
|
import org.schabi.newpipe.download.DownloadDialog;
|
||||||
import org.schabi.newpipe.extractor.InfoItem;
|
import org.schabi.newpipe.extractor.InfoItem;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.ServiceList;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
import org.schabi.newpipe.extractor.exceptions.ParsingException;
|
||||||
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
import org.schabi.newpipe.extractor.services.youtube.extractors.YoutubeStreamExtractor;
|
||||||
@ -699,13 +700,13 @@ public class VideoDetailFragment
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case R.id.menu_item_share: {
|
case R.id.menu_item_share: {
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
shareUrl(currentInfo.getName(), currentInfo.getUrl());
|
shareUrl(currentInfo.getName(), currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case R.id.menu_item_openInBrowser: {
|
case R.id.menu_item_openInBrowser: {
|
||||||
if (currentInfo != null) {
|
if (currentInfo != null) {
|
||||||
openUrlInBrowser(currentInfo.getUrl());
|
openUrlInBrowser(currentInfo.getOriginalUrl());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1269,10 +1270,18 @@ public class VideoDetailFragment
|
|||||||
|
|
||||||
downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog");
|
downloadDialog.show(activity.getSupportFragmentManager(), "downloadDialog");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Toast.makeText(activity,
|
ErrorActivity.ErrorInfo info = ErrorActivity.ErrorInfo.make(UserAction.UI_ERROR,
|
||||||
R.string.could_not_setup_download_menu,
|
ServiceList.all()
|
||||||
Toast.LENGTH_LONG).show();
|
.get(currentInfo
|
||||||
e.printStackTrace();
|
.getServiceId())
|
||||||
|
.getServiceInfo()
|
||||||
|
.getName(), "",
|
||||||
|
R.string.could_not_setup_download_menu);
|
||||||
|
|
||||||
|
ErrorActivity.reportError(getActivity(),
|
||||||
|
e,
|
||||||
|
getActivity().getClass(),
|
||||||
|
getActivity().findViewById(android.R.id.content), info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,10 +233,10 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo> {
|
|||||||
openRssFeed();
|
openRssFeed();
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_openInBrowser:
|
case R.id.menu_item_openInBrowser:
|
||||||
openUrlInBrowser(url);
|
openUrlInBrowser(currentInfo.getOriginalUrl());
|
||||||
break;
|
break;
|
||||||
case R.id.menu_item_share:
|
case R.id.menu_item_share:
|
||||||
shareUrl(name, url);
|
shareUrl(name, currentInfo.getOriginalUrl());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
@ -93,6 +93,7 @@ public class VideoPlaybackResolver implements PlaybackResolver {
|
|||||||
// Below are auxiliary media sources
|
// Below are auxiliary media sources
|
||||||
|
|
||||||
// Create subtitle sources
|
// Create subtitle sources
|
||||||
|
if(info.getSubtitles() != null) {
|
||||||
for (final SubtitlesStream subtitle : info.getSubtitles()) {
|
for (final SubtitlesStream subtitle : info.getSubtitles()) {
|
||||||
final String mimeType = PlayerHelper.subtitleMimeTypesOf(subtitle.getFormat());
|
final String mimeType = PlayerHelper.subtitleMimeTypesOf(subtitle.getFormat());
|
||||||
if (mimeType == null) continue;
|
if (mimeType == null) continue;
|
||||||
@ -103,6 +104,7 @@ public class VideoPlaybackResolver implements PlaybackResolver {
|
|||||||
.createMediaSource(Uri.parse(subtitle.getURL()), textFormat, TIME_UNSET);
|
.createMediaSource(Uri.parse(subtitle.getURL()), textFormat, TIME_UNSET);
|
||||||
mediaSources.add(textSource);
|
mediaSources.add(textSource);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mediaSources.size() == 1) {
|
if (mediaSources.size() == 1) {
|
||||||
return mediaSources.get(0);
|
return mediaSources.get(0);
|
||||||
|
@ -31,6 +31,7 @@ import org.schabi.newpipe.ReCaptchaActivity;
|
|||||||
import org.schabi.newpipe.extractor.Info;
|
import org.schabi.newpipe.extractor.Info;
|
||||||
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
|
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
|
import org.schabi.newpipe.extractor.SuggestionExtractor;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
import org.schabi.newpipe.extractor.channel.ChannelInfo;
|
||||||
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
|
||||||
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
|
||||||
@ -46,6 +47,7 @@ import org.schabi.newpipe.report.UserAction;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.Maybe;
|
import io.reactivex.Maybe;
|
||||||
@ -95,10 +97,13 @@ public final class ExtractorHelper {
|
|||||||
public static Single<List<String>> suggestionsFor(final int serviceId,
|
public static Single<List<String>> suggestionsFor(final int serviceId,
|
||||||
final String query) {
|
final String query) {
|
||||||
checkServiceId(serviceId);
|
checkServiceId(serviceId);
|
||||||
return Single.fromCallable(() ->
|
return Single.fromCallable(() -> {
|
||||||
NewPipe.getService(serviceId)
|
SuggestionExtractor extractor = NewPipe.getService(serviceId)
|
||||||
.getSuggestionExtractor()
|
.getSuggestionExtractor();
|
||||||
.suggestionList(query));
|
return extractor != null
|
||||||
|
? extractor.suggestionList(query)
|
||||||
|
: Collections.emptyList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Single<StreamInfo> getStreamInfo(final int serviceId,
|
public static Single<StreamInfo> getStreamInfo(final int serviceId,
|
||||||
|
@ -28,7 +28,8 @@ import io.reactivex.schedulers.Schedulers;
|
|||||||
import us.shandian.giga.util.Utility;
|
import us.shandian.giga.util.Utility;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list adapter for a list of {@link Stream streams}, currently supporting {@link VideoStream} and {@link AudioStream}.
|
* A list adapter for a list of {@link Stream streams},
|
||||||
|
* currently supporting {@link VideoStream}, {@link AudioStream} and {@link SubtitlesStream}
|
||||||
*/
|
*/
|
||||||
public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseAdapter {
|
public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseAdapter {
|
||||||
private final Context context;
|
private final Context context;
|
||||||
@ -110,7 +111,10 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (stream instanceof AudioStream) {
|
} else if (stream instanceof AudioStream) {
|
||||||
qualityString = ((AudioStream) stream).getAverageBitrate() + "kbps";
|
AudioStream audioStream = ((AudioStream) stream);
|
||||||
|
qualityString = audioStream.getAverageBitrate() > 0
|
||||||
|
? audioStream.getAverageBitrate() + "kbps"
|
||||||
|
: audioStream.getFormat().getName();
|
||||||
} else if (stream instanceof SubtitlesStream) {
|
} else if (stream instanceof SubtitlesStream) {
|
||||||
qualityString = ((SubtitlesStream) stream).getDisplayLanguageName();
|
qualityString = ((SubtitlesStream) stream).getDisplayLanguageName();
|
||||||
if (((SubtitlesStream) stream).isAutoGenerated()) {
|
if (((SubtitlesStream) stream).isAutoGenerated()) {
|
||||||
@ -154,8 +158,10 @@ public class StreamItemAdapter<T extends Stream, U extends Stream> extends BaseA
|
|||||||
private final long[] streamSizes;
|
private final long[] streamSizes;
|
||||||
private final String unknownSize;
|
private final String unknownSize;
|
||||||
|
|
||||||
public StreamSizeWrapper(List<T> streamsList, Context context) {
|
public StreamSizeWrapper(List<T> sL, Context context) {
|
||||||
this.streamsList = streamsList;
|
this.streamsList = sL != null
|
||||||
|
? sL
|
||||||
|
: Collections.emptyList();
|
||||||
this.streamSizes = new long[streamsList.size()];
|
this.streamSizes = new long[streamsList.size()];
|
||||||
this.unknownSize = context == null ? "--.-" : context.getString(R.string.unknown_content);
|
this.unknownSize = context == null ? "--.-" : context.getString(R.string.unknown_content);
|
||||||
|
|
||||||
|
@ -22,4 +22,15 @@
|
|||||||
<color name="dark_soundcloud_accent_color">#FFFFFF</color>
|
<color name="dark_soundcloud_accent_color">#FFFFFF</color>
|
||||||
<color name="dark_soundcloud_statusbar_color">#ff9100</color>
|
<color name="dark_soundcloud_statusbar_color">#ff9100</color>
|
||||||
|
|
||||||
|
<!-- MediaCCC -->
|
||||||
|
<color name="light_mediaccc_primary_color">#888888</color>
|
||||||
|
<color name="light_mediaccc_dark_color">#555555</color>
|
||||||
|
<color name="light_mediaccc_accent_color">#000000</color>
|
||||||
|
<color name="light_mediaccc_statusbar_color">#777777</color>
|
||||||
|
|
||||||
|
<color name="dark_mediaccc_primary_color">#888888</color>
|
||||||
|
<color name="dark_mediaccc_dark_color">#555555</color>
|
||||||
|
<color name="dark_mediaccc_accent_color">#FFFFFF</color>
|
||||||
|
<color name="dark_mediaccc_statusbar_color">#777777</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user