diff --git a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java index 48afa06df..a58182a5e 100644 --- a/app/src/main/java/org/schabi/newpipe/ChannelActivity.java +++ b/app/src/main/java/org/schabi/newpipe/ChannelActivity.java @@ -166,8 +166,9 @@ public class ChannelActivity extends AppCompatActivity { @Override public void run() { + StreamingService service = null; try { - StreamingService service = ServiceList.getService(serviceId); + service = ServiceList.getService(serviceId); ChannelExtractor extractor = service.getChannelExtractorInstance( channelUrl, pageNumber, new Downloader()); @@ -194,15 +195,48 @@ public class ChannelActivity extends AppCompatActivity { e.printStackTrace(); Log.e(TAG, "------"); } + + View rootView = findViewById(android.R.id.content); + ErrorActivity.reportError(h, ChannelActivity.this, + info.errors, null, rootView, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + service.getServiceInfo().name, channelUrl, 0 /* no message for the user */)); } } catch(IOException ioe) { postNewErrorToast(h, R.string.network_error); ioe.printStackTrace(); } catch(ParsingException pe) { + ErrorActivity.reportError(h, ChannelActivity.this, pe, VideoItemDetailFragment.class, null, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + service.getServiceInfo().name, channelUrl, R.string.parsing_error)); + h.post(new Runnable() { + @Override + public void run() { + ChannelActivity.this.finish(); + } + }); pe.printStackTrace(); } catch(ExtractionException ex) { + ErrorActivity.reportError(h, ChannelActivity.this, ex, VideoItemDetailFragment.class, null, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + service.getServiceInfo().name, channelUrl, R.string.parsing_error)); + h.post(new Runnable() { + @Override + public void run() { + ChannelActivity.this.finish(); + } + }); ex.printStackTrace(); } catch(Exception e) { + ErrorActivity.reportError(h, ChannelActivity.this, e, VideoItemDetailFragment.class, null, + ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, + service.getServiceInfo().name, channelUrl, R.string.general_error)); + h.post(new Runnable() { + @Override + public void run() { + ChannelActivity.this.finish(); + } + }); e.printStackTrace(); } } diff --git a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java index d3b063b12..03178f9d1 100644 --- a/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java +++ b/app/src/main/java/org/schabi/newpipe/detail/StreamInfoWorker.java @@ -33,27 +33,6 @@ public class StreamInfoWorker { void onContentError(); } - private class StreamResultReturnedRunnable implements Runnable { - private final StreamInfo streamInfo; - public StreamResultReturnedRunnable(StreamInfo streamInfo) { - this.streamInfo = streamInfo; - } - @Override - public void run() { - /* - if(a != null) { - boolean showAgeRestrictedContent = PreferenceManager.getDefaultSharedPreferences(a) - .getBoolean(activity.getString(R.string.show_age_restricted_content), false); - if (streamInfo.age_limit == 0 || showAgeRestrictedContent) { - updateInfo(streamInfo); - } else { - onNotSpecifiedContentErrorWithMessage(R.string.video_is_age_restricted); - } - } - */ - } - } - private class StreamExtractorRunnable implements Runnable { private final Handler h = new Handler(); private StreamExtractor streamExtractor;