示例#1
0
 public static void run(int start_page, int end_page) {
   if (start_page < 1 || end_page < 1) {
     Main.status("start_page and end_page must be integers >= 1");
     return;
   }
   int progress = 0;
   if (gui != null) {
     gui.setProgress(progress);
   }
   if (end_page >= start_page) {
     if (gui != null) {
       gui.setMaxProgress(end_page - start_page);
     }
     for (int i = start_page; i <= end_page; i++) {
       boolean exists =
           Main.handleURL(String.format("http://%s.tumblr.com/page/%s", Main.blogname, i));
       if (!exists) {
         Main.status(String.format("We ran out of posts to process at page %s.", i));
         break;
       }
       if (gui != null) {
         gui.setProgress(progress);
         progress++;
       }
     }
   } else {
     if (gui != null) {
       gui.setMaxProgress(start_page - end_page);
     }
     for (int i = start_page; i >= end_page; i--) {
       boolean exists =
           Main.handleURL(String.format("http://%s.tumblr.com/page/%s", Main.blogname, i));
       if (!exists) {
         Main.status(String.format("We ran out of posts to process at page %s.", i));
         break;
       }
       if (gui != null) {
         gui.setProgress(progress);
         progress++;
       }
     }
   }
   if (gui != null) {
     gui.setProgress(progress);
   }
   Main.writeDuplicates();
 }
示例#2
0
 public static void downloadHiRes() {
   Main.status("Downloading hi res versions of photos in database.");
   if (gui != null) {
     gui.setProgress(0);
     gui.setMaxProgress(pic_pic_hash.keySet().size());
   }
   int progress = 0;
   for (Picture picture : pic_pic_hash.keySet()) {
     if (!picture.downloaded_hi) {
       tryResUrls(picture);
     }
     if (gui != null) {
       gui.setProgress(progress);
       progress++;
     }
   }
   if (gui != null) {
     gui.setProgress(progress);
     progress++;
   }
   Main.status("Done downloading hi res versions.");
 }