diff --git a/ArcadeReader.java b/ArcadeReader.java index 557c09d..a537857 100644 --- a/ArcadeReader.java +++ b/ArcadeReader.java @@ -713,20 +713,20 @@ public class ArcadeReader { //Insert here. found=true; 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) { RECENT_PLAYS.remove(RECENT_PLAYS.size()-1); } - RECORDS.add(i, newImg.toString()); + RECORDS.add(i, newImg.toStringWithScreenshot()); break; } } if (!found) { - RECORDS.add(newImg.toString()); - RECENT_RECORDS.add(0,newImg.toString()); - RECENT_PLAYS.add(0,newImg.toString()); + RECORDS.add(newImg.toStringWithScreenshot()); + RECENT_RECORDS.add(0,newImg.toStringWithScreenshot()); + RECENT_PLAYS.add(0,newImg.toStringWithScreenshot()); if (RECENT_PLAYS.size()>20) { RECENT_PLAYS.remove(RECENT_PLAYS.size()-1); } diff --git a/readers/Reader.java b/readers/Reader.java index db04381..40e9a23 100644 --- a/readers/Reader.java +++ b/readers/Reader.java @@ -20,6 +20,7 @@ public abstract class Reader{ int maxcombo; String other=""; String[] sig_data; + public Path result_screenshot; List readRegions = new ArrayList<>(); int sig_data_size = 0; 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") + "\"}"; } + 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() { return score; } diff --git a/sigPlace.java b/sigPlace.java index 1a37792..905d6c9 100644 --- a/sigPlace.java +++ b/sigPlace.java @@ -44,6 +44,7 @@ public class sigPlace { final static String ARTICLESDIR = "articles"; final static String UPLOADSDIR = "uploads"; final static String COMMENTSDIR = "comments"; + final static String ARCADEDIR = "arcade"; final static String DIRECTORYLISTING_FILENAME = "DIRECTORY_LISTING"; static int PORT = 8080; static String SECRET = ""; diff --git a/sigServer.java b/sigServer.java index a564b12..9aa9500 100644 --- a/sigServer.java +++ b/sigServer.java @@ -108,7 +108,12 @@ public class sigServer { } } else { 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 myFile.mkdirs(); System.out.println("Dirs added."); @@ -145,9 +150,9 @@ public class sigServer { CreateRequest(client,"400","Bad Request",Paths.get(sigPlace.OUTDIR,"testfile.html")); return; } else { - System.out.println("Saving upload to "+sigPlace.UPLOADSDIR+" directory."); + System.out.println("Saving upload to "+myFile); 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!"); } }