/** * Attempts to transfer an enwp file to Commons * * @return True on success. */ protected boolean doTransfer() { try { root = ParsedItem.parse(enwp, wpFN); imgInfoL = enwp.getImageInfo(wpFN); uploader = imgInfoL.get(imgInfoL.size() - 1).user; procText(); String t = gen(); if (mtc.dryRun) { System.out.println(t); return true; } else if (t != null && Toolbox.downloadFile(imgInfoL.get(0).url, localFN) && com.upload(Paths.get(localFN), comFN, t, String.format(Config.tFrom, wpFN))) return enwp.edit( wpFN, String.format("{{subst:ncd|%s|reviewer=%s}}%n", comFN, enwp.whoami()) + enwp.getPageText(wpFN).replaceAll(mtc.mtcRegex, ""), Config.tTo); } catch (Throwable e) { e.printStackTrace(); } return false; }