Fixed timezone issue when importing a film

Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
Louis Vallat 2020-10-28 14:25:42 +01:00
parent 9644cfcf0c
commit 0c335aa023
2 changed files with 8 additions and 2 deletions

View File

@ -12,8 +12,10 @@ import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
import xyz.vallat.louis.commands.*;
import xyz.vallat.louis.database.DBManager;
import xyz.vallat.louis.database.FilmManager;
import xyz.vallat.louis.database.exceptions.ImportationException;
import xyz.vallat.louis.env.EnvironmentVariables;
import xyz.vallat.louis.omdb.OMDBClient;
import xyz.vallat.louis.subtitles.OpenSubtitles;
import java.io.IOException;
@ -39,7 +41,9 @@ public class MovieQuoteBot {
commands.put("download", new Download(PREFIX + "download"));
}
public static void main(String[] args) {
public static void main(String[] args) throws InterruptedException, ParseException, IOException, ImportationException {
FilmManager.importFilm(OMDBClient.getMovie("Surrogates", false));
/*
DBManager.testConnection();
DBManager.initDatabase();
OpenSubtitles.login();
@ -53,6 +57,8 @@ public class MovieQuoteBot {
}));
discordClient.onDisconnect().block();
*/
}
private static void registerDiscordCommands() {

View File

@ -38,7 +38,7 @@ public final class FilmManager {
try (PreparedStatement stmt = connection.prepareStatement(insert)) {
stmt.setString(1, movie.getImdbID());
stmt.setString(2, movie.getTitle());
stmt.setDate(3, Date.valueOf(movie.getReleased().atZone(ZoneId.of("UTC")).toLocalDate()));
stmt.setDate(3, Date.valueOf(movie.getReleased().atZone(ZoneId.systemDefault()).toLocalDate()));
stmt.setString(4, movie.getType());
stmt.setString(5, movie.getPoster());
stmt.executeUpdate();