Containerize imgparser

pull/5/head
sigonasr2 4 years ago
parent 0d38e1fe1f
commit f698d24472
  1. 13
      docker-compose.yml
  2. 38
      frontend/src/App.js
  3. 4
      imgparser/Dockerfile
  4. 2
      server/app.js
  5. BIN
      server/files/unfuzedstream1.png
  6. BIN
      server/files/unfuzedstream2.png
  7. 3
      server/invalidSongs

@ -19,6 +19,19 @@ services:
max-size: "1m" max-size: "1m"
max-file: "3" max-file: "3"
imgparser:
build: imgparser
restart: always
ports:
- "4503:4503"
volumes:
- ./imgparser:/imgparser
working_dir: /imgparser/projectDivaImgParser
logging:
options:
max-size: "1m"
max-file: "3"
postgres: postgres:
image: postgres:10.4 image: postgres:10.4
restart: always restart: always

@ -1007,10 +1007,19 @@ function HoverSongName(p) {
) )
} }
function HasSong(song,user) { function HasSong(song,user,filter) {
//console.log(JSON.stringify(song)+"/"+JSON.stringify(user)) //console.log(JSON.stringify(song)+"/"+JSON.stringify(user)+"/"+JSON.stringify(filter))
return (song.mega39s&&user.megamix)|| //console.log(song.report.ehdcount+song.report.nhdcount+song.report.hhdcount+song.report.exhdcount+song.report.exexhdcount+song.report.ehscount+song.report.nhscount+song.report.hhscount+song.report.exhscount+song.report.exexhscount+song.report.esdcount+song.report.nsdcount+song.report.hsdcount+song.report.exsdcount+song.report.exexsdcount)
(song.futuretone&&user.futuretone) return ((song.mega39s&&user.megamix)||
(song.futuretone&&user.futuretone))
&&(filter==="All Songs"||
(filter==="Cleared Songs"&&(Number(song.report.eclearcount)+Number(song.report.nclearcount)+Number(song.report.hclearcount)+Number(song.report.exclearcount)+Number(song.report.exexclearcount>0)))||
(filter==="FCs"&&(Number(song.report.efccount)+Number(song.report.nfccount)+Number(song.report.hfccount)+Number(song.report.exfccount)+Number(song.report.exexfccount>0)))||
(filter==="Perfect FCs"&&(Number(song.report.epfccount)+Number(song.report.npfccount)+Number(song.report.hpfccount)+Number(song.report.expfccount)+Number(song.report.exexpfccount>0)))||
(filter==="Modded"&&(Number(song.report.ehdcount)+Number(song.report.nhdcount)+Number(song.report.hhdcount)+Number(song.report.exhdcount)+Number(song.report.exexhdcount)+Number(song.report.ehscount)+Number(song.report.nhscount)+Number(song.report.hhscount)+Number(song.report.exhscount)+Number(song.report.exexhscount)+Number(song.report.esdcount)+Number(song.report.nsdcount)+Number(song.report.hsdcount)+Number(song.report.exsdcount)+Number(song.report.exexsdcount>0)))||
(filter==="In Progress"&&(Number(song.report.eclearcount)+Number(song.report.nclearcount)+Number(song.report.hclearcount)+Number(song.report.exclearcount)+Number(song.report.exexclearcount)===0))||
(filter==="Not Cleared"&&(((song.report.eclearcount)?Number(song.report.eclearcount):0)+((song.report.nclearcount)?Number(song.report.nclearcount):0)+((song.report.hclearcount)?Number(song.report.hclearcount):0)+((song.report.exclearcount)?Number(song.report.exclearcount):0)+((song.report.exexclearcount)?Number(song.report.exexclearcount):0)===0))
)
} }
function CompletionPanel(p) { function CompletionPanel(p) {
@ -1019,6 +1028,7 @@ function CompletionPanel(p) {
const [filter,setFilter] = useState({}) const [filter,setFilter] = useState({})
const [style,setStyle] = useState(true) const [style,setStyle] = useState(true)
const [update,setUpdate] = useState(false) const [update,setUpdate] = useState(false)
const [songFilter,setSongFilter] = useState("All Songs")
useEffect(()=>{ useEffect(()=>{
axios.get("http://projectdivar.com/completionreport/"+p.username) axios.get("http://projectdivar.com/completionreport/"+p.username)
.then((data)=>{setReport(data.data)}) .then((data)=>{setReport(data.data)})
@ -1037,6 +1047,22 @@ function CompletionPanel(p) {
return ( return (
<> <>
<SongSearch songs={p.songs} song={song} setSong={setSong} setStyle={setStyle} filteredSongs={filter} setFilteredSongs={setFilter}/> <SongSearch songs={p.songs} song={song} setSong={setSong} setStyle={setStyle} filteredSongs={filter} setFilteredSongs={setFilter}/>
<div className="mt-3 float-right">
<Form inline>
<Form.Group controlId="filterSong">
<Form.Label className="pr-3">Filter</Form.Label>
<Form.Control as="select" value={songFilter} onChange={(e)=>{setSongFilter(e.currentTarget.value)}}>
<option>All Songs</option>
<option>Cleared Songs</option>
<option>In Progress</option>
<option>FCs</option>
<option>Perfect FCs</option>
<option>Modded</option>
<option>Not Cleared</option>
</Form.Control>
</Form.Group>
</Form>
</div>
<table className="table table-sm"> <table className="table table-sm">
<thead> <thead>
<tr id="headerbar"> <tr id="headerbar">
@ -1061,7 +1087,7 @@ function CompletionPanel(p) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{report.filter((report)=>Object.keys(filter).length==0||report.id in filter).map((song,i)=>{return (HasSong(song,p.user))?<HoverSongName profileUpdate={p.profileUpdate} setModalSrc={p.setModalSrc} setModalVisible={p.setModalVisible} to={song.name} song={song} key={song.id} username={p.username}/>:<></> {report.filter((report)=>Object.keys(filter).length==0||report.id in filter).map((song,i)=>{return (HasSong(song,p.user,songFilter))?<HoverSongName profileUpdate={p.profileUpdate} setModalSrc={p.setModalSrc} setModalVisible={p.setModalVisible} to={song.name} song={song} key={song.id} username={p.username}/>:<></>
})} })}
</tbody> </tbody>
<tfoot> <tfoot>
@ -1428,8 +1454,6 @@ function SongSearch(p) {
</div> </div>
</div> </div>
</div>})}</div>:<></>} </div>})}</div>:<></>}
More stuff goes here.
</> </>
) )
} }

