diff --git a/.metadata/.lock_info b/.metadata/.lock_info index 7cf1fc3..e3cdda6 100644 --- a/.metadata/.lock_info +++ b/.metadata/.lock_info @@ -1,4 +1,4 @@ -#Tue Sep 29 23:22:28 CEST 2026 -display=\:0 -process-id=7 -user=kotama +#Sat Oct 10 23:02:27 CEST 2026 +host=fedora +process-id=3 +user=Kotama_Chio diff --git a/.metadata/.log b/.metadata/.log index 02e4171..c8c2e56 100644 --- a/.metadata/.log +++ b/.metadata/.log @@ -2119,3 +2119,308 @@ Caused by: java.net.UnknownHostException: CelesteKC-PC: Name or service not know !ENTRY ch.qos.logback.classic 1 0 2026-09-29 23:22:28.792 !MESSAGE Logback config file: /home/kotama/Silly-Jirafe/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.101.20251017-1242.xml +!SESSION 2026-10-04 17:06:10.851 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-04 17:06:12.147 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY org.eclipse.core.resources 4 567 2026-10-04 17:08:06.208 +!MESSAGE Workspace restored, but some problems occurred. +!SUBENTRY 1 org.eclipse.core.resources 4 567 2026-10-04 17:08:06.208 +!MESSAGE Could not read metadata for '.org.eclipse.egit.core.cmp'. +!STACK 1 +org.eclipse.core.internal.resources.ResourceException(/.org.eclipse.egit.core.cmp)[567]: java.lang.Exception: The project description file (.project) for '.org.eclipse.egit.core.cmp' is missing. This file contains important information about the project. The project will not function properly until this file is restored. + at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42) + at org.eclipse.core.internal.resources.ResourceException.(ResourceException.java:38) + at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:1023) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:1004) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:983) + at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:825) + at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1689) + at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2677) + at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2369) + at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:591) + at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:1) + at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:947) + at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) + at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:257) + at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184) + at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:324) + at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:267) + at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:565) + at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:838) + at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) + at java.base/java.security.AccessController.doPrivileged(AccessController.java:251) + at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:830) + at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:780) + at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1071) + at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:394) + at org.eclipse.osgi.container.Module.doStart(Module.java:643) + at org.eclipse.osgi.container.Module.start(Module.java:500) + at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:528) + at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122) + at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:620) + at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:353) + at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:418) + at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:41) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:523) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:439) + at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:195) + at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490) + at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:194) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) + at java.base/java.lang.reflect.Method.invoke(Method.java:565) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563) + at org.eclipse.equinox.launcher.Main.run(Main.java:1415) + at org.eclipse.equinox.launcher.Main.main(Main.java:1387) +!SUBENTRY 2 org.eclipse.core.resources 4 567 2026-10-04 17:08:06.210 +!MESSAGE The project description file (.project) for '.org.eclipse.egit.core.cmp' is missing. This file contains important information about the project. The project will not function properly until this file is restored. +!STACK 0 +java.lang.Exception: The project description file (.project) for '.org.eclipse.egit.core.cmp' is missing. This file contains important information about the project. The project will not function properly until this file is restored. + at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42) + at org.eclipse.core.internal.resources.ResourceException.(ResourceException.java:38) + at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:1023) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:1004) + at org.eclipse.core.internal.resources.SaveManager.restoreMetaInfo(SaveManager.java:983) + at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:825) + at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1689) + at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:2677) + at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:2369) + at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:591) + at org.eclipse.core.resources.ResourcesPlugin$WorkspaceInitCustomizer.addingService(ResourcesPlugin.java:1) + at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:947) + at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1) + at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:257) + at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:184) + at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:324) + at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:267) + at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:565) + at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:838) + at org.eclipse.osgi.internal.framework.BundleContextImpl$2.run(BundleContextImpl.java:1) + at java.base/java.security.AccessController.doPrivileged(AccessController.java:251) + at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:830) + at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:780) + at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:1071) + at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:394) + at org.eclipse.osgi.container.Module.doStart(Module.java:643) + at org.eclipse.osgi.container.Module.start(Module.java:500) + at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:528) + at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122) + at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:620) + at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:353) + at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:418) + at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:41) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:523) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:439) + at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:195) + at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:490) + at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:194) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) + at java.base/java.lang.reflect.Method.invoke(Method.java:565) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563) + at org.eclipse.equinox.launcher.Main.run(Main.java:1415) + at org.eclipse.equinox.launcher.Main.main(Main.java:1387) + +!ENTRY ch.qos.logback.classic 1 0 2026-10-04 17:08:06.460 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml +!SESSION 2026-10-04 22:23:01.219 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-04 22:23:04.077 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-04 22:27:28.053 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml +!SESSION 2026-10-06 13:16:14.328 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-06 13:16:16.870 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-06 13:16:26.800 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml +!SESSION 2026-10-07 00:08:01.488 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-07 00:08:05.027 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-07 00:08:11.894 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml + +!ENTRY org.eclipse.e4.ui.workbench 4 0 2026-10-07 00:08:12.044 +!MESSAGE Unable to load resource file:/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +!STACK 0 +org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.xml.sax.SAXParseExceptionpublicId: file:/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi; systemId: file:/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi; lineNumber: 1; columnNumber: 1; Premature end of file. + at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319) + at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278) + at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406) + at org.eclipse.e4.ui.internal.workbench.ResourceHandler.getResource(ResourceHandler.java:287) + at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadResource(ResourceHandler.java:263) + at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:166) + at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:394) + at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:255) + at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:599) + at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) + at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583) + at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) + at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:193) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) + at java.base/java.lang.reflect.Method.invoke(Method.java:565) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563) + at org.eclipse.equinox.launcher.Main.run(Main.java:1415) + at org.eclipse.equinox.launcher.Main.main(Main.java:1387) +Caused by: org.xml.sax.SAXParseExceptionpublicId: file:/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi; systemId: file:/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi; lineNumber: 1; columnNumber: 1; Premature end of file. + at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) + at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1465) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1043) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:635) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:113) + at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:551) + at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:890) + at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:826) + at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:137) + at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1225) + at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:629) + at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:328) + at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175) + at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:260) + at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1563) + at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1342) + at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259) + at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274) + ... 22 more + +!ENTRY org.eclipse.e4.ui.workbench 4 0 2026-10-07 00:08:12.045 +!MESSAGE The persisted application model has no top-level window. Reinitializing with the default application model. +!STACK 0 +java.lang.Exception + at org.eclipse.e4.ui.internal.workbench.ResourceHandler.loadMostRecentModel(ResourceHandler.java:171) + at org.eclipse.e4.ui.internal.workbench.swt.E4Application.loadApplicationModel(E4Application.java:394) + at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:255) + at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:599) + at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) + at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583) + at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) + at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:193) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) + at java.base/java.lang.reflect.Method.invoke(Method.java:565) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563) + at org.eclipse.equinox.launcher.Main.run(Main.java:1415) + at org.eclipse.equinox.launcher.Main.main(Main.java:1387) +!SESSION 2026-10-07 16:37:19.753 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-07 16:37:21.324 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-07 16:37:34.953 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml +!SESSION 2026-10-07 21:49:54.200 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-07 21:49:56.947 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-07 21:50:00.010 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml + +!ENTRY org.eclipse.oomph.ui 4 0 2026-10-07 21:50:13.676 +!MESSAGE java.lang.ExceptionInInitializerError +!STACK 0 +java.lang.ExceptionInInitializerError + at org.eclipse.oomph.setup.ui.recorder.RecorderManager.(RecorderManager.java:114) + at org.eclipse.oomph.setup.ui.SetupUIPlugin.performStartup(SetupUIPlugin.java:230) + at org.eclipse.oomph.setup.ui.EarlyStartup.earlyStartup(EarlyStartup.java:23) + at org.eclipse.oomph.internal.ui.EarlyStart.run(EarlyStart.java:119) + at org.eclipse.oomph.internal.ui.EarlyStart$1.run(EarlyStart.java:98) + at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) +Caused by: java.lang.NullPointerException: Cannot invoke "org.osgi.framework.BundleContext.getServiceReference(java.lang.Class)" because "context" is null + at org.eclipse.oomph.p2.internal.core.AgentManagerImpl.getCurrentAgent(AgentManagerImpl.java:207) + at org.eclipse.oomph.p2.core.P2Util.getCurrentProvisioningAgent(P2Util.java:117) + at org.eclipse.oomph.setup.internal.core.util.SetupCoreUtil.(SetupCoreUtil.java:158) + ... 6 more +!SESSION 2026-10-09 18:49:48.691 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-09 18:49:50.177 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-09 18:50:02.098 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml +!SESSION 2026-10-10 23:02:21.698 ----------------------------------------------- +eclipse.buildId=4.41.0.20260903-0719 +java.version=25.0.4.1 +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-10-10 23:02:24.629 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-10-10 23:02:27.597 +!MESSAGE Logback config file: /home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/10/70c62013f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/10/70c62013f6c400111df49ed417024990 new file mode 100644 index 0000000..c9caaa7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/10/70c62013f6c400111df49ed417024990 @@ -0,0 +1,150 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/60e214e0f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/12/60e214e0f6c400111df49ed417024990 new file mode 100644 index 0000000..94d43bc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/12/60e214e0f6c400111df49ed417024990 @@ -0,0 +1,176 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 setRnd(String bindName, String c) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = (rnd) + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextLetter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + setRnd(bindName, nextLetter(getRND(bindName))); + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/10cc268204c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/13/10cc268204c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..622cada --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/10cc268204c400111cb8bdc7cf3c164b @@ -0,0 +1,44 @@ +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.sillyjirafe.uoapi.element; + +public class PixabayImagesApi implements Api +{ + public String getName() + { + return "PixabayImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://pixabay.com/api/?per_page=200&page=" + page + "&key=" + apikey; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + try { + JSONObject json = new JSONObject(jsonRaw); + JSONArray items = json.getJSONArray("hits"); + + for (int i = 0; i < items.length(); i++) { + JSONObject repo = items.getJSONObject(i); + + String titre = repo.getString("name"); + String url = repo.getString("pageURL"); + String licence = "cc0"; + + resultats.add(new element(titre, url, licence, "pixabay", "image")); + } + } catch (org.json.JSONException e) { + System.out.println("error but continue : " + e.getMessage()); + } + + return resultats; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/70274f1af6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/14/70274f1af6c400111df49ed417024990 new file mode 100644 index 0000000..64e9512 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/14/70274f1af6c400111df49ed417024990 @@ -0,0 +1,151 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + public void AddEllement(String bind, int lastpage) throws SQLException + { + try (PreparedStatement ps = connection.prepareStatement(insertSql)) + { + ps.setString(1, bind); + ps.setInt(2, lastpage); + ps.setString(3, rnd); + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/b0b7139b04c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/15/b0b7139b04c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..e465b65 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/15/b0b7139b04c400111cb8bdc7cf3c164b @@ -0,0 +1,44 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubApacheApi implements Api +{ + public String getName() + { + return "GitHubApacheApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd +"&license:apache-2.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1f/b0f9df8708c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/b0f9df8708c00011172cdbfe202768b4 new file mode 100644 index 0000000..9e66328 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/b0f9df8708c00011172cdbfe202768b4 @@ -0,0 +1,46 @@ +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.*; + +public class Out { + List Apis = new ArrayList<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys) throws Exception + { + List Elements = new ArrayList<>(); + + for (int i = 0; i < Apis.size(); i++) + { + List currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName())); + for (int j = 0; j < currentapi.size(); j++) + { + Elements.add(currentapi.get(j)); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f06fab710bc00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f06fab710bc00011172cdbfe202768b4 new file mode 100644 index 0000000..7b8ef70 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f06fab710bc00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?q=\n" + rnd+"\nformat=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/32/d08d9f8704c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/32/d08d9f8704c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..b4cb8dc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/32/d08d9f8704c400111cb8bdc7cf3c164b @@ -0,0 +1,41 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?q=\"" + rnd+"\"format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/33/a049588e04c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/33/a049588e04c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..0e8d748 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/33/a049588e04c400111cb8bdc7cf3c164b @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseAudiosApi implements Api +{ + public String getName() + { + return "OpenVerseAudiosApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/audio/?q=\""+ rnd +"\"format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + try { + JSONObject json = new JSONObject(jsonRaw); + JSONArray items = json.getJSONArray("results"); + + for (int i = 0; i < items.length(); i++) { + JSONObject audio = items.getJSONObject(i); + + String titre = audio.getString("title"); + String url = audio.getString("url"); + String licence = audio.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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/e0f1bd98f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/36/e0f1bd98f6c400111df49ed417024990 new file mode 100644 index 0000000..90a0348 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/36/e0f1bd98f6c400111df49ed417024990 @@ -0,0 +1,164 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextletter(String actuelle) { + char[] lettres = actuelle.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/10ec90ddf5c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/42/10ec90ddf5c400111df49ed417024990 new file mode 100644 index 0000000..59ba54d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/42/10ec90ddf5c400111df49ed417024990 @@ -0,0 +1,150 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/e0d2c04c09c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/46/e0d2c04c09c00011172cdbfe202768b4 new file mode 100644 index 0000000..374f6b8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/46/e0d2c04c09c00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey) { + return "https://api.openverse.org/v1/images/?format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/a036b32df4c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/48/a036b32df4c400111df49ed417024990 new file mode 100644 index 0000000..814fd0b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/a036b32df4c400111df49ed417024990 @@ -0,0 +1,138 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + public void updatePage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/f016796cf6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/48/f016796cf6c400111df49ed417024990 new file mode 100644 index 0000000..c9caaa7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/f016796cf6c400111df49ed417024990 @@ -0,0 +1,150 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4c/f075516b0bc00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/4c/f075516b0bc00011172cdbfe202768b4 new file mode 100644 index 0000000..b5fe9db --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4c/f075516b0bc00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5/7048543407c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/5/7048543407c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..2ba01b5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5/7048543407c400111cb8bdc7cf3c164b @@ -0,0 +1,55 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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(); + + Map succes = Out.getSucces(); + + List bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String name : bindNames) { + pages.put(name, crawlstateDB.getPage(name)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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) { + if (succes.getOrDefault(name, false)) { + crawlstateDB.updatePage(name); + } else { + crawlstateDB.addError(name); + } + } + + elementDB.Close(); + crawlstateDB.Close(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/60921e7232c000111f03948f332b9f8f b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/60921e7232c000111f03948f332b9f8f new file mode 100644 index 0000000..8dcae06 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/60921e7232c000111f03948f332b9f8f @@ -0,0 +1,49 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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 bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read()); + + 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(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/10d1577f34c000111f03948f332b9f8f b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/10d1577f34c000111f03948f332b9f8f new file mode 100644 index 0000000..be75e11 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/10d1577f34c000111f03948f332b9f8f @@ -0,0 +1,98 @@ +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, error) 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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/f03b59d5f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/62/f03b59d5f6c400111df49ed417024990 new file mode 100644 index 0000000..c0ee084 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/62/f03b59d5f6c400111df49ed417024990 @@ -0,0 +1,175 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 setRnd(String bindName, String c) 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextletter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/64/70eb9fa0f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/64/70eb9fa0f6c400111df49ed417024990 new file mode 100644 index 0000000..f8b3884 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/64/70eb9fa0f6c400111df49ed417024990 @@ -0,0 +1,175 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 setRnd(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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextletter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/64/b015d21512c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/64/b015d21512c00011172cdbfe202768b4 new file mode 100644 index 0000000..4cbd546 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/64/b015d21512c00011172cdbfe202768b4 @@ -0,0 +1,46 @@ +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.*; + +public class Out { + List Apis = new ArrayList<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys, Map Rnds) throws Exception + { + List Elements = new ArrayList<>(); + + for (int i = 0; i < Apis.size(); i++) + { + List currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName()), ); + for (int j = 0; j < currentapi.size(); j++) + { + Elements.add(currentapi.get(j)); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0a50174f6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0a50174f6c400111df49ed417024990 new file mode 100644 index 0000000..342feff --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/65/e0a50174f6c400111df49ed417024990 @@ -0,0 +1,164 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String lettreSuivante(String actuelle) { + char[] lettres = actuelle.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/f020e31f07c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/65/f020e31f07c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..c051031 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/65/f020e31f07c400111cb8bdc7cf3c164b @@ -0,0 +1,99 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/a03897eff6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/a03897eff6c400111df49ed417024990 new file mode 100644 index 0000000..cf364d6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/a03897eff6c400111df49ed417024990 @@ -0,0 +1,177 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 setRnd(String bindName, String c) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = (rnd) + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.setString(2, c); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextLetter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + setRnd(bindName, nextLetter(getRND(bindName))); + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/902dbd2106c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/902dbd2106c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..3f4689d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/902dbd2106c400111cb8bdc7cf3c164b @@ -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.*; + +public class Out { + List Apis = new ArrayList<>(); + Map Succes = new HashMap<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys, Map Rnds) throws Exception + { + List Elements = new ArrayList<>(); + + + for (Api api : Apis) { + try { + List currentapi = Caller.CallApi(api, bindpages.get(api.getName())); + Elements.addAll(currentapi); + Succes.put(api.getName(), true); + } catch (Exception e) { + System.out.println("Erreur pour " + api.getName() + " : " + e.getMessage()); + Succes.put(api.getName(), false); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/e004ec7b09c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/74/e004ec7b09c00011172cdbfe202768b4 new file mode 100644 index 0000000..e207f31 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/e004ec7b09c00011172cdbfe202768b4 @@ -0,0 +1,45 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubLGPLApi implements Api +{ + + public String getName() + { + return "GitHubLGPLApi"; + } + + public String getURL(int page, String apikey) { + return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/0085db3606c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/75/0085db3606c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..ca34f5c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/0085db3606c400111cb8bdc7cf3c164b @@ -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.*; + +public class Out { + List Apis = new ArrayList<>(); + Map Succes = new HashMap<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys, Map Rnds) throws Exception + { + List Elements = new ArrayList<>(); + + + for (Api api : Apis) { + try { + List currentapi = Caller.CallApi(api, bindpages.get(api.getName()), ApiKeys.get(api.getName()), Rnds.get(api.getName())); + Elements.addAll(currentapi); + Succes.put(api.getName(), true); + } catch (Exception e) { + System.out.println("Erreur pour " + api.getName() + " : " + e.getMessage()); + Succes.put(api.getName(), false); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/400f195c32c000111f03948f332b9f8f b/.metadata/.plugins/org.eclipse.core.resources/.history/75/400f195c32c000111f03948f332b9f8f new file mode 100644 index 0000000..c81c71c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/400f195c32c000111f03948f332b9f8f @@ -0,0 +1,44 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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 bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read()); + + 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(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/002a5ce409c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/77/002a5ce409c00011172cdbfe202768b4 new file mode 100644 index 0000000..d7f1e29 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/77/002a5ce409c00011172cdbfe202768b4 @@ -0,0 +1,45 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubLGPLApi implements Api +{ + + public String getName() + { + return "GitHubLGPLApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/a05b47eaf6c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/81/a05b47eaf6c400111df49ed417024990 new file mode 100644 index 0000000..1608fa1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/81/a05b47eaf6c400111df49ed417024990 @@ -0,0 +1,177 @@ +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, error) 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', + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 setRnd(String bindName, String c) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = (rnd) + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextLetter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + setRnd(bindName, nextLetter(getRND(bindName))); + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/e080dc130ac00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/81/e080dc130ac00011172cdbfe202768b4 new file mode 100644 index 0000000..86ecc7c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/81/e080dc130ac00011172cdbfe202768b4 @@ -0,0 +1,45 @@ +package org.sillyjirafe.uoapi.binds; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.sillyjirafe.uoapi.Api; +import org.sillyjirafe.uoapi.element; +import java.util.ArrayList; +import java.util.List; + +public class GitHubMITApi implements Api +{ + + public String getName() + { + return "GitHubMITApi"; + } + + public String getURL(int page, String apikey) { + return "https://api.github.com/search/repositories?q=license:mit&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/20dd1153f4c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/20dd1153f4c400111df49ed417024990 new file mode 100644 index 0000000..782ee7e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/20dd1153f4c400111df49ed417024990 @@ -0,0 +1,139 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + public void updatePage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/98/f0f63d9506c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/98/f0f63d9506c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..61e44da --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/98/f0f63d9506c400111cb8bdc7cf3c164b @@ -0,0 +1,49 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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 bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/2064a8c906c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/2064a8c906c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..52f94c0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/2064a8c906c400111cb8bdc7cf3c164b @@ -0,0 +1,55 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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(); + + Map succes = Out.getSucces(); + + List bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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) { + if (Succes.getOrDefault(nom, false)) { + crawlstateDB.updatePage(nom, ...); // succès normal, avance + } else { + crawlstateDB.incrementError(nom); // échec, compte une erreur de plus + } + } + + elementDB.Close(); + crawlstateDB.Close(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/30eaaa9704c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/a/30eaaa9704c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..a5191d3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a/30eaaa9704c400111cb8bdc7cf3c164b @@ -0,0 +1,45 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubLGPLApi implements Api +{ + + public String getName() + { + return "GitHubLGPLApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd + "&license:lgpl-3.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f0d48b8908c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f0d48b8908c00011172cdbfe202768b4 new file mode 100644 index 0000000..9953657 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f0d48b8908c00011172cdbfe202768b4 @@ -0,0 +1,46 @@ +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.*; + +public class Out { + List Apis = new ArrayList<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys, Map Rnd) throws Exception + { + List Elements = new ArrayList<>(); + + for (int i = 0; i < Apis.size(); i++) + { + List currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName()), ); + for (int j = 0; j < currentapi.size(); j++) + { + Elements.add(currentapi.get(j)); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/10925e9d04c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/10925e9d04c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..8894433 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/10925e9d04c400111cb8bdc7cf3c164b @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubApacheApi implements Api +{ + public String getName() + { + return "GitHubApacheApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd +"&license:apache-2.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d076c89b06c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d076c89b06c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..12fcf8a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d076c89b06c400111cb8bdc7cf3c164b @@ -0,0 +1,54 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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(); + Map succes = Out.getSucces(); + + List bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String nom : bindNames) { + pages.put(nom, crawlstateDB.getPage(nom)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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) { + if (Succes.getOrDefault(nom, false)) { + crawlstateDB.updatePage(nom, ...); // succès normal, avance + } else { + crawlstateDB.incrementError(nom); // échec, compte une erreur de plus + } + } + + elementDB.Close(); + crawlstateDB.Close(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/704c69620ac00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/704c69620ac00011172cdbfe202768b4 new file mode 100644 index 0000000..09f66e8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/704c69620ac00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseAudiosApi implements Api +{ + public String getName() + { + return "OpenVerseAudiosApi"; + } + + public String getURL(int page, String apikey) { + return "https://api.openverse.org/v1/audio/?format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + try { + JSONObject json = new JSONObject(jsonRaw); + JSONArray items = json.getJSONArray("results"); + + for (int i = 0; i < items.length(); i++) { + JSONObject audio = items.getJSONObject(i); + + String titre = audio.getString("title"); + String url = audio.getString("url"); + String licence = audio.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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/90ded46f34c000111f03948f332b9f8f b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/90ded46f34c000111f03948f332b9f8f new file mode 100644 index 0000000..bdb753f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/90ded46f34c000111f03948f332b9f8f @@ -0,0 +1,98 @@ +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, error) 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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/807712faf2c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/807712faf2c400111df49ed417024990 new file mode 100644 index 0000000..1d2d73f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/807712faf2c400111df49ed417024990 @@ -0,0 +1,124 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + public void updatePage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/f0727e6e0bc00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/af/f0727e6e0bc00011172cdbfe202768b4 new file mode 100644 index 0000000..977dc6b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/af/f0727e6e0bc00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?q=\n" + rnd+"format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/a07daf8504c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/a07daf8504c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..d61778d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/a07daf8504c400111cb8bdc7cf3c164b @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseImagesApi implements Api +{ + public String getName() + { + return "OpenVerseImagesApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?q=\"" + rnd+"\"format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b0ac309304c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b0ac309304c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..15be581 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b0ac309304c400111cb8bdc7cf3c164b @@ -0,0 +1,45 @@ +package org.sillyjirafe.uoapi.binds; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.sillyjirafe.uoapi.Api; +import org.sillyjirafe.uoapi.element; +import java.util.ArrayList; +import java.util.List; + +public class GitHubMITApi implements Api +{ + + public String getName() + { + return "GitHubMITApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd +"&license:mit&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/20627759efc400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/20627759efc400111df49ed417024990 new file mode 100644 index 0000000..044a95f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/20627759efc400111df49ed417024990 @@ -0,0 +1,110 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02fc13f09c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02fc13f09c00011172cdbfe202768b4 new file mode 100644 index 0000000..a90a8d9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/e02fc13f09c00011172cdbfe202768b4 @@ -0,0 +1,44 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubApacheApi implements Api +{ + public String getName() + { + return "GitHubApacheApi"; + } + + public String getURL(int page, String apikey) { + return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/102ee08534c000111f03948f332b9f8f b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/102ee08534c000111f03948f332b9f8f new file mode 100644 index 0000000..f8cbd23 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/102ee08534c000111f03948f332b9f8f @@ -0,0 +1,99 @@ +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, error) 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' + error INTEGER DEFAULT 0, + ) + """); + } + } + + 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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/e089fc3ef7c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/e089fc3ef7c400111df49ed417024990 new file mode 100644 index 0000000..201e51d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/e089fc3ef7c400111df49ed417024990 @@ -0,0 +1,55 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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(); + + Map succes = Out.getSucces(); + + List bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String name : bindNames) { + pages.put(name, crawlstateDB.getPage(name)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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) { + if (succes.getOrDefault(name, false)) { + crawlstateDB.updatePage(name); + } else { + crawlstateDB.newError(name); + } + } + + elementDB.Close(); + crawlstateDB.Close(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/70518d0c0ac00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/70518d0c0ac00011172cdbfe202768b4 new file mode 100644 index 0000000..48fff06 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/70518d0c0ac00011172cdbfe202768b4 @@ -0,0 +1,44 @@ +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.sillyjirafe.uoapi.element; + +public class GitHubApacheApi implements Api +{ + public String getName() + { + return "GitHubApacheApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page; + } + + public List Parse(String jsonRaw) { + List 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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d3/c07f09c3f4c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/d3/c07f09c3f4c400111df49ed417024990 new file mode 100644 index 0000000..8e39869 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d3/c07f09c3f4c400111df49ed417024990 @@ -0,0 +1,150 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 = las_page + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/90ecb886efc400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/90ecb886efc400111df49ed417024990 new file mode 100644 index 0000000..3ec913f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/90ecb886efc400111df49ed417024990 @@ -0,0 +1,124 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + public void updatePage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/db/008289a5f5c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/db/008289a5f5c400111df49ed417024990 new file mode 100644 index 0000000..59663c4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/db/008289a5f5c400111df49ed417024990 @@ -0,0 +1,150 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 = las_page + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + resetPage(bindName); + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/201ff32c0bc00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/201ff32c0bc00011172cdbfe202768b4 new file mode 100644 index 0000000..9cd394c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/201ff32c0bc00011172cdbfe202768b4 @@ -0,0 +1,43 @@ +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.sillyjirafe.uoapi.element; + +public class OpenVerseAudiosApi implements Api +{ + public String getName() + { + return "OpenVerseAudiosApi"; + } + + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/audio/?q="+ rnd +"format=json&page=" + page; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + try { + JSONObject json = new JSONObject(jsonRaw); + JSONArray items = json.getJSONArray("results"); + + for (int i = 0; i < items.length(); i++) { + JSONObject audio = items.getJSONObject(i); + + String titre = audio.getString("title"); + String url = audio.getString("url"); + String licence = audio.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; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e5/a0328082f4c400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/e5/a0328082f4c400111df49ed417024990 new file mode 100644 index 0000000..dce5ece --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e5/a0328082f4c400111df49ed417024990 @@ -0,0 +1,139 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } + 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 = las_page + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void updateletter(String bindName) throws SQLException + { + if (getErrors(bindName) >= 10) + { + resetError(bindName); + + } + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/e03b774b09c00011172cdbfe202768b4 b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/e03b774b09c00011172cdbfe202768b4 new file mode 100644 index 0000000..05c0619 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/e03b774b09c00011172cdbfe202768b4 @@ -0,0 +1,44 @@ +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.sillyjirafe.uoapi.element; + +public class PixabayImagesApi implements Api +{ + public String getName() + { + return "PixabayImagesApi"; + } + + public String getURL(int page, String apikey) { + return "https://pixabay.com/api/?per_page=200&page=" + page + "&key=" + apikey; + } + + public List Parse(String jsonRaw) { + List resultats = new ArrayList<>(); + + try { + JSONObject json = new JSONObject(jsonRaw); + JSONArray items = json.getJSONArray("hits"); + + for (int i = 0; i < items.length(); i++) { + JSONObject repo = items.getJSONObject(i); + + String titre = repo.getString("name"); + String url = repo.getString("pageURL"); + String licence = "cc0"; + + resultats.add(new element(titre, url, licence, "pixabay", "image")); + } + } catch (org.json.JSONException e) { + System.out.println("error but continue : " + e.getMessage()); + } + + return resultats; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/703c2d2607c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/703c2d2607c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..52e7832 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/703c2d2607c400111cb8bdc7cf3c164b @@ -0,0 +1,55 @@ +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.sillyjirafe.json.ApiKeys; +import org.sillyjirafe.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(); + + Map succes = Out.getSucces(); + + List bindNames = Out.PreOut(); + + Map pages = new HashMap<>(); + for (String name : bindNames) { + pages.put(name, crawlstateDB.getPage(name)); + } + + Map rnds = new HashMap<>(); + for (String nom : bindNames) { + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + + List elements = Out.out(pages, ApiKeys.read(), rnds); + + 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) { + if (succes.getOrDefault(name, false)) { + crawlstateDB.updatePage(name); + } else { + crawlstateDB.incrementError(name); // échec, compte une erreur de plus + } + } + + elementDB.Close(); + crawlstateDB.Close(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3038a55eefc400111df49ed417024990 b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3038a55eefc400111df49ed417024990 new file mode 100644 index 0000000..420926e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3038a55eefc400111df49ed417024990 @@ -0,0 +1,124 @@ +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, error) 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' + error INTEGER NOT NULL DEFAULT 0, + ) + """); + } + } + + 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 int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 1; + } + } + } + public void updatePage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = rnd + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void newError(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 updateletter(String bindName) + { + + } + + public void Close() throws SQLException + { + if (connection != null) + { + connection.close(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fe/1005c3d305c400111cb8bdc7cf3c164b b/.metadata/.plugins/org.eclipse.core.resources/.history/fe/1005c3d305c400111cb8bdc7cf3c164b new file mode 100644 index 0000000..88fd04d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fe/1005c3d305c400111cb8bdc7cf3c164b @@ -0,0 +1,46 @@ +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.*; + +public class Out { + List Apis = new ArrayList<>(); + + public List PreOut() + { + Apis.add(new GitHubMITApi()); + Apis.add(new GitHubLGPLApi()); + Apis.add(new GitHubApacheApi()); + Apis.add(new OpenVerseImagesApi()); + Apis.add(new OpenVerseAudiosApi()); + Apis.add(new PixabayImagesApi()); + + List bindnames = new ArrayList<>(); + + for (Api api : Apis) + { + bindnames.add(api.getName()); + } + + return bindnames; + } + + public List out(Map bindpages, Map ApiKeys, Map Rnds) throws Exception + { + List Elements = new ArrayList<>(); + + for (int i = 0; i < Apis.size(); i++) + { + List currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName()), Rnds.get(Apis.get(i).getName())); + for (int j = 0; j < currentapi.size(); j++) + { + Elements.add(currentapi.get(j)); + } + } + return Elements; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location index 7215ce8..eedf3a7 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location and b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.location differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/d6/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/d6/history.index new file mode 100644 index 0000000..bbc3e24 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/d6/history.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/history.index new file mode 100644 index 0000000..c1a220c Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/40/history.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/7e/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/7e/history.index new file mode 100644 index 0000000..6cb6886 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/7e/history.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/d9/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/d9/history.index new file mode 100644 index 0000000..dbcddc7 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.indexes/e4/e4/90/d9/history.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.markers b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.markers index e00f626..466e77a 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.markers and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/.markers differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/org.eclipse.jdt.core/state.dat b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/org.eclipse.jdt.core/state.dat index 5c59b6d..361ae01 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/org.eclipse.jdt.core/state.dat and b/.metadata/.plugins/org.eclipse.core.resources/.projects/SillyJirafe.org/org.eclipse.jdt.core/state.dat differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/.markers b/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/.markers index e1430ee..0560eb3 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/.markers and b/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/.markers differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/org.eclipse.jdt.core/state.dat b/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/org.eclipse.jdt.core/state.dat index 2925fad..f6a05ee 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/org.eclipse.jdt.core/state.dat and b/.metadata/.plugins/org.eclipse.core.resources/.projects/sillyjirafe.org.api/org.eclipse.jdt.core/state.dat differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index index 093f6f6..b24c96a 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index and b/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/37.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/37.tree deleted file mode 100644 index 592f297..0000000 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.root/37.tree and /dev/null differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/45.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/45.tree new file mode 100644 index 0000000..336a044 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.core.resources/.root/45.tree differ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources index 1472d19..82fff88 100644 Binary files a/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources and b/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources differ diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs index 5c428db..816ec37 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_VM_XML=\n\n \n \n \n\n +org.eclipse.jdt.launching.PREF_VM_XML=\n\n \n \n \n\n diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.console.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.console.prefs new file mode 100644 index 0000000..0c47e39 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.console.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +org.eclipse.ui.console.zoomFontHeights=org.eclipse.debug.ui.ProcessConsoleType\=10|0 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs index 0c4d288..29eb330 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -1,6 +1,6 @@ IMPORT_FILES_AND_FOLDERS_RELATIVE=true IMPORT_FILES_AND_FOLDERS_TYPE=23,1 eclipse.preferences.version=1 -platformState=945730117414574 +platformState=943949841082661 quickStart=false tipsAndTricks=true diff --git a/.metadata/.plugins/org.eclipse.debug.core/.launches/Main (3).launch b/.metadata/.plugins/org.eclipse.debug.core/.launches/Main (3).launch index 779890e..6671400 100644 --- a/.metadata/.plugins/org.eclipse.debug.core/.launches/Main (3).launch +++ b/.metadata/.plugins/org.eclipse.debug.core/.launches/Main (3).launch @@ -6,6 +6,7 @@ + diff --git a/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml index fc6b8e4..c4f54c6 100644 --- a/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml +++ b/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml @@ -10,16 +10,16 @@ + + + + - - - - diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/last_nl.properties b/.metadata/.plugins/org.eclipse.e4.workbench/last_nl.properties new file mode 100644 index 0000000..8c81018 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.e4.workbench/last_nl.properties @@ -0,0 +1,3 @@ +#Eclipse last used NL locale +#Sat Oct 10 23:02:27 CEST 2026 +eclipse.last.nl=en_US diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index 5118f45..76f1afb 100644 --- a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -1,28 +1,28 @@ - - + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration - + - - + + topLevel shellMaximized - - - + + + + persp.actionSet:org.eclipse.search.searchActionSet + persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation persp.actionSet:org.eclipse.ui.cheatsheets.actionSet - persp.actionSet:org.eclipse.search.searchActionSet persp.actionSet:org.eclipse.text.quicksearch.actionSet persp.actionSet:org.eclipse.ui.edit.text.actionSet.annotationNavigation persp.actionSet:org.eclipse.ui.edit.text.actionSet.navigation persp.actionSet:org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo - persp.actionSet:org.eclipse.ui.externaltools.ExternalToolsSet persp.actionSet:org.eclipse.ui.actionSet.keyBindings persp.actionSet:org.eclipse.ui.actionSet.openFiles persp.actionSet:org.eclipse.debug.ui.launchActionSet @@ -45,11 +45,13 @@ persp.newWizSC:org.eclipse.jdt.ui.wizards.JavaProjectWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewPackageCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewClassCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewCompactCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewEnumCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewRecordCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard + persp.newWizSC:org.eclipse.jdt.ui.wizards.NewTestSourceFolderCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard persp.newWizSC:org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard persp.newWizSC:org.eclipse.ui.wizards.new.folder @@ -80,97 +82,97 @@ persp.editorOnboardingCommand:Show Key Assist$$$Shift+Ctrl+L persp.editorOnboardingCommand:New$$$Ctrl+N persp.editorOnboardingCommand:Open Type$$$Shift+Ctrl+T - - - + + + org.eclipse.e4.primaryNavigationStack - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Java - - + + View categoryTag:Git - - - - + + + + org.eclipse.e4.secondaryNavigationStack - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Mylyn - + View categoryTag:Java - + View categoryTag:Ant - + org.eclipse.e4.secondaryDataStack - Minimized - + Oomph + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Terminal @@ -179,1307 +181,1289 @@ - - + + View categoryTag:Help - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:Help - + - View categoryTag:General - - ViewMenu - menuContribution:menu - - - + View categoryTag:Help - - + + EditorStack org.eclipse.e4.primaryDataStack active - noFocus - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor active activeOnClose - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - + + + Editor + removeOnHide + org.eclipse.jdt.ui.CompilationUnitEditor + + + + Editor + removeOnHide + org.eclipse.jdt.ui.CompilationUnitEditor + + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - + - + View categoryTag:Java - + ViewMenu menuContribution:menu - + - + View categoryTag:Java - + View categoryTag:General - + - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + + View categoryTag:Java + + ViewMenu + menuContribution:menu + + - + + View categoryTag:Java + + ViewMenu + menuContribution:menu + + - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:General - + - View categoryTag:Mylyn - - ViewMenu - menuContribution:menu - - - + View categoryTag:Terminal - + View categoryTag:Java - + View categoryTag:Git - + View categoryTag:Java - + View categoryTag:Ant - - + + toolbarSeparator - + - + Draggable - + - + toolbarSeparator - + - + Draggable - - + + - + toolbarSeparator - + - + Draggable - + Draggable - + Draggable - + Draggable - + toolbarSeparator - + - + Draggable - + - + toolbarSeparator - + - + toolbarSeparator - + - + Draggable - + stretch SHOW_RESTORE_MENU - + Draggable HIDEABLE SHOW_RESTORE_MENU - - + + stretch - + Draggable - - Draggable - - - - - TrimStack - Draggable - - - TrimStack - Draggable - - - - - TrimStack - Draggable - - - TrimStack + Draggable + + - - - - - - - - - - - - - + + + + + + + + + + + + + platform:gtk - - - - + + + + platform:gtk - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - - - + + + + + + + - - + + + + - - - + + + + - - - - - + + + + - - + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + platform:gtk - - - - - + + + + + - - + + - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + - - - - - - - + + - - - - + + + + + + + - - - - - - - - + + + + - - + + + + + + + - - - - - - + + + + + + + + - - - - - - + + - - - - - - - - + + + + + + - - + + - - - - + + + + + + - - + + - - + + + + + + + + + - - - + + + + - - + + - - + + - - + + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor removeOnHide - - - - View - categoryTag:Ant - - + View categoryTag:Gradle - + View categoryTag:Gradle - + + + + View + categoryTag:Java + + + + + View + categoryTag:Java + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Maven + + + + + View + categoryTag:Oomph + + + + + View + categoryTag:General + + + View + categoryTag:Help + + + + + View + categoryTag:General + + + + + View + categoryTag:Ant + + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git NoRestore - + View categoryTag:Git - + View categoryTag:Help - - - - View - categoryTag:Java - - - - - View - categoryTag:Java - - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Language Servers - + View categoryTag:Language Servers - + View categoryTag:Language Servers - - - - View - categoryTag:Maven - - - - - View - categoryTag:Maven - - - - - View - categoryTag:Maven - - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - - - - View - categoryTag:Oomph - - + View categoryTag:Oomph NoRestore - + View categoryTag:Plug-in Development - - - - View - categoryTag:General - - + View categoryTag:Version Control (Team) - + View categoryTag:Version Control (Team) - + View categoryTag:Terminal - - View - categoryTag:Help - - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - - - - View - categoryTag:General - - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View @@ -1502,1070 +1486,1088 @@ SHOW_RESTORE_MENU - - - - - + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index b/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index index 31fc136..def58f2 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index and b/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/206920101.index b/.metadata/.plugins/org.eclipse.jdt.core/206920101.index index faefc75..aeefcd3 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/206920101.index and b/.metadata/.plugins/org.eclipse.jdt.core/206920101.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/32071656.index b/.metadata/.plugins/org.eclipse.jdt.core/2407587206.index similarity index 100% rename from .metadata/.plugins/org.eclipse.jdt.core/32071656.index rename to .metadata/.plugins/org.eclipse.jdt.core/2407587206.index diff --git a/.metadata/.plugins/org.eclipse.jdt.core/263131634.index b/.metadata/.plugins/org.eclipse.jdt.core/263131634.index index ca4b35f..18dffc8 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/263131634.index and b/.metadata/.plugins/org.eclipse.jdt.core/263131634.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1568060524.index b/.metadata/.plugins/org.eclipse.jdt.core/2910310629.index similarity index 76% rename from .metadata/.plugins/org.eclipse.jdt.core/1568060524.index rename to .metadata/.plugins/org.eclipse.jdt.core/2910310629.index index fccb1f4..2c97b9f 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/1568060524.index and b/.metadata/.plugins/org.eclipse.jdt.core/2910310629.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/2916335905.index b/.metadata/.plugins/org.eclipse.jdt.core/2916335905.index new file mode 100644 index 0000000..8b25348 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/2916335905.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/4203645977.index b/.metadata/.plugins/org.eclipse.jdt.core/3079814413.index similarity index 100% rename from .metadata/.plugins/org.eclipse.jdt.core/4203645977.index rename to .metadata/.plugins/org.eclipse.jdt.core/3079814413.index diff --git a/.metadata/.plugins/org.eclipse.jdt.core/3263143359.index b/.metadata/.plugins/org.eclipse.jdt.core/3263143359.index new file mode 100644 index 0000000..2088f50 Binary files /dev/null and b/.metadata/.plugins/org.eclipse.jdt.core/3263143359.index differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache b/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache index 593f470..46e0626 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache and b/.metadata/.plugins/org.eclipse.jdt.core/assumedExternalFilesCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache index 4775374..dad6b1b 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache and b/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps b/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps index 89f1d21..453f792 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps and b/.metadata/.plugins/org.eclipse.jdt.core/externalLibsTimeStamps differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache b/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache index 46e0626..421fe73 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache and b/.metadata/.plugins/org.eclipse.jdt.core/nonChainingJarsCache differ diff --git a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt index c2b48b0..ced6046 100644 --- a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt +++ b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt @@ -1,7 +1,9 @@ -INDEX VERSION 1.134+/home/kotama/Silly-Jirafe/.metadata/.plugins/org.eclipse.jdt.core -1568060524.index -4203645977.index -1865797976.index -206920101.index +INDEX VERSION 1.134+/home/Kotama_Chio/Musique/SillyBlahaj.org/Java/.metadata/.plugins/org.eclipse.jdt.core 263131634.index -32071656.index +2407587206.index +2916335905.index +3079814413.index +3263143359.index +206920101.index +2910310629.index +1865797976.index diff --git a/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat b/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat index 03c47c5..6cac2df 100644 Binary files a/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat and b/.metadata/.plugins/org.eclipse.jdt.core/variablesAndContainers.dat differ diff --git a/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml b/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml index 1b24159..8833d08 100644 --- a/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml +++ b/.metadata/.plugins/org.eclipse.jdt.launching/.install.xml @@ -2,4 +2,6 @@ + + diff --git a/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml b/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml index 523ff82..1fb4cde 100644 --- a/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml +++ b/.metadata/.plugins/org.eclipse.jdt.launching/libraryInfos.xml @@ -12,4 +12,16 @@ + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml index 8e95157..256e201 100644 --- a/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml +++ b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -2,13 +2,13 @@
- +
- +
diff --git a/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.history b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.history new file mode 100644 index 0000000..695eba8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.history @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.index b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.index new file mode 100644 index 0000000..d376ac1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.ltk.core.refactoring/.refactorings/SillyJirafe.org/2026/10/41/refactorings.index @@ -0,0 +1 @@ +1791564728729 Copy folder diff --git a/.metadata/.plugins/org.eclipse.m2e.logback/0.log b/.metadata/.plugins/org.eclipse.m2e.logback/0.log index e4625b9..26e78c3 100644 --- a/.metadata/.plugins/org.eclipse.m2e.logback/0.log +++ b/.metadata/.plugins/org.eclipse.m2e.logback/0.log @@ -39,3 +39,11 @@ 2026-09-22 16:37:19,751 [Worker-7: 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-25 09:23:41,947 [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-09-29 23:22:34,391 [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-10-04 17:08:14,297 [Worker-1: 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-10-04 22:27:35,351 [Worker-1: 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-10-06 13:16:34,293 [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-10-07 00:08:16,911 [Worker-8: 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-10-07 16:37:42,461 [Worker-2: 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-10-07 21:50:08,486 [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-10-09 18:50:09,616 [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-10-10 23:02:35,211 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is out-of-date. Trying to update. diff --git a/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml b/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml new file mode 100644 index 0000000..9effde7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.m2e.logback/logback.2.7.201.20260831-2044.xml @@ -0,0 +1,41 @@ + + + + %date [%thread] %-5level %logger{35} - %msg%n + + + ${org.eclipse.m2e.log.console.threshold:-OFF} + + + + + ${org.eclipse.m2e.log.dir}/0.log + + ${org.eclipse.m2e.log.dir}/%i.log + 1 + 10 + + + 10MB + + + %date [%thread] %-5level %logger{35} - %msg%n + + + + + + WARN + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml index 0acdef4..cae1fcf 100644 --- a/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml +++ b/.metadata/.plugins/org.eclipse.ui.workbench/workingsets.xml @@ -3,4 +3,5 @@ + \ No newline at end of file diff --git a/.metadata/version.ini b/.metadata/version.ini index 8ddf89c..de5cc2e 100644 --- a/.metadata/version.ini +++ b/.metadata/version.ini @@ -1,3 +1,3 @@ -#Tue Sep 29 23:22:28 CEST 2026 +#Sat Oct 10 23:02:27 CEST 2026 org.eclipse.core.runtime=2 -org.eclipse.platform=4.40.0.v20260601-0713 +org.eclipse.platform=4.41.0.v20260828-1142 diff --git a/SillyJirafe.org/.classpath b/SillyJirafe.org/.classpath index 55088ad..0b2f16f 100644 --- a/SillyJirafe.org/.classpath +++ b/SillyJirafe.org/.classpath @@ -6,12 +6,12 @@ - + - + diff --git a/SillyJirafe.org/bin/org/sillyjirafe/db/Crawl_StateDB.class b/SillyJirafe.org/bin/org/sillyjirafe/db/Crawl_StateDB.class index a57e70e..327fd7b 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/db/Crawl_StateDB.class and b/SillyJirafe.org/bin/org/sillyjirafe/db/Crawl_StateDB.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/linker/Main.class b/SillyJirafe.org/bin/org/sillyjirafe/linker/Main.class index c83227c..7206057 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/linker/Main.class and b/SillyJirafe.org/bin/org/sillyjirafe/linker/Main.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/Out.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/Out.class index 7483d82..f8ae87a 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/Out.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/Out.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubApacheApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubApacheApi.class index 0d3de36..a3f2f78 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubApacheApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubApacheApi.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.class index d7b563b..9109e42 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubMITApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubMITApi.class index 3b9d7b4..d5572b5 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubMITApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/GitHubMITApi.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.class index 7decca4..ab69944 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.class index f58a01a..971dc9d 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.class differ diff --git a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/PixabayImagesApi.class b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/PixabayImagesApi.class index 4be86b4..fb1e83e 100644 Binary files a/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/PixabayImagesApi.class and b/SillyJirafe.org/bin/org/sillyjirafe/uoapi/binds/PixabayImagesApi.class differ diff --git a/SillyJirafe.org/libs/json-20250107.jar b/SillyJirafe.org/libs/json-20250107.jar new file mode 100644 index 0000000..17afd9e Binary files /dev/null and b/SillyJirafe.org/libs/json-20250107.jar differ diff --git a/SillyJirafe.org/libs/sqlite-jdbc-3.53.2.1.jar b/SillyJirafe.org/libs/sqlite-jdbc-3.53.2.1.jar new file mode 100644 index 0000000..acff93c Binary files /dev/null and b/SillyJirafe.org/libs/sqlite-jdbc-3.53.2.1.jar differ diff --git a/SillyJirafe.org/src/org/sillyjirafe/db/Crawl_StateDB.java b/SillyJirafe.org/src/org/sillyjirafe/db/Crawl_StateDB.java index 1be2389..2372fda 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/db/Crawl_StateDB.java +++ b/SillyJirafe.org/src/org/sillyjirafe/db/Crawl_StateDB.java @@ -10,7 +10,7 @@ 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 (?, ?, ?)"; + String insertSql = "INSERT OR IGNORE INTO crawlstates (bind_name, last_page, rnd, error) VALUES (?, ?, ?, ?)"; Connection connection; public Crawl_StateDB(String BDstr) throws SQLException @@ -27,7 +27,8 @@ public class Crawl_StateDB CREATE TABLE IF NOT EXISTS crawlstates ( bind_name TEXT PRIMARY KEY, last_page INTEGER NOT NULL DEFAULT 1, - rnd TEXT NOT NULL DEFAULT 'a' + rnd TEXT NOT NULL DEFAULT 'a', + error INTEGER NOT NULL DEFAULT 0, ) """); } @@ -72,6 +73,20 @@ public class Crawl_StateDB } } } + public int getErrors(String bindName) throws SQLException { + String sql = "SELECT error 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("error"); + } else { + return 0; + } + } + } public void updatePage(String bindName) throws SQLException { String sql = """ INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) @@ -83,9 +98,73 @@ public class Crawl_StateDB ps.executeUpdate(); } } - public void updateletter(String bindName) + public void setRnd(String bindName, String rnd) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, rnd) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET rnd = (rnd) + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.setString(2, rnd); + ps.executeUpdate(); + } + } + public void newError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = error + 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetError(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, error) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET error = 0 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public void resetPage(String bindName) throws SQLException { + String sql = """ + INSERT INTO crawlstates (bind_name, last_page) VALUES (?, 2) + ON CONFLICT(bind_name) DO UPDATE SET last_page = 1 + """; + + try (PreparedStatement ps = connection.prepareStatement(sql)) { + ps.setString(1, bindName); + ps.executeUpdate(); + } + } + public static String nextLetter(String current) { + char[] lettres = current.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 updateletter(String bindName) throws SQLException { - + if (getErrors(bindName) >= 10) + { + setRnd(bindName, nextLetter(getRND(bindName))); + resetError(bindName); + resetPage(bindName); + } } public void Close() throws SQLException diff --git a/SillyJirafe.org/src/org/sillyjirafe/linker/Main.java b/SillyJirafe.org/src/org/sillyjirafe/linker/Main.java index c81c71c..2938f0b 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/linker/Main.java +++ b/SillyJirafe.org/src/org/sillyjirafe/linker/Main.java @@ -18,15 +18,26 @@ public class Main { elementDB.LinkToDB(); crawlstateDB.LinkToDB(); + Map succes = Out.getSucces(); + List bindNames = Out.PreOut(); Map pages = new HashMap<>(); + for (String name : bindNames) { + pages.put(name, crawlstateDB.getPage(name)); + } + + Map rnds = new HashMap<>(); for (String nom : bindNames) { - pages.put(nom, crawlstateDB.getPage(nom)); + rnds.put(nom, crawlstateDB.getRND(nom)); + } + + for (String nom : bindNames) { + crawlstateDB.updateletter(nom); } - List elements = Out.out(pages, ApiKeys.read()); + List elements = Out.out(pages, ApiKeys.read(), rnds); for (int i = 0; i < elements.size(); i++) { @@ -35,7 +46,11 @@ public class Main { } for (String name : bindNames) { - crawlstateDB.updatePage(name); + if (succes.getOrDefault(name, false)) { + crawlstateDB.updatePage(name); + } else { + crawlstateDB.newError(name); + } } elementDB.Close(); diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/Out.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/Out.java index 9e66328..d474acf 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/Out.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/Out.java @@ -9,6 +9,7 @@ import org.sillyjirafe.uoapi.binds.*; public class Out { List Apis = new ArrayList<>(); + Map Succes = new HashMap<>(); public List PreOut() { @@ -29,18 +30,24 @@ public class Out { return bindnames; } - public List out(Map bindpages, Map ApiKeys) throws Exception + public List out(Map bindpages, Map ApiKeys, Map Rnds) throws Exception { List Elements = new ArrayList<>(); - for (int i = 0; i < Apis.size(); i++) - { - List currentapi = Caller.CallApi(Apis.get(i), bindpages.get(Apis.get(i).getName()), ApiKeys.get(Apis.get(i).getName())); - for (int j = 0; j < currentapi.size(); j++) - { - Elements.add(currentapi.get(j)); + + for (Api api : Apis) { + try { + List currentapi = Caller.CallApi(api, bindpages.get(api.getName()), ApiKeys.get(api.getName()), Rnds.get(api.getName())); + Elements.addAll(currentapi); + Succes.put(api.getName(), true); + } catch (Exception e) { + System.out.println("Error " + api.getName() + " : " + e.getMessage()); + Succes.put(api.getName(), false); } } return Elements; } + public Map getSucces() { + return Succes; + } } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubApacheApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubApacheApi.java index a90a8d9..029dbbe 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubApacheApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubApacheApi.java @@ -15,14 +15,13 @@ public class GitHubApacheApi implements Api return "GitHubApacheApi"; } - public String getURL(int page, String apikey) { - return "https://api.github.com/search/repositories?q=license:apache-2.0&page=" + page; + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd +"&license:apache-2.0&page=" + page; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("items"); @@ -35,9 +34,6 @@ public class GitHubApacheApi implements Api resultats.add(new element(titre, url, licence, "github", "code")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.java index e207f31..e68b6cd 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubLGPLApi.java @@ -16,14 +16,13 @@ public class GitHubLGPLApi implements Api return "GitHubLGPLApi"; } - public String getURL(int page, String apikey) { - return "https://api.github.com/search/repositories?q=license:lgpl-3.0&page=" + page; + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd + "&license:lgpl-3.0&page=" + page; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("items"); @@ -36,9 +35,6 @@ public class GitHubLGPLApi implements Api resultats.add(new element(titre, url, licence, "github", "code")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubMITApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubMITApi.java index 86ecc7c..0f11db9 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubMITApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/GitHubMITApi.java @@ -15,15 +15,14 @@ public class GitHubMITApi implements Api return "GitHubMITApi"; } - public String getURL(int page, String apikey) { - return "https://api.github.com/search/repositories?q=license:mit&page=" + page; + public String getURL(int page, String apikey, String rnd) { + return "https://api.github.com/search/repositories?q="+ rnd +"&license:mit&page=" + page; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("items"); @@ -36,9 +35,6 @@ public class GitHubMITApi implements Api resultats.add(new element(titre, url, licence, "github", "code")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.java index 09f66e8..c4eabaf 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseAudiosApi.java @@ -15,14 +15,13 @@ public class OpenVerseAudiosApi implements Api return "OpenVerseAudiosApi"; } - public String getURL(int page, String apikey) { - return "https://api.openverse.org/v1/audio/?format=json&page=" + page; + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/audio/?q=\""+ rnd +"\"format=json&page=" + page; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("results"); @@ -35,9 +34,6 @@ public class OpenVerseAudiosApi implements Api resultats.add(new element(titre, url, licence, "openverse", "audio")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.java index 374f6b8..48d77db 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/OpenVerseImagesApi.java @@ -15,14 +15,12 @@ public class OpenVerseImagesApi implements Api return "OpenVerseImagesApi"; } - public String getURL(int page, String apikey) { - return "https://api.openverse.org/v1/images/?format=json&page=" + page; + public String getURL(int page, String apikey, String rnd) { + return "https://api.openverse.org/v1/images/?q=\"" + rnd+"\"format=json&page=" + page; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("results"); @@ -35,9 +33,6 @@ public class OpenVerseImagesApi implements Api resultats.add(new element(titre, url, licence, "openverse", "image")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } } diff --git a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/PixabayImagesApi.java b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/PixabayImagesApi.java index 05c0619..c0c2d5b 100644 --- a/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/PixabayImagesApi.java +++ b/SillyJirafe.org/src/org/sillyjirafe/uoapi/binds/PixabayImagesApi.java @@ -15,14 +15,13 @@ public class PixabayImagesApi implements Api return "PixabayImagesApi"; } - public String getURL(int page, String apikey) { + public String getURL(int page, String apikey, String rnd) { return "https://pixabay.com/api/?per_page=200&page=" + page + "&key=" + apikey; } public List Parse(String jsonRaw) { List resultats = new ArrayList<>(); - try { JSONObject json = new JSONObject(jsonRaw); JSONArray items = json.getJSONArray("hits"); @@ -35,9 +34,6 @@ public class PixabayImagesApi implements Api resultats.add(new element(titre, url, licence, "pixabay", "image")); } - } catch (org.json.JSONException e) { - System.out.println("error but continue : " + e.getMessage()); - } return resultats; } diff --git a/sillyjirafe.org.api/.classpath b/sillyjirafe.org.api/.classpath index 55088ad..0b2f16f 100644 --- a/sillyjirafe.org.api/.classpath +++ b/sillyjirafe.org.api/.classpath @@ -6,12 +6,12 @@ - + - + diff --git a/sillyjirafe.org.api/libs/json-20250107.jar b/sillyjirafe.org.api/libs/json-20250107.jar new file mode 100644 index 0000000..17afd9e Binary files /dev/null and b/sillyjirafe.org.api/libs/json-20250107.jar differ diff --git a/sillyjirafe.org.api/libs/sqlite-jdbc-3.53.2.1.jar b/sillyjirafe.org.api/libs/sqlite-jdbc-3.53.2.1.jar new file mode 100644 index 0000000..acff93c Binary files /dev/null and b/sillyjirafe.org.api/libs/sqlite-jdbc-3.53.2.1.jar differ