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>
|
||||
<groupId>com.jfoenix</groupId>
|
||||
<artifactId>jfoenix</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.21.0</version>
|
||||
<version>3.21.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -787,18 +787,33 @@ public class MainWindowController {
|
|||
smmdbAnchorPane.setVisible(true);
|
||||
smmdbTrue = true;
|
||||
|
||||
// start query
|
||||
courses.removeAll(courses);
|
||||
courses.addAll(smmdbAPIController.startQuery());
|
||||
// start query in new thread
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@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
|
||||
for (int i = 0; i < courses.size(); i++) {
|
||||
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(),
|
||||
courses.get(i).getId(), courses.get(i).getTime(), courses.get(i).getStars());
|
||||
|
||||
Platform.runLater(() -> {
|
||||
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); // add data to root-node
|
||||
smmdbDownloadBtn.setText("Download");
|
||||
smmdbDownloadBtn.setDisable(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
|
@ -880,6 +895,7 @@ public class MainWindowController {
|
|||
String outputFile = getCemuPath() + "/";
|
||||
|
||||
try {
|
||||
LOGGER.info("beginning download ...");
|
||||
HttpURLConnection conn = (HttpURLConnection) new URL(downloadUrl).openConnection();
|
||||
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
|
||||
ProgressMonitor pm = pmis.getProgressMonitor();
|
||||
|
@ -915,11 +931,11 @@ public class MainWindowController {
|
|||
String number = "000" + (highestCourseNumber +1);
|
||||
courseName = "course" + number.substring(number.length() -3, number.length());
|
||||
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i) + "/");
|
||||
|
||||
destination = courseDirectory.getPath();
|
||||
}
|
||||
}
|
||||
|
||||
if (destination != null) {
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(source);
|
||||
zipFile.extractAll(destination);
|
||||
|
@ -931,6 +947,7 @@ public class MainWindowController {
|
|||
} catch (ZipException e) {
|
||||
LOGGER.error("an error occurred during unziping the file!", e);
|
||||
}
|
||||
}
|
||||
|
||||
downloadFile.delete();
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -63,6 +63,7 @@ public class SmmdbAPIController {
|
|||
} catch (IOException e) {
|
||||
LOGGER.error("error while making api request or reading response");
|
||||
LOGGER.error("response from " + URL + " was: " + output, e);
|
||||
return course;
|
||||
}
|
||||
|
||||
String apiOutput = "{ \"courses\": " + output + "}";
|
||||
|
|
|
@ -115,6 +115,7 @@ public class dbController {
|
|||
LOGGER.info("games database loaded successfull");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* creating the local_roms table in localRoms.db
|
||||
* if the table has no entries, call loadRomDirectory
|
||||
|
|
Loading…
Reference in New Issue