@ -0,0 +1,4 @@
# pull official base image
FROM openjdk:8-jdk-alpine
CMD ["./gradlew", "bootRun"]

@ -498,7 +498,7 @@ app.get('/completionreport/:username',(req,res)=>{
.then((data)=>{ .then((data)=>{
songs = data.rows; songs = data.rows;
songs.forEach((song)=>{ songs.forEach((song)=>{
promises.push(db.query("select * from (select userid,count(*) filter(where difficulty='E' and mod='SD' and score>0) as ESDCount,count(*) filter(where difficulty='N' and mod='SD' and score>0) as NSDCount,count(*) filter(where difficulty='H' and mod='SD' and score>0) as HSDCount,count(*) filter(where difficulty='EX' and mod='SD' and score>0) as EXHDCount,count(*) filter(where difficulty='E' and mod='HD' and score>0) as EHDCount,count(*) filter(where difficulty='N' and mod='HD' and score>0) as NHDCount,count(*) filter(where difficulty='H' and mod='HD' and score>0) as HHDCount,count(*) filter(where difficulty='EX' and mod='HD' and score>0) as EXHDCount,count(*) filter(where difficulty='E' and mod='HS' and score>0) as EHSCount,count(*) filter(where difficulty='N' and mod='HS' and score>0) as NHSCount,count(*) filter(where difficulty='H' and mod='HS' and score>0) as HHSCount,count(*) filter(where difficulty='EX' and mod='HS' and score>0) as EXHSCount,count(*) filter(where difficulty='EXEX' and mod='HS' and score>0) as EXEXHSCount,Count(*) filter(where difficulty='E' and score>0) as EClearCount,Count(*) filter(where difficulty='N' and score>0) as NClearCount,Count(*) filter(where difficulty='H' and score>0) as HClearCount,Count(*) filter(where difficulty='EX' and score>0) as EXClearCount,Count(*) filter(where difficulty='EXEX' and score>0) as EXEXClearCount,count(*) filter(where difficulty='E') as ECount,count(*) filter(where difficulty='N') as NCount,count(*) filter(where difficulty='H') as HCount,count(*) filter(where difficulty='EX') as EXCount,count(*) filter(where difficulty='EXEX') as EXEXCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='E') as EFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='N') as NFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='H') as HFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='EX') as EXFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='EXEX') as EXEXFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='E') as EPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='N') as NPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='H') as HPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='EX') as EXPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='EXEX') as EXEXPFCCount from plays where userid=$1 and songid=$2 group by userid)t1 join (select rank,t.score,t.percent from (select row_number()over(order by score desc)rank,* from(select distinct on (userid) * from (select * from plays where songid=$2)t order by userid,score desc)t)t where userid=$1)t2 on t1.userid=t1.userid",[userId,song.id]) promises.push(db.query("select * from (select userid,count(*) filter(where difficulty='E' and mod='SD' and score>0) as ESDCount,count(*) filter(where difficulty='N' and mod='SD' and score>0) as NSDCount,count(*) filter(where difficulty='H' and mod='SD' and score>0) as HSDCount,count(*) filter(where difficulty='EX' and mod='SD' and score>0) as EXSDCount,count(*) filter(where difficulty='EXEX' and mod='SD' and score>0) as EXEXSDCount,count(*) filter(where difficulty='E' and mod='HD' and score>0) as EHDCount,count(*) filter(where difficulty='N' and mod='HD' and score>0) as NHDCount,count(*) filter(where difficulty='H' and mod='HD' and score>0) as HHDCount,count(*) filter(where difficulty='EX' and mod='HD' and score>0) as EXHDCount,count(*) filter(where difficulty='EXEX' and mod='HD' and score>0) as EXEXHDCount,count(*) filter(where difficulty='E' and mod='HS' and score>0) as EHSCount,count(*) filter(where difficulty='N' and mod='HS' and score>0) as NHSCount,count(*) filter(where difficulty='H' and mod='HS' and score>0) as HHSCount,count(*) filter(where difficulty='EX' and mod='HS' and score>0) as EXHSCount,count(*) filter(where difficulty='EXEX' and mod='HS' and score>0) as EXEXHSCount,Count(*) filter(where difficulty='E' and score>0) as EClearCount,Count(*) filter(where difficulty='N' and score>0) as NClearCount,Count(*) filter(where difficulty='H' and score>0) as HClearCount,Count(*) filter(where difficulty='EX' and score>0) as EXClearCount,Count(*) filter(where difficulty='EXEX' and score>0) as EXEXClearCount,count(*) filter(where difficulty='E') as ECount,count(*) filter(where difficulty='N') as NCount,count(*) filter(where difficulty='H') as HCount,count(*) filter(where difficulty='EX') as EXCount,count(*) filter(where difficulty='EXEX') as EXEXCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='E') as EFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='N') as NFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='H') as HFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='EX') as EXFCCount,Count(*) filter(where safe=0 and sad=0 and worst=0 and difficulty='EXEX') as EXEXFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='E') as EPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='N') as NPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='H') as HPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='EX') as EXPFCCount,Count(*) filter(where fine=0 and safe=0 and sad=0 and worst=0 and difficulty='EXEX') as EXEXPFCCount from plays where userid=$1 and songid=$2 group by userid)t1 join (select rank,t.score,t.percent from (select row_number()over(order by score desc)rank,* from(select distinct on (userid) * from (select * from plays where songid=$2)t order by userid,score desc)t)t where userid=$1)t2 on t1.userid=t1.userid",[userId,song.id])
.then((data)=>{ .then((data)=>{
if (data.rows.length>0) { if (data.rows.length>0) {
song.report=data.rows[0] song.report=data.rows[0]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 920 KiB

@ -771,3 +771,6 @@
{"song":"SING&SMILE","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EjFsiT9XYAY5kQE.jpg"} {"song":"SING&SMILE","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"-1.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EjFsiT9XYAY5kQE.jpg"}
{"song":"その一秒 スローモーション","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"https://pbs.twimg.com/media/EjF2bs-XgAAVcG5.jpg"} {"song":"その一秒 スローモーション","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"https://pbs.twimg.com/media/EjF2bs-XgAAVcG5.jpg"}
{"song":"その一秒 スローモーション","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"https://pbs.twimg.com/media/EjF2bs-XgAAVcG5.jpg"} {"song":"その一秒 スローモーション","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"https://pbs.twimg.com/media/EjF2bs-XgAAVcG5.jpg"}
{"song":"桜ノ雨","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EjHwObQUwAAFz89.jpg"}
{"song":"桜ノ雨","username":"Lian99","authentication_token":"51146-41911-16075","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EjHwObQUwAAFz89.jpg"}
{"song":"ドラマツルギー","username":"blahbleepblop","authentication_token":"49960-47012-40674","difficulty":"","cool":"-1","fine":"-1","safe":"-1","sad":"-1","worst":"-1","percent":"0.0","fail":"false","combo":"-1","mod":"","gameScore":"-1","src":"http://pbs.twimg.com/media/EjJSIt7U4AAU9P4.jpg"}

Loading…
Cancel
Save