Merge from master develop branch
M .hgtags +2 -0
@@ 6,3 6,5 @@ 5599cb9be9c7095f8cbe8198d24afc35d82b3df9
 e74846bca1f47b75378c693964d6ccce4ec232a2 overhamj-2.0.4
 5285b3f9453ecb72805267854e511e26814e5fb4 overhamj-2.1.0
 1ee39494b7936b9fe96c689ace9b1cc78d99a778 overhamj-2.1.1
+83e4a7c1a49827c6d7e505d1401107f4ed01dbea overhamj-2.1.2
+da66b922fa8059134502156ff1763e022f36d445 overhamj-2.2.0

          
M build.gradle +1 -1
@@ 6,7 6,7 @@ apply plugin: 'eclipse'
 apply plugin: 'com.bmuschko.clover'
 
 group = 'org.overchat.overham'
-version = '2.1.1'
+version = '2.2.0'
 
 description = """overhamj"""
 

          
M debian/changelog +12 -0
@@ 1,3 1,15 @@ 
+overhamj (2.2.0) stable; urgency=medium
+
+  * freqtype support in recordings/search
+
+ -- Duncan Ross Palmer <palmer@overchat.org>  Fri, 30 Mar 2018 21:54:36 +0100
+
+overhamj (2.1.2) stable; urgency=low
+
+  * index.html fixes and additions only.
+
+ -- Duncan Ross Palmer <palmer@overchat.org>  Thu, 12 Oct 2017 20:52:11 +0100
+
 overhamj (2.1.1) stable; urgency=low
 
   * Headline changes:

          
M debian/compat +1 -1
@@ 1,1 1,1 @@ 
-9
+10

          
M debian/control +2 -2
@@ 3,7 3,7 @@ Section: net
 Priority: extra
 Maintainer: Duncan Ross Palmer <palmer@overchat.org>
 Build-Depends: debhelper (>= 9),
- java8-jdk,
+ default-jdk,
  maven,
  javahelper,
  cdbs,

          
@@ 16,7 16,7 @@ Package: overhamj
 Architecture: all
 Depends: ${shlibs:Depends},
  ${misc:Depends},
- java8-runtime,
+ default-jre-headless,
  binfmt-support,
 Description: OverHam amateur radio serices
  Java-based REST server based on Spark.

          
M src/main/resources/index.html +17 -19
@@ 71,24 71,22 @@ 
         the example you require.  Note that these are raw API calls, and return JSON for
         you to process in an application, they are not user-friendly web forms,
         as this is outside of the scope of the backend OverHamJ server.<br></p>
-        <p><a href="http://api.overham.overchat.org/v2/system/uptime">Get server
-        uptime</a><br>
-        <a href="http://api.overham.overchat.org/v2/system/ping">Check server is
-        alive</a><br>
-        <a href="http://api.overham.overchat.org/v2/index/routes">Route index (all
-        modules and all of their methods)</a><br>
-        <a href=
-        "http://api.overham.overchat.org/v2/callsign/validate?callsign=2E0EOL">Validate
-        a callsign</a><br>
-        <a href=
-        "http://api.overham.overchat.org/v2/callsign/info?callsign=2E0EOL">Dump all
-        known information for a callsign</a><br>
-        <a href="http://api.overham.overchat.org/v2/qcode/lookup?code=QSL">Lookup
-        QSL as a QCode</a><br>
-        <a href="http://api.overham.overchat.org/v2/resistor/encode?ohms=12345">Get
-        color bands for resistor value</a><br></p>
-        <a ref="http://api.overham.overchat.org/v2/band/search?hz=3500000">Search for bands by frequency (returning an ID)</a><br>
-        <a ref="http://api.overham.overchat.org/v2/band/lookup?id=433003">Lookup a specific band by ID</a><br>
-        <a ref="http://api.overham.overchat.org/v2/system/error?id=0">Lookup the meaning of an error</a><br>
+        <p>
+        <a href="http://api.overham.overchat.org/v2/system/uptime">Get server uptime</a><br>
+        <a href="http://api.overham.overchat.org/v2/system/ping">Check server is alive</a><br>
+        <a href="http://api.overham.overchat.org/v2/index/routes">Route index (all modules and all of their methods)</a><br>
+        <a href="http://api.overham.overchat.org/v2/callsign/validate?callsign=2E0EOL">Validate a callsign</a><br>
+        <a href="http://api.overham.overchat.org/v2/callsign/info?callsign=2E0EOL">Dump all known information for a callsign</a><br>
+        <a href="http://api.overham.overchat.org/v2/qcode/lookup?code=QSL">Lookup QSL as a QCode</a><br>
+        <a href="http://api.overham.overchat.org/v2/resistor/encode?ohms=12345">Get color bands for resistor value</a><br>
+        <a href="http://api.overham.overchat.org/v2/band/search?hz=3500000">Search for bands by frequency (returning an ID)</a><br>
+        <a href="http://api.overham.overchat.org/v2/band/lookup?id=433003">Lookup a specific band by ID</a><br>
+        <a href="http://api.overham.overchat.org/v2/system/error?id=0">Lookup the meaning of an error</a><br>
+	<a href="http://api.overham.overchat.org/v2/recordings/stats">Get stats about recordings</a><br>
+	<a href="http://api.overham.overchat.org/v2/recordings/search?hzFreq=430825000-430850000&when=1506111280-1506711280">Search for recordings between times and frequencies</a><br>
+        <a href="http://api.overham.overchat.org/v2/recordings/search?hzFreq=145600000&when=1506252483">Search for a specific time and a specific frequency</a><br>
+        <a href="http://api.overham.overchat.org/v2/recordings/info?id=c4ce3776-a57b-11e7-98aa-f23c9173fe51">Get info on a recording</a><br>
+        <a href="http://api.overham.overchat.org/v2/recordings/download?id=c4ce3776-a57b-11e7-98aa-f23c9173fe51">Download a recording</a><br>
+        </p>
 </body>
 </html>

          
