Compare commits

..
4 Commits
78 changed files with 1601 additions and 558 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
#Sat Aug 29 13:08:22 CEST 2026 #Sun Sep 06 15:25:26 CEST 2026
host=fedora.home host=fedora
process-id=3 process-id=3
user=Kotama_Chio user=Kotama_Chio
+65
View File
@@ -873,3 +873,68 @@ java.lang.Exception: The project description file (.project) for 'SillyBlahaj.or
!ENTRY org.eclipse.jdt.core 4 969 2026-08-29 13:09:22.631 !ENTRY org.eclipse.jdt.core 4 969 2026-08-29 13:09:22.631
!MESSAGE sillyblahaj.org.api does not exist !MESSAGE sillyblahaj.org.api does not exist
!SESSION 2026-08-31 20:39:00.304 -----------------------------------------------
eclipse.buildId=4.40.0.20260604-0652
java.version=21.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY ch.qos.logback.classic 1 0 2026-08-31 20:39:05.040
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2026-08-31 20:39:08.198
!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml
!SESSION 2026-09-05 11:06:23.210 -----------------------------------------------
eclipse.buildId=4.40.0.20260604-0652
java.version=21.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY ch.qos.logback.classic 1 0 2026-09-05 11:06:28.586
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2026-09-05 11:06:34.203
!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml
!SESSION 2026-09-06 13:03:22.499 -----------------------------------------------
eclipse.buildId=4.40.0.20260604-0652
java.version=21.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 13:03:27.448
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 13:03:30.006
!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml
!SESSION 2026-09-06 13:25:25.034 -----------------------------------------------
eclipse.buildId=4.40.0.20260604-0652
java.version=21.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 13:25:28.297
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 13:25:30.855
!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml
!SESSION 2026-09-06 15:24:52.650 -----------------------------------------------
eclipse.buildId=4.40.0.20260604-0652
java.version=21.0.11
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.java.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.java.product
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 15:24:56.077
!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized.
!ENTRY ch.qos.logback.classic 1 0 2026-09-06 15:25:27.089
!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml
@@ -1,28 +1,28 @@
package org.sillyjrafe.uoapi.binds; package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.sillyblahaj.uoapi.Api; import org.sillyjirafe.uoapi.Api;
import org.sillyblahaj.uoapi.element; import org.sillyjirafe.uoapi.element;
import java.util.ArrayList;
import java.util.List;
public class GitHubLGPLApi implements Api public class CodeBergApi implements Api
{ {
public String getName() public String getName()
{ {
return "GitHubLGPLApi"; return "CadeBergApi";
} }
public String getURL(int page) { public String getURL(int page) {
return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page; return "https://codeberg.org/api/v1/repos/search?page=" + page;
} }
public List<element> Parse(String jsonRaw) { public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>(); List<element> resultats = new ArrayList<>();
try { try {
JSONObject json = new JSONObject(jsonRaw); JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("items"); JSONArray items = json.getJSONArray("items");
@@ -34,7 +34,7 @@ public class GitHubLGPLApi implements Api
String url = repo.getString("html_url"); String url = repo.getString("html_url");
String licence = repo.getJSONObject("license").getString("spdx_id"); String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "github", "code")); resultats.add(new element(titre, url, licence, "codeberg", "code"));
} }
} catch (org.json.JSONException e) { } catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage()); System.out.println("error but continue : " + e.getMessage());
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -1,43 +0,0 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyblahaj.uoapi.Api;
import org.sillyblahaj.uoapi.element;
public class OpenVerseImagesApi implements Api
{
public String getName()
{
return "OpenVerseImagesApi";
}
public String getURL(int page) {
return "https://api.openverse.org/v1/images/?format=json&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results");
for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i);
String titre = image.getString("title");
String url = image.getString("url");
String licence = image.getString("license");
resultats.add(new element(titre, url, licence, "openverse", "image"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -1,25 +0,0 @@
package org.sillyjirafe.api;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyblahaj.uoapi.element;
public class Json {
public static String JSONConvert(List<element> elements) {
JSONArray tableau = new JSONArray();
for (element e : elements) {
JSONObject obj = new JSONObject();
obj.put("title", e.title());
obj.put("url", e.url());
obj.put("licence", e.licence());
obj.put("source", e.source());
obj.put("type", e.type());
tableau.put(obj);
}
return tableau.toString();
}
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public int getRND(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,105 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public static String NextLetter(String actual) {
char lettre = actual.charAt(0);
if (lettre >= 'z') {
return "a";
}
char suivante = (char) (lettre + 1);
return String.valueOf(suivante);
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -5,11 +5,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.sillyblahaj.uoapi.binds.GitHubApacheApi; import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
import org.sillyblahaj.uoapi.binds.GitHubLGPLApi; import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
import org.sillyblahaj.uoapi.binds.GitHubMITApi; import org.sillyjirafe.uoapi.binds.GitHubMITApi;
import org.sillyblahaj.uoapi.binds.OpenVerseAudiosApi; import org.sillyjirafe.uoapi.binds.OpenVerseAudiosApi;
import org.sillyblahaj.uoapi.binds.OpenVerseImagesApi; import org.sillyjirafe.uoapi.binds.OpenVerseImagesApi;
public class Out { public class Out {
List<Api> Apis = new ArrayList<>(); List<Api> Apis = new ArrayList<>();
@@ -21,6 +21,7 @@ public class Out {
Apis.add(new GitHubApacheApi()); Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi()); Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi()); Apis.add(new OpenVerseAudiosApi());
Apis.add(new CodeBergApi()));
List<String> bindnames = new ArrayList<>(); List<String> bindnames = new ArrayList<>();
@@ -1,58 +0,0 @@
package org.sillyjirafe.api;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyblahaj.uoapi.element;
import com.sun.net.httpserver.HttpServer;
public class Start {
public static void API(Connection conn) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8081), 0);
server.createContext("/search", exchange -> {
String query = exchange.getRequestURI().getQuery();
Map<String, String> settings = parseQuery(query);
try {
List<element> results = Search.search(conn, settings);
String json = Json.JSONConvert(results);
exchange.getResponseHeaders().set("Content-Type", "application/json");
exchange.sendResponseHeaders(200, json.getBytes().length);
exchange.getResponseBody().write(json.getBytes());
exchange.getResponseBody().close();
} catch (Exception e) {
e.printStackTrace();
exchange.sendResponseHeaders(500, 0);
exchange.getResponseBody().close();
}
});
server.start();
System.out.println("Search API run on 8081 port");
}
public static Map<String, String> parseQuery(String query) {
Map<String, String> params = new HashMap<>();
if (query == null) return params;
String[] paires = query.split("&");
for (String paire : paires) {
String[] cle_valeur = paire.split("=", 2);
if (cle_valeur.length == 2) {
params.put(cle_valeur[0], cle_valeur[1]);
}
}
return params;
}
}
@@ -1,28 +1,28 @@
package org.sillyjrafe.uoapi.binds; package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api; import org.sillyjirafe.uoapi.Api;
import org.sillyjirafe.uoapi.element; import org.sillyjirafe.uoapi.element;
import java.util.ArrayList;
import java.util.List;
public class GitHubLGPLApi implements Api public class CodeBergApi implements Api
{ {
public String getName() public String getName()
{ {
return "GitHubLGPLApi"; return "CadeBergApi";
} }
public String getURL(int page) { public String getURL(int page) {
return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page; return "https://codeberg.org/api/v1/repos/search?page=" + page;
} }
public List<element> Parse(String jsonRaw) { public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>(); List<element> resultats = new ArrayList<>();
try { try {
JSONObject json = new JSONObject(jsonRaw); JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("items"); JSONArray items = json.getJSONArray("items");
@@ -0,0 +1,5 @@
package org.sillyjirafe.uoapi;
public class ApiKeys {
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public int getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("rnd");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,127 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName, int maxPage) throws SQLException {
int pageActuelle = getPage(bindName);
String rndActuel = getRND(bindName);
int nouvellePage;
String nouveauRnd;
if (pageActuelle >= maxPage) {
nouvellePage = 1;
nouveauRnd = NextLetter(rndActuel);
} else {
nouvellePage = pageActuelle + 1;
nouveauRnd = rndActuel;
}
String sql = """
INSERT INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)
ON CONFLICT(bind_name) DO UPDATE SET last_page = ?, rnd = ?
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.setInt(2, nouvellePage);
ps.setString(3, nouveauRnd);
ps.setInt(4, nouvellePage);
ps.setString(5, nouveauRnd);
ps.executeUpdate();
}
}
public static String NextLetter(String actual) {
char[] lettres = actual.toCharArray();
int i = lettres.length - 1;
while (i >= 0) {
if (lettres[i] < 'z') {
lettres[i]++;
return new String(lettres);
}
lettres[i] = 'a';
i--;
}
return "a" + new String(lettres);
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -2,12 +2,12 @@ package org.sillyjirafe.uoapi.binds;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.sillyblahaj.uoapi.Api; import org.sillyjirafe.uoapi.Api;
import org.sillyblahaj.uoapi.element; import org.sillyjirafe.uoapi.element;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class GitHubMITApi implements Api public class CodeBergApi implements Api
{ {
public String getName() public String getName()
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public int getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,5 @@
package org.sillyjirafe.uoapi;
public class ApiKeys {
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,105 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public static String lettreSuivante(String actuelle) {
char lettre = actuelle.charAt(0);
if (lettre >= 'z') {
return "a";
}
char suivante = (char) (lettre + 1);
return String.valueOf(suivante);
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -1,58 +0,0 @@
package org.sillyblahaj.api;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyblahaj.uoapi.element;
import com.sun.net.httpserver.HttpServer;
public class Start {
public static void API(Connection conn) throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress(8081), 0);
server.createContext("/search", exchange -> {
String query = exchange.getRequestURI().getQuery();
Map<String, String> settings = parseQuery(query);
try {
List<element> results = Search.search(conn, settings);
String json = Json.JSONConvert(results);
exchange.getResponseHeaders().set("Content-Type", "application/json");
exchange.sendResponseHeaders(200, json.getBytes().length);
exchange.getResponseBody().write(json.getBytes());
exchange.getResponseBody().close();
} catch (Exception e) {
e.printStackTrace();
exchange.sendResponseHeaders(500, 0);
exchange.getResponseBody().close();
}
});
server.start();
System.out.println("Search API run on 8081 port");
}
public static Map<String, String> parseQuery(String query) {
Map<String, String> params = new HashMap<>();
if (query == null) return params;
String[] paires = query.split("&");
for (String paire : paires) {
String[] cle_valeur = paire.split("=", 2);
if (cle_valeur.length == 2) {
params.put(cle_valeur[0], cle_valeur[1]);
}
}
return params;
}
}
@@ -1,44 +0,0 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api;
import org.sillyblahaj.uoapi.element;
public class OpenVerseAudiosApi implements Api
{
public String getName()
{
return "OpenVerseAudiosApi";
}
public String getURL(int page) {
return "https://api.openverse.org/v1/audio/?format=json&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results");
for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i);
String titre = image.getString("title");
String url = image.getString("url");
String licence = image.getString("license");
resultats.add(new element(titre, url, licence, "openverse", "audio"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,51 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyjirafe.uoapi.binds.CodeBergApi;
import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
import org.sillyjirafe.uoapi.binds.GitHubMITApi;
import org.sillyjirafe.uoapi.binds.OpenVerseAudiosApi;
import org.sillyjirafe.uoapi.binds.OpenVerseImagesApi;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
Apis.add(new CodeBergApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()));
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public int getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -1,44 +0,0 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyblahaj.uoapi.Api;
import org.sillyblahaj.uoapi.element;
public class GitHubApacheApi implements Api
{
public String getName()
{
return "GitHubApacheApi";
}
public String getURL(int page) {
return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("items");
for (int i = 0; i < items.length(); i++) {
JSONObject repo = items.getJSONObject(i);
String titre = repo.getString("full_name");
String url = repo.getString("html_url");
String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "github", "code"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -0,0 +1,80 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -0,0 +1,50 @@
package org.sillyjirafe.uoapi;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyjirafe.uoapi.binds.CodeBergApi;
import org.sillyjirafe.uoapi.binds.GitHubApacheApi;
import org.sillyjirafe.uoapi.binds.GitHubLGPLApi;
import org.sillyjirafe.uoapi.binds.GitHubMITApi;
import org.sillyjirafe.uoapi.binds.OpenVerseAudiosApi;
import org.sillyjirafe.uoapi.binds.OpenVerseImagesApi;
public class Out {
List<Api> Apis = new ArrayList<>();
public List<String> PreOut()
{
Apis.add(new GitHubMITApi());
Apis.add(new GitHubLGPLApi());
Apis.add(new GitHubApacheApi());
Apis.add(new OpenVerseImagesApi());
Apis.add(new OpenVerseAudiosApi());
List<String> bindnames = new ArrayList<>();
for (Api api : Apis)
{
bindnames.add(api.getName());
}
return bindnames;
}
public List<element> out(Map<String, Integer> bindpages) throws Exception
{
List<element> Elements = new ArrayList<>();
for (int i = 0; i < Apis.size(); i++)
{
List<element> currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()));
for (int j = 0; j < currentapi.size(); j++)
{
Elements.add(currentapi.get(j));
}
}
return Elements;
}
}
@@ -1,44 +0,0 @@
package org.sillyblahaj.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.sillyblahaj.uoapi.element;
public class Search {
public static List<element> search(Connection conn, Map<String, String> settings) throws SQLException {
List<element> results = new ArrayList<>();
String sql = """
SELECT * FROM creations
WHERE (? = '' OR title LIKE ?)
AND (? = '' OR licence = ?)
AND (? = '' OR type = ?)
""";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setString(1, settings.getOrDefault("q", ""));
ps.setString(2, "%" + settings.getOrDefault("q", "") + "%");
ps.setString(3, settings.getOrDefault("licence", ""));
ps.setString(4, settings.getOrDefault("licence", ""));
ps.setString(5, settings.getOrDefault("type", ""));
ps.setString(6, settings.getOrDefault("type", ""));
ResultSet rs = ps.executeQuery();
while (rs.next()) {
results.add(new element(
rs.getString("title"),
rs.getString("url"),
rs.getString("licence"),
rs.getString("source"),
rs.getString("type")
));
}
}
return results;
}
}
@@ -1,42 +0,0 @@
package org.sillyjirafe.linker;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyblahaj.db.Crawl_StateDB;
import org.sillyblahaj.db.ElementsDB;
import org.sillyblahaj.uoapi.*;
public class Main {
public static void main(String[] args) throws Exception
{
Out Out = new Out();
ElementsDB elementDB = new ElementsDB("jdbc:sqlite:elements.db");
Crawl_StateDB crawlstateDB = new Crawl_StateDB("jdbc:sqlite:crawlstates.db");
elementDB.LinkToDB();
crawlstateDB.LinkToDB();
List<String> bindNames = Out.PreOut();
Map<String, Integer> pages = new HashMap<>();
for (String nom : bindNames) {
pages.put(nom, crawlstateDB.getPage(nom));
}
List<element> elements = Out.out(pages);
for (int i = 0; i < elements.size(); i++)
{
element el = elements.get(i);
elementDB.AddEllement(el.title(), el.url(), el.licence(), el.source(), el.type());
}
for (String name : bindNames) {
crawlstateDB.updatePage(name);
}
elementDB.Close();
crawlstateDB.Close();
}
}
@@ -1,44 +0,0 @@
package org.sillyjirafe.api;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.sillyblahaj.uoapi.element;
public class Search {
public static List<element> search(Connection conn, Map<String, String> settings) throws SQLException {
List<element> results = new ArrayList<>();
String sql = """
SELECT * FROM creations
WHERE (? = '' OR title LIKE ?)
AND (? = '' OR licence = ?)
AND (? = '' OR type = ?)
""";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
ps.setString(1, settings.getOrDefault("q", ""));
ps.setString(2, "%" + settings.getOrDefault("q", "") + "%");
ps.setString(3, settings.getOrDefault("licence", ""));
ps.setString(4, settings.getOrDefault("licence", ""));
ps.setString(5, settings.getOrDefault("type", ""));
ps.setString(6, settings.getOrDefault("type", ""));
ResultSet rs = ps.executeQuery();
while (rs.next()) {
results.add(new element(
rs.getString("title"),
rs.getString("url"),
rs.getString("licence"),
rs.getString("source"),
rs.getString("type")
));
}
}
return results;
}
}
@@ -1,43 +1,45 @@
package org.sillyjirafe.uoapi.binds; package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.sillyjirafe.uoapi.Api; import org.sillyjirafe.uoapi.Api;
import org.sillyblahaj.uoapi.element; import org.sillyjirafe.uoapi.element;
import java.util.ArrayList;
import java.util.List;
public class OpenVerseImagesApi implements Api public class CodeBergApi implements Api
{ {
public String getName() public String getName()
{ {
return "OpenVerseImagesApi"; return "CadeBergApi";
} }
public String getURL(int page) { public String getURL(int page) {
return "https://api.openverse.org/v1/images/?format=json&page=" + page; return "https://codeberg.org/api/v1/repos/search?page=" + page;
} }
public List<element> Parse(String jsonRaw) { public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>(); List<element> resultats = new ArrayList<>();
try { try {
JSONObject json = new JSONObject(jsonRaw); JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results"); JSONArray items = json.getJSONArray("data");
for (int i = 0; i < items.length(); i++) { for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i); JSONObject repo = items.getJSONObject(i);
String titre = image.getString("title"); String titre = repo.getString("full_name");
String url = image.getString("url"); String url = repo.getString("html_url");
String licence = image.getString("license"); String licence = repo.getJSONObject("license").getString("spdx_id");
resultats.add(new element(titre, url, licence, "openverse", "image")); resultats.add(new element(titre, url, licence, "codeberg", "code"));
} }
} catch (org.json.JSONException e) { } catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage()); System.out.println("error but continue : " + e.getMessage());
} }
return resultats; return resultats;
} }
} }
@@ -0,0 +1,94 @@
package org.sillyjirafe.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Crawl_StateDB
{
String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException
{
URL = BDstr;
connection = DriverManager.getConnection(URL);
}
public void LinkToDB() throws SQLException
{
try (Statement stmt = connection.createStatement())
{
stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT a
)
""");
}
}
public void AddEllement(String bind, int lastpage) throws SQLException
{
try (PreparedStatement ps = connection.prepareStatement(insertSql))
{
ps.setString(1, bind);
ps.setInt(2, lastpage);
ps.executeUpdate();
System.out.printf("%s is now page %d \n", bind, lastpage);
}
}
public int getPage(String bindName) throws SQLException {
String sql = "SELECT last_page FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getInt("last_page");
} else {
return 1;
}
}
}
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException {
String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
ON CONFLICT(bind_name) DO UPDATE SET last_page = last_page + 1
""";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ps.executeUpdate();
}
}
public void Close() throws SQLException
{
if (connection != null)
{
connection.close();
}
}
}
@@ -1,42 +0,0 @@
package org.sillyjirafe.linker;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.sillyjirafe.db.Crawl_StateDB;
import org.sillyjirafe.db.ElementsDB;
import org.sillyblahaj.uoapi.*;
public class Main {
public static void main(String[] args) throws Exception
{
Out Out = new Out();
ElementsDB elementDB = new ElementsDB("jdbc:sqlite:elements.db");
Crawl_StateDB crawlstateDB = new Crawl_StateDB("jdbc:sqlite:crawlstates.db");
elementDB.LinkToDB();
crawlstateDB.LinkToDB();
List<String> bindNames = Out.PreOut();
Map<String, Integer> pages = new HashMap<>();
for (String nom : bindNames) {
pages.put(nom, crawlstateDB.getPage(nom));
}
List<element> elements = Out.out(pages);
for (int i = 0; i < elements.size(); i++)
{
element el = elements.get(i);
elementDB.AddEllement(el.title(), el.url(), el.licence(), el.source(), el.type());
}
for (String name : bindNames) {
crawlstateDB.updatePage(name);
}
elementDB.Close();
crawlstateDB.Close();
}
}
@@ -1,44 +0,0 @@
package org.sillyjirafe.uoapi.binds;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import org.sillyblahaj.uoapi.Api;
import org.sillyblahaj.uoapi.element;
public class OpenVerseAudiosApi implements Api
{
public String getName()
{
return "OpenVerseAudiosApi";
}
public String getURL(int page) {
return "https://api.openverse.org/v1/audio/?format=json&page=" + page;
}
public List<element> Parse(String jsonRaw) {
List<element> resultats = new ArrayList<>();
try {
JSONObject json = new JSONObject(jsonRaw);
JSONArray items = json.getJSONArray("results");
for (int i = 0; i < items.length(); i++) {
JSONObject image = items.getJSONObject(i);
String titre = image.getString("title");
String url = image.getString("url");
String licence = image.getString("license");
resultats.add(new element(titre, url, licence, "openverse", "audio"));
}
} catch (org.json.JSONException e) {
System.out.println("error but continue : " + e.getMessage());
}
return resultats;
}
}
@@ -1,6 +1,7 @@
//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false //org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false
PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery; PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery;
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.ui.ColoredLabels.match_highlight=206,92,0
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41 org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=41,41,41
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45 org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=43,44,45
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=255,255,255 org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=255,255,255
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/SillyJirafe.org/src/org/sillyjirafe/linker/Main.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.sillyjirafe.linker.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="SillyBlahaj.org"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SillyJirafe.org"/>
</launchConfiguration>
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchHistory> <launchHistory>
<launchGroup id="org.eclipse.debug.ui.launchGroup.debug"> <launchGroup id="org.eclipse.debug.ui.launchGroup.debug">
<mruHistory/> <mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Main (3)&quot;/&gt;&#10;"/>
</mruHistory>
<favorites/> <favorites/>
</launchGroup> </launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.profile"> <launchGroup id="org.eclipse.debug.ui.launchGroup.profile">
@@ -9,7 +11,9 @@
<favorites/> <favorites/>
</launchGroup> </launchGroup>
<launchGroup id="org.eclipse.eclemma.ui.launchGroup.coverage"> <launchGroup id="org.eclipse.eclemma.ui.launchGroup.coverage">
<mruHistory/> <mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Main (3)&quot;/&gt;&#10;"/>
</mruHistory>
<favorites/> <favorites/>
</launchGroup> </launchGroup>
<launchGroup id="org.eclipse.ui.externaltools.launchGroup"> <launchGroup id="org.eclipse.ui.externaltools.launchGroup">
@@ -17,7 +21,9 @@
<favorites/> <favorites/>
</launchGroup> </launchGroup>
<launchGroup id="org.eclipse.debug.ui.launchGroup.run"> <launchGroup id="org.eclipse.debug.ui.launchGroup.run">
<mruHistory/> <mruHistory>
<launch memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;launchConfiguration local=&quot;true&quot; path=&quot;Main (3)&quot;/&gt;&#10;"/>
</mruHistory>
<favorites/> <favorites/>
</launchGroup> </launchGroup>
</launchHistory> </launchHistory>
File diff suppressed because one or more lines are too long
@@ -1,4 +1,7 @@
INDEX VERSION 1.134+/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.jdt.core INDEX VERSION 1.134+/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.jdt.core
263131634.index 263131634.index
1568060524.index
1241313270.index
206920101.index 206920101.index
4139034169.index
1865797976.index 1865797976.index
@@ -2,7 +2,7 @@
<section name="Workbench"> <section name="Workbench">
<section name="org.eclipse.jdt.debug.ui.MAIN_METHOD_SELECTION_DIALOG"> <section name="org.eclipse.jdt.debug.ui.MAIN_METHOD_SELECTION_DIALOG">
<item key="ShowStatusLine" value="true"/> <item key="ShowStatusLine" value="true"/>
<item key="History" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;History&gt;&#x0A;&lt;historyRootNode&gt;&#x0A;&lt;infoNode&gt;=SillyBlahaj.org/src&amp;lt;org.sillyblahaj.linker{Main.java[Main&lt;/infoNode&gt;&#x0A;&lt;/historyRootNode&gt;&#x0A;&lt;/History&gt;"/> <item key="History" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0A;&lt;History&gt;&#x0A;&lt;historyRootNode&gt;&#x0A;&lt;infoNode&gt;=SillyBlahaj.org/src&amp;lt;org.sillyblahaj.linker{Main.java[Main&lt;/infoNode&gt;&#x0A;&lt;infoNode&gt;=SillyJirafe.org/src&amp;lt;org.sillyjirafe.linker{Main.java[Main&lt;/infoNode&gt;&#x0A;&lt;/historyRootNode&gt;&#x0A;&lt;/History&gt;"/>
<section name="DialogBoundsSettings"> <section name="DialogBoundsSettings">
<item key="DIALOG_HEIGHT" value="500"/> <item key="DIALOG_HEIGHT" value="500"/>
<item key="DIALOG_WIDTH" value="600"/> <item key="DIALOG_WIDTH" value="600"/>
@@ -74,11 +74,11 @@
<item key="FatJarPackageWizardPage.ANTSCRIPT_SAVE" value="false"/> <item key="FatJarPackageWizardPage.ANTSCRIPT_SAVE" value="false"/>
<item key="FatJarPackageWizardPage.ANTSCRIPT_LOCATION" value="/home/Kotama_Chio/Musique/SillyBlahaj.org/Java"/> <item key="FatJarPackageWizardPage.ANTSCRIPT_LOCATION" value="/home/Kotama_Chio/Musique/SillyBlahaj.org/Java"/>
<item key="FatJarPackageWizardPage.LIBRARY_HANDLING" value="2"/> <item key="FatJarPackageWizardPage.LIBRARY_HANDLING" value="2"/>
<item key="FatJarPackageWizardPage.LAUNCH_CONFIGURATION_SELECTION_NAME" value="Main (2) - sillyblahaj.org.api"/> <item key="FatJarPackageWizardPage.LAUNCH_CONFIGURATION_SELECTION_NAME" value="Main (3) - SillyJirafe.org"/>
<item key="FatJarPackageWizardPage.DESTINATION_PATH_SELECTION" value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-api.jar"/> <item key="FatJarPackageWizardPage.DESTINATION_PATH_SELECTION" value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-backend.jar"/>
<list key="FatJarPackageWizardPage.DESTINATION_NAMES_ID"> <list key="FatJarPackageWizardPage.DESTINATION_NAMES_ID">
<item value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-api.jar"/>
<item value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-backend.jar"/> <item value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-backend.jar"/>
<item value="/home/Kotama_Chio/sillyblahaj/sillyblahaj-api.jar"/>
</list> </list>
<list key="FatJarPackageWizardPage.ANTSCRIPT_LOCATION_HISTORY"> <list key="FatJarPackageWizardPage.ANTSCRIPT_LOCATION_HISTORY">
<item value="/home/Kotama_Chio/Musique/SillyBlahaj.org/Java"/> <item value="/home/Kotama_Chio/Musique/SillyBlahaj.org/Java"/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring comment="Copy element &apos;GitHubMITApi.java&apos; to &apos;org.sillyjirafe.uoapi.binds.GitHubMITApi.java&apos;&#x0A;- Original project: &apos;SillyJirafe.org&apos;&#x0A;- Destination element: &apos;org.sillyjirafe.uoapi.binds.GitHubMITApi.java&apos;&#x0A;- Original element: &apos;org.sillyjirafe.uoapi.binds.GitHubMITApi.java&apos;" description="Copy compilation unit" destination="/src&lt;org.sillyjirafe.uoapi.binds{GitHubMITApi.java" element1="/src&lt;org.sillyjirafe.uoapi.binds{GitHubMITApi.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.copy" policy="org.eclipse.jdt.ui.copyResources" stamp="1788604141896" units="1" version="1.0"/>
</session>
@@ -0,0 +1 @@
1788604141896 Copy compilation unit
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">&#x0A;<refactoring accessors="true" comment="Delete 3 elements from project &apos;SillyJirafe.org&apos;&#x0A;- Original project: &apos;SillyJirafe.org&apos;&#x0A;- Original elements:&#x0A; elements.db&#x0A; json-20250107.jar&#x0A; sqlite-jdbc-3.53.2.1.jar" description="Delete elements" element1="sqlite-jdbc-3.53.2.1.jar" element2="elements.db" element3="json-20250107.jar" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="3" stamp="1788693077363" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;SillyJirafe.org&apos;&#x0A;- Original project: &apos;SillyJirafe.org&apos;&#x0A;- Original element: &apos;org.sillyjirafe.uoapi.binds.CodeBergApi.java&apos;" description="Delete element" element1="/src&lt;org.sillyjirafe.uoapi.binds{CodeBergApi.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788696318574" subPackages="false" version="1.0"/>&#x0A;<refactoring accessors="true" comment="Delete element from project &apos;SillyJirafe.org&apos;&#x0A;- Original project: &apos;SillyJirafe.org&apos;&#x0A;- Original element: &apos;org.sillyjirafe.uoapi.ApiKeys.java&apos;" description="Delete element" element1="/src&lt;org.sillyjirafe.uoapi{ApiKeys.java" elements="1" flags="589830" id="org.eclipse.jdt.ui.delete" resources="0" stamp="1788701297006" subPackages="false" version="1.0"/>
</session>
@@ -0,0 +1,3 @@
1788693077363 Delete elements
1788696318574 Delete element
1788701297006 Delete element
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<session version="1.0">
<refactoring accessors="true" comment="Delete element from project &apos;sillyjirafe.org.api&apos;&#x0A;- Original project: &apos;sillyjirafe.org.api&apos;&#x0A;- Original element: &apos;elements.db&apos;" description="Delete element" element1="elements.db" elements="0" flags="589830" id="org.eclipse.jdt.ui.delete" resources="1" stamp="1788701260024" subPackages="false" version="1.0"/>
</session>
@@ -14,3 +14,8 @@
2026-08-28 21:24:21,650 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update. 2026-08-28 21:24:21,650 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-08-29 13:04:25,454 [Worker-9: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. 2026-08-29 13:04:25,454 [Worker-9: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
2026-08-29 13:08:26,670 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. 2026-08-29 13:08:26,670 [Worker-6: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
2026-08-31 20:39:13,052 [Worker-8: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-09-05 11:06:39,935 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-09-06 13:03:34,770 [Worker-2: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update.
2026-09-06 13:25:34,865 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
2026-09-06 15:25:31,408 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read.
@@ -34,7 +34,7 @@
<section name="ExternalProjectImportWizard.dialogBounds"> <section name="ExternalProjectImportWizard.dialogBounds">
<item key="DIALOG_X_ORIGIN" value="0"/> <item key="DIALOG_X_ORIGIN" value="0"/>
<item key="DIALOG_Y_ORIGIN" value="0"/> <item key="DIALOG_Y_ORIGIN" value="0"/>
<item key="DIALOG_WIDTH" value="620"/> <item key="DIALOG_WIDTH" value="625"/>
<item key="DIALOG_HEIGHT" value="803"/> <item key="DIALOG_HEIGHT" value="803"/>
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/> <item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
</section> </section>
@@ -9,7 +9,7 @@
</section> </section>
<section name="ImportExportAction"> <section name="ImportExportAction">
<item key="ImportExportPage.STORE_SELECTED_EXPORT_WIZARD_ID" value="org.eclipse.jdt.internal.ui.fatjarpackager.JarPackageWizard"/> <item key="ImportExportPage.STORE_SELECTED_EXPORT_WIZARD_ID" value="org.eclipse.jdt.internal.ui.fatjarpackager.JarPackageWizard"/>
<item key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID" value="org.eclipse.ui.wizards.import.ExternalProject"/> <item key="ImportExportPage.STORE_SELECTED_IMPORT_WIZARD_ID" value="org.eclipse.ui.wizards.import.FileSystem"/>
<list key="ImportExportPage.STORE_EXPANDED_EXPORT_CATEGORIES"> <list key="ImportExportPage.STORE_EXPANDED_EXPORT_CATEGORIES">
<item value="org.eclipse.jdt.ui.Java"/> <item value="org.eclipse.jdt.ui.Java"/>
</list> </list>
@@ -24,4 +24,18 @@
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/> <item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
</section> </section>
</section> </section>
<section name="FileSystemImportWizard">
<item key="WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID" value="false"/>
<item key="WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID" value="false"/>
<list key="WizardFileSystemResourceImportPage1.STORE_SOURCE_NAMES_ID">
<item value="/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/libs"/>
</list>
<section name="FileSystemImportWizard.dialogBounds">
<item key="DIALOG_X_ORIGIN" value="0"/>
<item key="DIALOG_Y_ORIGIN" value="0"/>
<item key="DIALOG_WIDTH" value="625"/>
<item key="DIALOG_HEIGHT" value="637"/>
<item key="DIALOG_FONT_NAME" value="1|Noto Sans|10.0|0|GTK|1|"/>
</section>
</section>
</section> </section>
+1 -1
View File
@@ -1,3 +1,3 @@
#Sat Aug 29 13:08:22 CEST 2026 #Sun Sep 06 15:25:26 CEST 2026
org.eclipse.core.runtime=2 org.eclipse.core.runtime=2
org.eclipse.platform=4.40.0.v20260601-0713 org.eclipse.platform=4.40.0.v20260601-0713
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ import java.sql.Statement;
public class Crawl_StateDB public class Crawl_StateDB
{ {
String URL = new String(); String URL = new String();
String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page) VALUES (?, ?)"; String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd) VALUES (?, ?, ?)";
Connection connection; Connection connection;
public Crawl_StateDB(String BDstr) throws SQLException public Crawl_StateDB(String BDstr) throws SQLException
@@ -26,7 +26,8 @@ public class Crawl_StateDB
stmt.execute(""" stmt.execute("""
CREATE TABLE IF NOT EXISTS crawlstates ( CREATE TABLE IF NOT EXISTS crawlstates (
bind_name TEXT PRIMARY KEY, bind_name TEXT PRIMARY KEY,
last_page INTEGER NOT NULL DEFAULT 1 last_page INTEGER NOT NULL DEFAULT 1,
rnd TEXT NOT NULL DEFAULT 'a'
) )
"""); """);
} }
@@ -57,6 +58,20 @@ public class Crawl_StateDB
} }
} }
} }
public String getRND(String bindName) throws SQLException {
String sql = "SELECT rnd FROM crawlstates WHERE bind_name = ?";
try (PreparedStatement ps = connection.prepareStatement(sql)) {
ps.setString(1, bindName);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
return rs.getString("rnd");
} else {
return "a";
}
}
}
public void updatePage(String bindName) throws SQLException { public void updatePage(String bindName) throws SQLException {
String sql = """ String sql = """
INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2)
@@ -68,6 +83,10 @@ public class Crawl_StateDB
ps.executeUpdate(); ps.executeUpdate();
} }
} }
public void updateletter(String bindName)
{
}
public void Close() throws SQLException public void Close() throws SQLException
{ {
@@ -0,0 +1,5 @@
package org.sillyjirafe.json;
public class ApiKeys {
}
Binary file not shown.
Binary file not shown.