@@ -1,7 +1,10 @@
|
|||||||
package com.dostalgia;
|
package com.dostalgia;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.*;
|
import java.nio.file.FileVisitResult;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.SimpleFileVisitor;
|
||||||
import java.nio.file.attribute.BasicFileAttributes;
|
import java.nio.file.attribute.BasicFileAttributes;
|
||||||
|
|
||||||
/** Shared file-system utilities. */
|
/** Shared file-system utilities. */
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import jakarta.ws.rs.core.Response;
|
|||||||
import jakarta.ws.rs.core.StreamingOutput;
|
import jakarta.ws.rs.core.StreamingOutput;
|
||||||
import java.nio.file.NoSuchFileException;
|
import java.nio.file.NoSuchFileException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.*;
|
import java.util.Map;
|
||||||
|
|
||||||
@Path("/api/games")
|
@Path("/api/games")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ import java.time.Instant;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import jakarta.annotation.Nonnull;
|
|
||||||
|
|
||||||
/** Manages game metadata stored as JSON files on disk. */
|
/** Manages game metadata stored as JSON files on disk. */
|
||||||
@ApplicationScoped
|
@ApplicationScoped
|
||||||
|
|||||||
@@ -12,7 +12,12 @@ import java.net.http.HttpRequest;
|
|||||||
import java.net.http.HttpResponse;
|
import java.net.http.HttpResponse;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/** Client for the IGDB (Internet Game Database) API via Twitch OAuth2. */
|
/** Client for the IGDB (Internet Game Database) API via Twitch OAuth2. */
|
||||||
@@ -94,8 +99,6 @@ public class IgdbService {
|
|||||||
return results.isArray() ? results : null;
|
return results.isArray() ? results : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Search ───────────────────────────────────────────────────
|
|
||||||
|
|
||||||
public List<Map<String, Object>> search(String query) throws Exception {
|
public List<Map<String, Object>> search(String query) throws Exception {
|
||||||
if (!isConfigured()) return List.of();
|
if (!isConfigured()) return List.of();
|
||||||
|
|
||||||
@@ -199,8 +202,6 @@ public class IgdbService {
|
|||||||
return screenshots;
|
return screenshots;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Auto-Scrape ──────────────────────────────────────────────
|
|
||||||
|
|
||||||
public void autoScrape(Game game) {
|
public void autoScrape(Game game) {
|
||||||
if (!isConfigured()) return;
|
if (!isConfigured()) return;
|
||||||
try {
|
try {
|
||||||
@@ -283,8 +284,6 @@ public class IgdbService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Utility ──────────────────────────────────────────────────
|
|
||||||
|
|
||||||
/** Convert IGDB epoch (seconds) to year, from 'first_release_date' field. */
|
/** Convert IGDB epoch (seconds) to year, from 'first_release_date' field. */
|
||||||
private static Optional<Integer> epochToYear(JsonNode node) {
|
private static Optional<Integer> epochToYear(JsonNode node) {
|
||||||
if (node.has("first_release_date")) {
|
if (node.has("first_release_date")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user