smmdb api auery is now in it's own thread
* smmdb api auery is now in it's own thread * fixed a issue where cemu_UI freezed on a 502 http error of the smmdb api * jfoenix 1.10 -> 1.11 * sqlite 3.20.0. -> sqlite 3.20.0.1
This commit is contained in:
parent
548629eeaf
commit
75d8e6b525
4
pom.xml
4
pom.xml
|
@ -28,7 +28,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jfoenix</groupId>
|
<groupId>com.jfoenix</groupId>
|
||||||
<artifactId>jfoenix</artifactId>
|
<artifactId>jfoenix</artifactId>
|
||||||
<version>1.10.0</version>
|
<version>1.11.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.xerial</groupId>
|
<groupId>org.xerial</groupId>
|
||||||
<artifactId>sqlite-jdbc</artifactId>
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
<version>3.21.0</version>
|
<version>3.21.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -787,17 +787,32 @@ public class MainWindowController {
|
||||||
smmdbAnchorPane.setVisible(true);
|
smmdbAnchorPane.setVisible(true);
|
||||||
smmdbTrue = true;
|
smmdbTrue = true;
|
||||||
|
|
||||||
// start query
|
// start query in new thread
|
||||||
courses.removeAll(courses);
|
Thread thread = new Thread(new Runnable() {
|
||||||
courses.addAll(smmdbAPIController.startQuery());
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
smmdbDownloadBtn.setText("loading ...");
|
||||||
|
smmdbDownloadBtn.setDisable(true);
|
||||||
|
root.getChildren().remove(0,root.getChildren().size());
|
||||||
|
});
|
||||||
|
courses.removeAll(courses); // remove existing courses
|
||||||
|
courses.addAll(smmdbAPIController.startQuery()); // start query
|
||||||
|
|
||||||
// add query response to courseTreeTable
|
// add query response to courseTreeTable
|
||||||
for (int i = 0; i < courses.size(); i++) {
|
for (int i = 0; i < courses.size(); i++) {
|
||||||
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(),
|
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(),
|
||||||
courses.get(i).getId(), courses.get(i).getTime(), courses.get(i).getStars());
|
courses.get(i).getId(), courses.get(i).getTime(), courses.get(i).getStars());
|
||||||
|
|
||||||
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
|
Platform.runLater(() -> {
|
||||||
}
|
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
|
||||||
|
smmdbDownloadBtn.setText("Download");
|
||||||
|
smmdbDownloadBtn.setDisable(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,6 +895,7 @@ public class MainWindowController {
|
||||||
String outputFile = getCemuPath() + "/";
|
String outputFile = getCemuPath() + "/";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
LOGGER.info("beginning download ...");
|
||||||
HttpURLConnection conn = (HttpURLConnection) new URL(downloadUrl).openConnection();
|
HttpURLConnection conn = (HttpURLConnection) new URL(downloadUrl).openConnection();
|
||||||
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
|
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
|
||||||
ProgressMonitor pm = pmis.getProgressMonitor();
|
ProgressMonitor pm = pmis.getProgressMonitor();
|
||||||
|
@ -914,22 +930,23 @@ public class MainWindowController {
|
||||||
|
|
||||||
String number = "000" + (highestCourseNumber +1);
|
String number = "000" + (highestCourseNumber +1);
|
||||||
courseName = "course" + number.substring(number.length() -3, number.length());
|
courseName = "course" + number.substring(number.length() -3, number.length());
|
||||||
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i) + "/");
|
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i) + "/");
|
||||||
|
|
||||||
destination = courseDirectory.getPath();
|
destination = courseDirectory.getPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (destination != null) {
|
||||||
ZipFile zipFile = new ZipFile(source);
|
try {
|
||||||
zipFile.extractAll(destination);
|
ZipFile zipFile = new ZipFile(source);
|
||||||
|
zipFile.extractAll(destination);
|
||||||
// rename zip-file
|
|
||||||
File course = new File(destination + "/course000");
|
// rename zip-file
|
||||||
course.renameTo( new File(destination + "/" + courseName));
|
File course = new File(destination + "/course000");
|
||||||
LOGGER.info("Added new course: " + courseName + ", full path is: " + destination + "/" + courseName);
|
course.renameTo( new File(destination + "/" + courseName));
|
||||||
} catch (ZipException e) {
|
LOGGER.info("Added new course: " + courseName + ", full path is: " + destination + "/" + courseName);
|
||||||
LOGGER.error("an error occurred during unziping the file!", e);
|
} catch (ZipException e) {
|
||||||
|
LOGGER.error("an error occurred during unziping the file!", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadFile.delete();
|
downloadFile.delete();
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class SmmdbAPIController {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOGGER.error("error while making api request or reading response");
|
LOGGER.error("error while making api request or reading response");
|
||||||
LOGGER.error("response from " + URL + " was: " + output, e);
|
LOGGER.error("response from " + URL + " was: " + output, e);
|
||||||
|
return course;
|
||||||
}
|
}
|
||||||
|
|
||||||
String apiOutput = "{ \"courses\": " + output + "}";
|
String apiOutput = "{ \"courses\": " + output + "}";
|
||||||
|
|
|
@ -115,6 +115,7 @@ public class dbController {
|
||||||
LOGGER.info("games database loaded successfull");
|
LOGGER.info("games database loaded successfull");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* creating the local_roms table in localRoms.db
|
* creating the local_roms table in localRoms.db
|
||||||
* if the table has no entries, call loadRomDirectory
|
* if the table has no entries, call loadRomDirectory
|
||||||
|
|
Loading…
Reference in New Issue