Stekeblad / Stekeblads-Video-Uploader

Easier bulk-uploading to Youtube
MIT License
31 stars 13 forks source link

How can i disable error dialog boxes in code? #9

Closed journeym closed 4 years ago

journeym commented 4 years ago

Im uploading large amount of files, and all that hit the quota get popup with upload failed exception. How to disable that with not much effort involved?

Stekeblad commented 4 years ago

I'm sorry. but there is no option to disable popups, the only thing you can do right now is probably not to queue too many uploads at once to reduce the number of popups.

It is a good idea to abort all uploads if the program notices the limit has been reach and only display one warning instead of one per video.

I do not think I ever seen how that error looks like, if you please can share the full error here I should be able to add code to handle it and get rid of the extra popups.

journeym commented 4 years ago

image

`Failed to upload the video "Ммарло - Компас" Here is the error details:

403 Forbidden { "code" : 403, "errors" : [ { "domain" : "usageLimits", "message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308", "reason" : "dailyLimitExceeded", "extendedHelp" : "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308" } ], "message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308" }

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "usageLimits", "message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308", "reason" : "dailyLimitExceeded", "extendedHelp" : "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308" } ], "message" : "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=357246313308" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:150) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113) at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:554) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:474) at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:591) at io.github.stekeblad.videouploader.youtube.Uploader.upload(Uploader.java:258) at io.github.stekeblad.videouploader.youtube.Uploader.access$000(Uploader.java:39) at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:132) at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:126) at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) `

journeym commented 4 years ago

Yeah i know there is no such option. Im just unfamiliar with java, and were unable to find where is the popup called.

Stekeblad commented 4 years ago

There are several steps to get from the stacktrace to where the popup is created, following them you end up at the bottom of the mainWindowController. Are you familiar with other programming languages and curious on how it got there?

journeym commented 4 years ago

Thanks! Now im unable to build the app under windows / latest jdk when i run gradlew build, it asks for mainClassName `FAILURE: Build failed with an exception.

if i supply some random mainClassName, then it builds, but after that, when i run gradlew run, it says Error: Could not find or load main class SomeClassName

Stekeblad commented 4 years ago

By "latest jdk", do you mean the latest version of JDK 8? Other versions of Java is currently not supported.

The name of the main class is "Main" and located in src/main/java/io/github/stekeblad/videouploader/main/Main.java

I am sorry but I do not know much about gradle and can not give more detailed help on your error, I only use gradle for dependencies.

journeym commented 4 years ago

Using that class name gets the same result. Then how do you compile this code? Are you using some IDE? Thats the first java code im trying to compile, so i presume im just doing something wrong.

Stekeblad commented 4 years ago

I am using IntelliJ (the Community edition is free)

journeym commented 4 years ago

All right, ill try it out, thanks.

journeym commented 4 years ago

All right, just cloning your project, building it in idea and then selecting build artifacts (everything goes smoothly w/o error) gives me a jar file in out\artifacts\videouploader_main_jar directory, but with significantly lesser size than yours (mine about 169kb). And it doesn't run. seems i dont have the required java dev. experience for quickly fixing that problem.

Stekeblad commented 4 years ago

Its easier to run the code from inside IntelliJ, I had to spend hours on my build script to create the fix for version 1.3.1.

Go to Run --> Edit configurations and create an "Application" configuration and create a configuration like the one in the image. image

I think that is enough. If you have all the gradle files and the code compiles you should be able to select the configuration in the top right and click on run. With a run configuration you will also be able to run the code in debug mode and set breakpoints.

Please note that you will not be able to do anything that involves YouTube when working with the code, it will always fail in or around Auth.authUser(); because it requires a secret key that is not included in git. You need to work around it, for the failure popup you could use the debug code already added in the top of the Uploader.upload() method in some way.

journeym commented 4 years ago

Now im able to run, and just comment out the popup, great. But true, upload isnt working, as well as $(rawname) resolution in preset Upload faiure doesnt mention authuser Stacktrace looks like this

`Failed to upload the video "ttt" Here is the error details:

null

java.lang.NullPointerException at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:135) at io.github.stekeblad.videouploader.youtube.Uploader$1.call(Uploader.java:126) at javafx.concurrent.Task$TaskCallable.call(Task.java:1423) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) `

Stekeblad commented 4 years ago

Looking at your stacktrace and assuming the first lines looks the same for as in the latest commit: Uploader.java:135 looks like this: if (! e.getMessage().equals("INTERRUPTED")) and is inside the catch block of a try-catch. I think its highly unlikely e is null so that would mean that e.getMessage() returns null.

Did you add a line like throw new Exception(); in the upload method? I just tried and got the same type of error if I throw an exception without a message, throw the exception like this instead: throw new Exception("My helpful exception message");

journeym commented 4 years ago

I haven't added or modified anything, i just created run config according to your instruction, and ran the application. I have copied VideoUploader folder to compiled application folder, form the original jar application location (to get my preset). Then, i noticed, that $(rawname) is not resolving, and trying to upload results in the above error. I also tried to create new preset with static track name, to make sure that $(rawname) resolution doesn't impact upload, and got the same result.

Can you please compile a new version for me with commented out AlertUtils.exceptionDialog (879 in mainWindowController.java)?

Stekeblad commented 4 years ago

Hi journeym and sorry for the waiting.

I have just uploaded version 1.3.2 that should only show one exception dialog if the quota limit is reached. I have however not been able to test it on the real exception, only by trying to fake it.

journeym commented 4 years ago

Actually, this even got worse. Now it shows 2 errors for every failed upload ;) image image

journeym commented 4 years ago

Can you please write a bit about how to compile that under any distro. Release version, pref.

Stekeblad commented 4 years ago

The left error for the quota is easily fixed, but I can not see the entire error message for the right error. If you see it again, please update with the entire error message.

I am happy to accept pull requests and include them in future releases, but I can not help you with creating a release on your computer as the process includes secrets between me and YouTube that make YouTube recognise the program as Stekeblads Video Uploader and not any other program that connects to the API.