Skip to content

Commit fa997ec

Browse files
author
Valentin BAIZEAU
committed
Jumped to version 1.0 - See README.md for further details
1 parent 2dab590 commit fa997ec

50 files changed

Lines changed: 1423 additions & 215 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

remotesync-api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
<parent>
144144
<groupId>piwigo</groupId>
145145
<artifactId>remotesync</artifactId>
146-
<version>0.0.14</version>
146+
<version>1.0</version>
147147
<relativePath>../remotesync</relativePath>
148148
</parent>
149149
</project>

remotesync-api/src/gen/java/org/piwigo/remotesync/api/AbstractAPI.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public PwgImagesAddSimpleResponse imagesAddSimple(PwgImagesAddSimpleRequest requ
143143
return getClient().sendRequest(request);
144144
}
145145

146+
public PwgImagesUploadResponse imagesUpload(PwgImagesUploadRequest request) throws ClientServerException {
147+
return getClient().sendRequest(request);
148+
}
149+
146150
public PwgImagesCheckFilesResponse imagesCheckFiles(PwgImagesCheckFilesRequest request) throws ClientServerException {
147151
return getClient().sendRequest(request);
148152
}

remotesync-api/src/gen/java/org/piwigo/remotesync/api/reflection/ReflectionRegistry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class ReflectionRegistry {
4949
methodDetails.add(new MethodReflection("pwg.images.addComment", "pwg.images.addComment.xml", PwgImagesAddCommentRequest.class, PwgImagesAddCommentResponse.class));
5050
methodDetails.add(new MethodReflection("pwg.images.addFile", "pwg.images.addFile.xml", PwgImagesAddFileRequest.class, PwgImagesAddFileResponse.class));
5151
methodDetails.add(new MethodReflection("pwg.images.addSimple", "pwg.images.addSimple.xml", PwgImagesAddSimpleRequest.class, PwgImagesAddSimpleResponse.class));
52+
methodDetails.add(new MethodReflection("pwg.images.upload", "pwg.images.upload.xml", PwgImagesUploadRequest.class, PwgImagesUploadResponse.class));
5253
methodDetails.add(new MethodReflection("pwg.images.checkFiles", "pwg.images.checkFiles.xml", PwgImagesCheckFilesRequest.class, PwgImagesCheckFilesResponse.class));
5354
methodDetails.add(new MethodReflection("pwg.images.checkUpload", "pwg.images.checkUpload.xml", PwgImagesCheckUploadRequest.class, PwgImagesCheckUploadResponse.class));
5455
methodDetails.add(new MethodReflection("pwg.images.delete", "pwg.images.delete.xml", PwgImagesDeleteRequest.class, PwgImagesDeleteResponse.class));

remotesync-api/src/gen/java/org/piwigo/remotesync/api/request/PwgImagesAddSimpleRequest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ protected PwgImagesAddSimpleRequest() {}
2626

2727
public PwgImagesAddSimpleRequest(java.io.File image) {
2828
setImage(image);
29+
setName(image.getName());
2930
}
3031

3132
public PwgImagesAddSimpleRequest setCategory(Integer category) {
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2014 Matthieu Helleboid.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the GNU Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7+
*
8+
* Contributors:
9+
* Matthieu Helleboid - initial API and implementation
10+
******************************************************************************/
11+
package org.piwigo.remotesync.api.request;
12+
13+
import org.piwigo.remotesync.api.request.AbstractRequest;
14+
import org.piwigo.remotesync.api.response.PwgImagesUploadResponse;
15+
16+
/**
17+
Add an image.
18+
<br>Use the <b>$_FILES[image]</b> field for uploading file.
19+
<br>Set the form encoding to "form-data".
20+
<br>You can update an existing photo if you define an existing image_id.
21+
**/
22+
@org.piwigo.remotesync.generator.Generated
23+
public class PwgImagesUploadRequest extends AbstractRequest<PwgImagesUploadResponse> {
24+
25+
public PwgImagesUploadRequest(java.io.File image) {
26+
setName(image.getName());
27+
setFile(image);
28+
}
29+
30+
public PwgImagesUploadRequest setCategory(Integer category) {
31+
addParameterValue("category", org.piwigo.remotesync.api.type.Type.INT_POSITIVE_NOTNULL, null, category);
32+
return this;
33+
}
34+
35+
public PwgImagesUploadRequest setCategory(Integer... category) {
36+
addParameterValueList("category", org.piwigo.remotesync.api.type.Type.INT_POSITIVE_NOTNULL, null,
37+
java.util.Arrays.asList(category));
38+
return this;
39+
}
40+
41+
public PwgImagesUploadRequest setCategory(java.util.List<Integer> categoryList) {
42+
addParameterValueList("category", org.piwigo.remotesync.api.type.Type.INT_POSITIVE_NOTNULL, null, categoryList);
43+
return this;
44+
}
45+
46+
public PwgImagesUploadRequest setName(String name) {
47+
addParameterValue("name", org.piwigo.remotesync.api.type.Type.MIXED, null, name);
48+
return this;
49+
}
50+
51+
// defaultValue : 0
52+
// maxValue : 8
53+
public PwgImagesUploadRequest setLevel(Integer level) {
54+
addParameterValue("level", org.piwigo.remotesync.api.type.Type.INT_POSITIVE, 8, level);
55+
return this;
56+
}
57+
58+
protected PwgImagesUploadRequest setFile(java.io.File image) {
59+
addParameterValue("file", org.piwigo.remotesync.api.type.Type.FILE, null, image);
60+
return this;
61+
}
62+
63+
public boolean isNeedPwgToken() {
64+
return true;
65+
}
66+
67+
public boolean isAdminOnly() {
68+
return true;
69+
};
70+
71+
public boolean isPostOnly() {
72+
return true;
73+
};
74+
75+
public String getWSMethodName() {
76+
return "pwg.images.upload";
77+
}
78+
79+
public Class<PwgImagesUploadResponse> getReturnType() {
80+
return PwgImagesUploadResponse.class;
81+
}
82+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2014 Matthieu Helleboid.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the GNU Public License v2.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
7+
*
8+
* Contributors:
9+
* Matthieu Helleboid - initial API and implementation
10+
******************************************************************************/
11+
package org.piwigo.remotesync.api.response;
12+
13+
import org.piwigo.remotesync.api.model.UploadCategory;
14+
import org.simpleframework.xml.Element;
15+
16+
@org.piwigo.remotesync.generator.Generated
17+
public class PwgImagesUploadResponse extends BasicResponse {
18+
19+
@Element(required = false)
20+
public Integer image_id;
21+
22+
@Element(required = false)
23+
public String src;
24+
25+
@Element(required = false)
26+
public String square_src;
27+
28+
@Element(required = false)
29+
public String name;
30+
31+
@Element(required = false)
32+
public UploadCategory category;
33+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<reflectionGetMethodDetailsResponse stat="ok">
2+
<name>pwg.images.upload</name>
3+
<description>Add an image.
4+
&lt;br&gt;Use the &lt;b&gt;$_FILES[image]&lt;/b&gt; field for uploading file.
5+
&lt;br&gt;Set the form encoding to &quot;form-data&quot;.
6+
&lt;br&gt;You can update an existing photo if you define an existing image_id.</description>
7+
<params class="java.util.ArrayList">
8+
<item>
9+
<name>category</name>
10+
<optional>1</optional>
11+
<acceptArray>1</acceptArray>
12+
<type>int positive notnull</type>
13+
</item>
14+
<item>
15+
<name>name</name>
16+
<optional>1</optional>
17+
<acceptArray>0</acceptArray>
18+
<type>mixed</type>
19+
</item>
20+
<item>
21+
<name>level</name>
22+
<optional>1</optional>
23+
<acceptArray>0</acceptArray>
24+
<type>int positive</type>
25+
<defaultValue>0</defaultValue>
26+
<maxValue>8</maxValue>
27+
</item>
28+
<item>
29+
<name>pwg_token</name>
30+
<optional>0</optional>
31+
<acceptArray>0</acceptArray>
32+
<type>mixed</type>
33+
</item>
34+
</params>
35+
<options>
36+
<admin_only>1</admin_only>
37+
<post_only>1</post_only>
38+
</options>
39+
</reflectionGetMethodDetailsResponse>

remotesync-api/src/main/java/org/piwigo/remotesync/api/Job.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ public abstract class Job {
1919
private static boolean running;
2020

2121
public synchronized void execute() {
22-
logger.debug("running " + running);
2322
if (running) {
24-
logger.info("Already running");
2523
return;
2624
}
2725
running = true;
@@ -36,12 +34,12 @@ public synchronized void execute() {
3634
}
3735

3836
public void executeInThread() {
39-
new Thread(new Runnable() {
40-
37+
Thread t = new Thread(new Runnable() {
4138
public void run() {
4239
execute();
4340
}
44-
}).start();
41+
});
42+
t.start();
4543
}
4644

4745
protected abstract void doExecute() throws Exception;

remotesync-api/src/main/java/org/piwigo/remotesync/api/Main.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
******************************************************************************/
1111
package org.piwigo.remotesync.api;
1212

13-
import org.piwigo.remotesync.api.sync.SyncJob;
13+
import org.piwigo.remotesync.api.AbstractMain;
1414
import org.slf4j.Logger;
1515
import org.slf4j.LoggerFactory;
1616

@@ -23,7 +23,6 @@ public static void main(String[] args) {
2323

2424
protected void start() {
2525
logger.debug("will start batch Remotesync");
26-
new SyncJob().execute();
2726
}
2827

2928
// // TODO implement dry run

remotesync-api/src/main/java/org/piwigo/remotesync/api/cache/LegacyCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
public class LegacyCache {
2626

27-
public static final String LEGACY_CACHE_FILE_NAME = ".piwigo_import_tree.txt";
27+
public static final String LEGACY_CACHE_FILE_NAME = ".piwigo_import_tree";
2828

2929
private static final Pattern ALBUM_PATTERN = Pattern.compile("(.*) album_id = (\\d*)");
3030

0 commit comments

Comments
 (0)