M src/org/overchat/overham/modules/Recordings.java +34 -0
@@ 214,17 214,22 @@ public class Recordings extends Base imp
 	public ReturnData userSearch(JSONObject output, Map<String, String> methodParams) {
 		List<String> implemented = new ArrayList<String>(2);
 		List<Object> boundParams = new ArrayList<Object>();
+
 		String hzFreq = methodParams.get("hzFreq"); // A string in the form "lowest-highest"
 		String when = methodParams.get("when"); // A string in the form "earliest-latest"
+		String freqType = methodParams.get("freqType"); // A string which is an optional multiplier (ie. MHz)
+
 		Map<String, Object> data = new HashMap<String, Object>();
 		List<Object> resultList = new ArrayList<Object>(); // Size depends on result list size
 		ExitCodes exitCode = ExitCodes.FAILURE;
+
 		final String baseQ = "SELECT id, whenStart, msLength, hzFreq FROM ic7100voiceExtra WHERE ";
 		StringBuilder q = new StringBuilder();
 		Response implementedResponse;
 
 		implemented.add("hzFreq");
 		implemented.add("when");
+		implemented.add("freqType");
 		implementedResponse = this.checkUnimplemented(methodParams, implemented);
 		if (!implementedResponse.success) {
 			java.lang.System.out.println(String.format("'%s' is not implemented", implementedResponse.what));

          
@@ 259,10 264,39 @@ public class Recordings extends Base imp
 					);
 				}
 
+				if (freqType != null) { // Implement freqType (optional, default Hz)
+					switch(freqType) {
+						case "MHz" : {
+							lowest *= 1000000;
+							highest *= 1000000;
+							break;
+						}
+						case "kHz" : {
+							lowest *= 1000;
+							highest *= 1000;
+							break;
+						}
+						case "Hz" : {
+							break; // No action but totally legal
+						}
+						default : {
+							return new ReturnData(
+								this.buildErrorForUser(output, ExitCodes.UNIMPLEMENTED),
+								new HTTPStatus(400, ExitCodes.UNIMPLEMENTED)
+							);
+						}
+					}
+				}
+
 				q.append("hzFreq BETWEEN ? AND ? ");
 				boundParams.add(lowest);
 				boundParams.add(highest);
 			}
+		} else if (freqType != null) { // You can't specify freqType without hzFreq
+			return new ReturnData(
+				this.buildErrorForUser(output, ExitCodes.UNIMPLEMENTED),
+				new HTTPStatus(400, ExitCodes.UNIMPLEMENTED)
+			);
 		}
 
 		if (boundParams.size() > 0) {