Skip to content
This repository has been archived by the owner on Apr 3, 2022. It is now read-only.

Commit

Permalink
Added code that should detect if YouTube has decided to temporary block
Browse files Browse the repository at this point in the history
the user from uploading videos. (Uploaded to much in a short amount of time,
should only last between a few hours and a few days I think.)
  • Loading branch information
Stekeblad committed Jun 11, 2020
1 parent 4f1dace commit 1c984f6
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -912,10 +912,25 @@ private void onUploadErred(VideoUpload video, Throwable e) {
AlertUtils.simpleClose(header, transBasic.getString("app_name") + " has reached its daily upload limit" +
" in the YouTube API and can not continue the uploading. All scheduled uploads has been aborted.\n\n" +
"The limit will be reset at midnight Pacific Time. (" + userClockAtPacificMidnight + " in your timezone.)").show();
} else { // exception and video parameter available and its not a dailyLimitExceeded error
} else if (e.getMessage() != null && e.getMessage().contains("uploadLimitExceeded")) {
// abort all scheduled uploads, they will all fail with this error
bypassAbortWarning = true;
for (String key : uploader.getUploadQueue()) {
uploader.abortUpload((key));
onAbort(key + "_fakeButton");
}
bypassAbortWarning = false;
AlertUtils.simpleClose(header, "You have reached your personal upload limit on YouTube" +
" and you can not upload more videos right now. All scheduled uploads has been aborted.\n\n" +
"Wait a few hours or retry again tomorrow").show();
} else { // exception and video parameter available but it does not match one of the above cases
AlertUtils.exceptionDialog(header, "Failed to upload the video \"" + video.getVideoName() + "\"", e);
}


// handle more errors: https://developers.google.com/youtube/v3/docs/errors


//Switch to a reset upload button instead of abort for the upload that threw the error
if (video != null) {
video.setProgressBarColor("red");
Expand Down

0 comments on commit 1c984f6

Please sign in to comment.