Include screenshot info in finalized arcade data (#8)
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
835d7ef442
commit
3a8a8d9458
@ -713,20 +713,20 @@ public class ArcadeReader {
|
|||||||
//Insert here.
|
//Insert here.
|
||||||
found=true;
|
found=true;
|
||||||
if (i==0) {
|
if (i==0) {
|
||||||
RECENT_RECORDS.add(0,newImg.toString());
|
RECENT_RECORDS.add(0,newImg.toStringWithScreenshot());
|
||||||
}
|
}
|
||||||
RECENT_PLAYS.add(0,newImg.toString());
|
RECENT_PLAYS.add(0,newImg.toStringWithScreenshot());
|
||||||
if (RECENT_PLAYS.size()>20) {
|
if (RECENT_PLAYS.size()>20) {
|
||||||
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
||||||
}
|
}
|
||||||
RECORDS.add(i, newImg.toString());
|
RECORDS.add(i, newImg.toStringWithScreenshot());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
RECORDS.add(newImg.toString());
|
RECORDS.add(newImg.toStringWithScreenshot());
|
||||||
RECENT_RECORDS.add(0,newImg.toString());
|
RECENT_RECORDS.add(0,newImg.toStringWithScreenshot());
|
||||||
RECENT_PLAYS.add(0,newImg.toString());
|
RECENT_PLAYS.add(0,newImg.toStringWithScreenshot());
|
||||||
if (RECENT_PLAYS.size()>20) {
|
if (RECENT_PLAYS.size()>20) {
|
||||||
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
RECENT_PLAYS.remove(RECENT_PLAYS.size()-1);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ public abstract class Reader{
|
|||||||
int maxcombo;
|
int maxcombo;
|
||||||
String other="";
|
String other="";
|
||||||
String[] sig_data;
|
String[] sig_data;
|
||||||
|
public Path result_screenshot;
|
||||||
List<Box> readRegions = new ArrayList<>();
|
List<Box> readRegions = new ArrayList<>();
|
||||||
int sig_data_size = 0;
|
int sig_data_size = 0;
|
||||||
final int TRANSPARENT = new Color(0,0,0,0).getRGB();
|
final int TRANSPARENT = new Color(0,0,0,0).getRGB();
|
||||||
@ -340,6 +341,11 @@ public abstract class Reader{
|
|||||||
+ ", \"other\":" + other + ", \"pct\":" + pct + ", \"rank\":" + rank + ", \"score\":" + score + ", \"title\":\"" + title.replaceAll(Pattern.quote("\n"),"\\\\n")
|
+ ", \"other\":" + other + ", \"pct\":" + pct + ", \"rank\":" + rank + ", \"score\":" + score + ", \"title\":\"" + title.replaceAll(Pattern.quote("\n"),"\\\\n")
|
||||||
+ "\"}";
|
+ "\"}";
|
||||||
}
|
}
|
||||||
|
public String toStringWithScreenshot() {
|
||||||
|
return "{\"game\":\""+getClass().getSimpleName()+"\",\"difficulty\":" + difficulty + ", \"maxcombo\":" + maxcombo + ", \"notes\":" + Arrays.toString(notes)
|
||||||
|
+ ", \"other\":" + other + ", \"pct\":" + pct + ", \"rank\":" + rank + ", \"score\":" + score + ", \"title\":\"" + title.replaceAll(Pattern.quote("\n"),"\\\\n")
|
||||||
|
+ "\", \"screenshot\":\""+result_screenshot+"\"}";
|
||||||
|
}
|
||||||
public int getScore() {
|
public int getScore() {
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@ public class sigPlace {
|
|||||||
final static String ARTICLESDIR = "articles";
|
final static String ARTICLESDIR = "articles";
|
||||||
final static String UPLOADSDIR = "uploads";
|
final static String UPLOADSDIR = "uploads";
|
||||||
final static String COMMENTSDIR = "comments";
|
final static String COMMENTSDIR = "comments";
|
||||||
|
final static String ARCADEDIR = "arcade";
|
||||||
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
|
final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING";
|
||||||
static int PORT = 8080;
|
static int PORT = 8080;
|
||||||
static String SECRET = "";
|
static String SECRET = "";
|
||||||
|
@ -108,7 +108,12 @@ public class sigServer {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
System.out.println(line);
|
System.out.println(line);
|
||||||
File myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);
|
File myFile = null;
|
||||||
|
if (filename.contains(".png")) {
|
||||||
|
myFile = new File(sigPlace.ARCADEDIR,filename);
|
||||||
|
} else {
|
||||||
|
myFile = new File(new File(sigPlace.OUTDIR,sigPlace.UPLOADSDIR),filename);
|
||||||
|
}
|
||||||
// check if file exist, otherwise create the file before writing
|
// check if file exist, otherwise create the file before writing
|
||||||
myFile.mkdirs();
|
myFile.mkdirs();
|
||||||
System.out.println("Dirs added.");
|
System.out.println("Dirs added.");
|
||||||
@ -145,9 +150,9 @@ public class sigServer {
|
|||||||
CreateRequest(client,"400","Bad Request",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
CreateRequest(client,"400","Bad Request",Paths.get(sigPlace.OUTDIR,"testfile.html"));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Saving upload to "+sigPlace.UPLOADSDIR+" directory.");
|
System.out.println("Saving upload to "+myFile);
|
||||||
if (filename.contains(".png")) {
|
if (filename.contains(".png")) {
|
||||||
ArcadeReader.submitToDatabase(Paths.get(sigPlace.OUTDIR,sigPlace.UPLOADSDIR,filename));
|
ArcadeReader.submitToDatabase(Paths.get(sigPlace.ARCADEDIR,filename));
|
||||||
System.out.println("Submitted to the database!");
|
System.out.println("Submitted to the database!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user