Database local insertion now correctly works (#8)
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
ca6095fe04
commit
a7d726dbfe
@ -723,6 +723,8 @@ public class ArcadeReader {
|
||||
Path getGamePath = gamePath(newImg);
|
||||
newImg.interpretBoxes(p);
|
||||
HashMap<String,HashMap<String,List<String>>> DATA = sigPlace.SONG_DATABASE;
|
||||
List<String> RECENT_PLAYS = sigPlace.RECENT_PLAYS;
|
||||
List<String> RECENT_RECORDS = sigPlace.RECENT_RECORDS;
|
||||
HashMap<String,List<String>> SONG_DATA=DATA.getOrDefault(newImg.getClass().getSimpleName(),new HashMap<>());
|
||||
List<String> RECORDS = SONG_DATA.getOrDefault(convertTitle(newImg.getTitle()),new ArrayList<>());
|
||||
boolean found=false;
|
||||
@ -732,12 +734,27 @@ public class ArcadeReader {
|
||||
if (score<newImg.getScore()) {
|
||||
//Insert here.
|
||||
found=true;
|
||||
if (i==0) {
|
||||
RECENT_RECORDS.add(0,newImg.toString());
|
||||
}
|
||||
RECENT_PLAYS.add(0,newImg.toString());
|
||||
if (RECENT_PLAYS.size()>20) {
|
||||
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
||||
}
|
||||
RECORDS.add(i, newImg.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
RECORDS.add(newImg.toString());
|
||||
RECENT_RECORDS.add(0,newImg.toString());
|
||||
RECENT_PLAYS.add(0,newImg.toString());
|
||||
if (RECENT_PLAYS.size()>20) {
|
||||
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
||||
}
|
||||
}
|
||||
if (RECENT_RECORDS.size()>20) {
|
||||
RECENT_RECORDS.remove(RECENT_RECORDS.size()-1);
|
||||
}
|
||||
SONG_DATA.put(convertTitle(newImg.getTitle()),RECORDS);
|
||||
DATA.put(newImg.getClass().getSimpleName(),SONG_DATA);
|
||||
|
@ -37,6 +37,8 @@ public class sigPlace {
|
||||
static String SECRET = "";
|
||||
|
||||
final static HashMap<String,HashMap<String,List<String>>> SONG_DATABASE = new HashMap<>();
|
||||
final static List<String> RECENT_PLAYS = new ArrayList<>();
|
||||
final static List<String> RECENT_RECORDS = new ArrayList<>();
|
||||
|
||||
static double COLOR_ROTATION = 0;
|
||||
|
||||
@ -126,6 +128,8 @@ public class sigPlace {
|
||||
ArcadeReader.submitToDatabase(Paths.get("tests","popn7.png"));
|
||||
ArcadeReader.submitToDatabase(Paths.get("tests","popn6.png"));
|
||||
ArcadeReader.submitToDatabase(Paths.get("tests","popn5.png"));
|
||||
System.out.println(RECENT_PLAYS);
|
||||
System.out.println(RECENT_RECORDS);
|
||||
/* Path secretFile = Paths.get(".clientsecret");
|
||||
List<String> data;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user