fixed bug regarding channels

acual fix
This commit is contained in:
Christian Schabesberger 2016-09-14 00:22:55 +02:00
parent 39ff1cd898
commit b8a0801786
3 changed files with 12 additions and 5 deletions

View File

@ -218,7 +218,7 @@ public class ChannelActivity extends AppCompatActivity {
View rootView = findViewById(android.R.id.content); View rootView = findViewById(android.R.id.content);
ErrorActivity.reportError(h, ChannelActivity.this, ErrorActivity.reportError(h, ChannelActivity.this,
info.errors, null, rootView, info.errors, null, rootView,
ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL,
service.getServiceInfo().name, channelUrl, 0 /* no message for the user */)); service.getServiceInfo().name, channelUrl, 0 /* no message for the user */));
} }
} catch(IOException ioe) { } catch(IOException ioe) {
@ -226,7 +226,7 @@ public class ChannelActivity extends AppCompatActivity {
ioe.printStackTrace(); ioe.printStackTrace();
} catch(ParsingException pe) { } catch(ParsingException pe) {
ErrorActivity.reportError(h, ChannelActivity.this, pe, VideoItemDetailFragment.class, null, ErrorActivity.reportError(h, ChannelActivity.this, pe, VideoItemDetailFragment.class, null,
ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL,
service.getServiceInfo().name, channelUrl, R.string.parsing_error)); service.getServiceInfo().name, channelUrl, R.string.parsing_error));
h.post(new Runnable() { h.post(new Runnable() {
@Override @Override
@ -237,7 +237,7 @@ public class ChannelActivity extends AppCompatActivity {
pe.printStackTrace(); pe.printStackTrace();
} catch(ExtractionException ex) { } catch(ExtractionException ex) {
ErrorActivity.reportError(h, ChannelActivity.this, ex, VideoItemDetailFragment.class, null, ErrorActivity.reportError(h, ChannelActivity.this, ex, VideoItemDetailFragment.class, null,
ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL,
service.getServiceInfo().name, channelUrl, R.string.parsing_error)); service.getServiceInfo().name, channelUrl, R.string.parsing_error));
h.post(new Runnable() { h.post(new Runnable() {
@Override @Override
@ -248,7 +248,7 @@ public class ChannelActivity extends AppCompatActivity {
ex.printStackTrace(); ex.printStackTrace();
} catch(Exception e) { } catch(Exception e) {
ErrorActivity.reportError(h, ChannelActivity.this, e, VideoItemDetailFragment.class, null, ErrorActivity.reportError(h, ChannelActivity.this, e, VideoItemDetailFragment.class, null,
ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_STREAM, ErrorActivity.ErrorInfo.make(ErrorActivity.REQUESTED_CHANNEL,
service.getServiceInfo().name, channelUrl, R.string.general_error)); service.getServiceInfo().name, channelUrl, R.string.general_error));
h.post(new Runnable() { h.post(new Runnable() {
@Override @Override

View File

@ -297,6 +297,10 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
@Override @Override
public String getFeedUrl() throws ParsingException { public String getFeedUrl() throws ParsingException {
try { try {
if(userUrl.contains("channel")) {
//channels don't have feeds in youtube, only user can provide such
return "";
}
if(!isAjaxPage) { if(!isAjaxPage) {
feedUrl = doc.select("link[title=\"RSS\"]").first().attr("abs:href"); feedUrl = doc.select("link[title=\"RSS\"]").first().attr("abs:href");
} }

View File

@ -132,6 +132,7 @@ public class ErrorActivity extends AppCompatActivity {
public static final int USER_REPORT = 4; public static final int USER_REPORT = 4;
public static final int LOAD_IMAGE = 5; public static final int LOAD_IMAGE = 5;
public static final int UI_ERROR = 6; public static final int UI_ERROR = 6;
public static final int REQUESTED_CHANNEL = 7;
// MESSAGE STRING // MESSAGE STRING
public static final String SEARCHED_STRING = "searched"; public static final String SEARCHED_STRING = "searched";
@ -141,7 +142,7 @@ public class ErrorActivity extends AppCompatActivity {
public static final String USER_REPORT_STRING = "user report"; public static final String USER_REPORT_STRING = "user report";
public static final String LOAD_IMAGE_STRING = "load image"; public static final String LOAD_IMAGE_STRING = "load image";
public static final String UI_ERROR_STRING = "ui error"; public static final String UI_ERROR_STRING = "ui error";
public static final String REQUESTED_CHANNEL_STRING = "requested channel";
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org"; public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
public static final String ERROR_EMAIL_SUBJECT = "Exception in NewPipe " + BuildConfig.VERSION_NAME; public static final String ERROR_EMAIL_SUBJECT = "Exception in NewPipe " + BuildConfig.VERSION_NAME;
@ -426,6 +427,8 @@ public class ErrorActivity extends AppCompatActivity {
return LOAD_IMAGE_STRING; return LOAD_IMAGE_STRING;
case UI_ERROR: case UI_ERROR:
return UI_ERROR_STRING; return UI_ERROR_STRING;
case REQUESTED_CHANNEL:
return REQUESTED_CHANNEL_STRING;
default: default:
return "Your description is in another castle."; return "Your description is in another castle.";
} }