Beispiel #1
0
 private void setupComponents() {
   captchan.setup();
   reCaptcha.setup();
 }
Beispiel #2
0
  private void work() {
    firstTasks();

    while (workingOn < files.length) {
      allowPause();

      if (isBroken) {
        // If the user broke the process, exit
        updateFiles(workingOn);
        break;
      }

      String result;
      try {
        log("Uploading " + (workingOn + 1));
        log(":" + files[workingOn].getName());

        result = upload();
      } catch (UploadFailException e) {
        log("Upload failed");
        continue;
      } catch (BadCaptchaException e) {
        log("Mistyped captcha");
        reCaptcha.newChallenge();
        solveCaptchas();
        continue;
      } catch (FileTooLargeException e) {
        log("File too large; skipping");
        log(": File size is " + files[workingOn].length());
        workingOn++;
        continue;
      } catch (MaliciousFileException e) {
        log("Malicious file");
        continue;
      } catch (FloodException e) {
        log("Flood detected");
        int interval = Integer.parseInt(captchan.tfSeconds.getText());
        interval += interval / 2;
        captchan.tfSeconds.setText(Integer.toString(interval));
        sleep();
        continue;
      } catch (MaxLimitException e) {
        log("Max Limit");
        isBroken = true;
        continue;
      } catch (Error404Exception e) {
        log("404");
        isBroken = true;
        continue;
      } catch (UploadException e) {
        log("Error");
        System.err.println("Unknown upload error");
        isBroken = true;
        continue;
      } catch (IOException e) {
        log("Error posting");
        isBroken = true;
        continue;
      }

      boolean isFirstFile = (workingOn == 0);
      boolean isThreadSpecified = (!captchan.tfThread.getText().equals(""));
      if (isFirstFile && !isThreadSpecified) getResourceThread(result);

      clearCommentArea();
      log("Success");

      boolean isLastFile = (workingOn == files.length - 1);
      if (isLastFile) {
        log("Complete");
        break; // don't bother sleeping for the last file
      }

      sleep();

      workingOn++; // If successful, work on the next file
    }
    done();
  }