From 54b0632b80fa71a774479f76c295d42196edcdf9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 19 May 2012 13:03:19 +0200 Subject: [PATCH] Update googlecode upload --- .../src/net/osmand/data/index/IndexUploader.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/DataExtractionOSM/src/net/osmand/data/index/IndexUploader.java b/DataExtractionOSM/src/net/osmand/data/index/IndexUploader.java index 9934f06d09..b05e89459b 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/IndexUploader.java +++ b/DataExtractionOSM/src/net/osmand/data/index/IndexUploader.java @@ -14,6 +14,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.Enumeration; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; @@ -556,6 +557,7 @@ public class IndexUploader { public static class UploadToGoogleCodeCredentials extends UploadCredentials { GooglecodeUploadTokens ggtokens; String gpassword; + private Map uploaded = new HashMap(); @Override protected void parseParameter(String param) throws IndexUploadException { @@ -579,12 +581,23 @@ public class IndexUploader { if (ggtokens == null || user == null || password == null) { throw new IndexUploadException("Not enought googlecode credentials entered!"); } + Map uploadedDes = DownloaderIndexFromGoogleCode.getIndexFiles(new HashMap()); + for(String fileName : uploadedDes.keySet()) { + String description = uploadedDes.get(fileName); + int o = description.indexOf('{'); + if(o != -1 && description.length() > o + 11) { + uploaded.put(fileName, description.substring(o+1, o+11)); + } + } } @Override public void upload(IndexUploader uploader, File toUpload, String summary, String size, String date) throws IOException, JSchException { + if (uploaded.containsKey(toUpload.getName()) && date.equals(uploaded.get(toUpload.getName()))) { + return; + } String descriptionFile = "{" + date + " : " + size + " MB}"; summary += " " + descriptionFile; @@ -592,6 +605,9 @@ public class IndexUploader { try { splittedFiles = uploader.splitFiles(toUpload); for (File fs : splittedFiles) { + if (uploaded.containsKey(fs.getName()) && date.equals(uploaded.get(fs.getName()))) { + return; + } uploader.uploadToGoogleCode(fs, summary, this); } } finally {