diff --git a/.github/workflows/update-wr.yml b/.github/workflows/update-wr.yml new file mode 100644 index 0000000..856dbc7 --- /dev/null +++ b/.github/workflows/update-wr.yml @@ -0,0 +1,37 @@ +name: Update WR + +on: + schedule: + # 15時に実行 + - cron: "0 7 * * *" + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + commit: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + ref: main + - uses: eifinger/setup-rye@v2 + id: setup-rye + with: + enable-cache: true + working-directory: ./wr-python + - name: Install dependencies + if: steps.setup-rye.outputs.cache-hit != 'true' + run: | + rye sync --no-lock + - name: Create track.js + run: rye run python ./src/wr_python/make_track_js.py + - uses: peter-evans/create-pull-request@v6 + with: + add-paths: "src/const/track.js" + commit-message: "feat(track.js): update WR" + delete-branch: true + title: Update WR diff --git a/wr-python/README.md b/wr-python/README.md index c789c32..d824828 100644 --- a/wr-python/README.md +++ b/wr-python/README.md @@ -1,5 +1,9 @@ # wr-python -LeaderBoard.pyが本体です +## make track.js -sample.py(とdata.csv)は自分が使っていた時のサンプルです \ No newline at end of file +```bash +cd ./wr-python +rye sync +rye run python ./src/wr_python/make_track_js.py +``` diff --git a/wr-python/data.csv b/wr-python/data.csv deleted file mode 100644 index 002e845..0000000 --- a/wr-python/data.csv +++ /dev/null @@ -1,5 +0,0 @@ -,MKS,WP,SSC,TR,MC,TH,TM,SGF,SA,DS,Ed,MW,CC,BDD,BC,RR,rMMM,rMC,rCCB,rTT,rDDD,rDP3,rRRy,rDKJ,rWS,rSL,rMP,rYV,rTTC,rPPS,rGV,rRRd,dYC,dEA,dDD,dMC,dWGM,dRR,dIIO,dHC,dBP,dCL,dWW,dAC,dNBC,dRiR,dSBS,dBB,bPP,bTC,bCMo,bCMa,bTB,bSR,bSG,bNH,bNYM,bMC3,bKD,bWP,bSS,bSL,bMG,bSHS,bLL,bBL,bRRM,bMT,bBB,bPG,bMM,bRR7,bAD,bRP,bDKS,bYI,bBR,bMCd,bWS,bSSy,bAtD,bDC,bMH,bSCS,bLAL,bSW,bKC,bVV,bRA,bDKM,bDCt,bPPC,bMD,bRIW,bBC3,bRRw -VSWR,139745,141575,153874,152742,148538,205466,158878,159079,200913,157416,200835,143553,202245,151705,202832,201161,127217,127355,149767,147996,200486,117640,158999,203906,152817,150329,153013,203466,144130,203357,155509,121195,146171,142947,145919,155281,204175,128456,147725,150981,104189,148853,147908,142777,146204,151168,144599,126165,151756,124337,154347,144141,127885,147948,130737,154035,124890,135884,133895,220832,203471,137009,135837,156913,212503,123545,216884,225937,159676,208501,158006,138885,138142,131733,158415,201157,144718,141878,158509,158326,141404,135782,144765,203804,149282,137096,201294,202333,147540,213412,150966,202914,159924,159970,143899,234877 -VSRK,141131,142487,154989,154724,149225,,159863,,202115,158776,202171,145056,,156920,203918,,127760,129408,150459,148960,,,200358,205025,153892,152889,154525,204869,145709,204777,158481,121840,,144930,146843,156733,,129291,148663,151806,959999,,,143816,147932,,145924,127012,152801,125256,155714,145774,128432,149895,134645,156791,125852,136676,135628,222341,204402,138790,137270,157660,214323,124152,,227277,200692,,159389,139346,138759,132569,200938,,145408,143981,200485,159942,142927,136642,145670,206406,150748,138644,202315,203757,149125,215902,151818,205563,201915,203914,145213,236970 -AllWR,138637,141163,153874,152636,148222,205466,158447,159079,200498,156762,200835,143553,202154,151705,202474,201161,127217,127355,149698,147148,200486,117640,158857,203839,152817,150329,152998,202975,143377,202681,155509,120766,146171,142947,145706,154919,204175,128456,147409,150930,103764,148397,147789,142590,146204,150977,144599,125983,151663,124307,154347,144141,127767,147948,130737,153706,124890,135884,133895,220832,203471,137009,135837,155364,211833,123545,214664,225654,159482,208501,157668,138885,138046,131452,158415,201157,144718,141878,158509,158306,141404,135782,144595,203804,149282,137096,201294,202333,147540,213412,150966,202914,159924,159970,143899,234363 -AllRR,140096,142208,154804,153817,148888,206887,159577,200551,201805,158350,201882,144870,202973,153300,203700,202473,127708,128913,150334,147980,203336,119741,200239,204830,153872,151580,154259,204342,145262,204505,157986,121568,148051,144831,146475,155775,204859,129199,148527,151761,105241,150767,149207,143602,147717,151603,145626,126791,152625,125109,155353,145646,128356,149425,132003,155832,125767,136657,134836,222165,204337,138089,137170,157335,213331,124152,216737,227176,200529,209551,158828,139256,138724,132376,200938,203383,145353,143872,200440,159389,142890,136570,145302,206214,150709,138618,202315,203757,148811,215538,151765,204913,201901,203034,145061,235801 diff --git a/wr-python/sample.py b/wr-python/sample.py deleted file mode 100644 index 99e606c..0000000 --- a/wr-python/sample.py +++ /dev/null @@ -1,56 +0,0 @@ -import LeaderBoard -import csv - -trackList = ["MKS","WP","SSC","TR", - "MC","TH","TM","SGF", - "SA","DS","Ed","MW", - "CC","BDD","BC","RR", - "rMMM","rMC","rCCB","rTT", - "rDDD","rDP3","rRRy","rDKJ", - "rWS","rSL","rMP","rYV", - "rTTC","rPPS","rGV","rRRd", - "dYC","dEA","dDD","dMC", - "dWGM","dRR","dIIO","dHC", - "dBP","dCL","dWW","dAC", - "dNBC","dRiR","dSBS","dBB", - "bPP","bTC","bCMo","bCMa", - "bTB","bSR","bSG","bNH", - "bNYM","bMC3","bKD","bWP", - "bSS","bSL","bMG","bSHS", - "bLL","bBL","bRRM","bMT", - "bBB","bPG","bMM","bRR7", - "bAD","bRP","bDKS","bYI", - "bBR","bMCd","bWS","bSSy", - "bAtD","bDC","bMH","bSCS", - "bLAL","bSW","bKC","bVV", - "bRA","bDKM","bDCt","bPPC", - "bMD","bRIW","bBC3","bRRw"] -MyLB = LeaderBoard.LeaderBoard() - -trackList.insert(0,"") -WRList = ["VSWR"] -RRList = ["VSRK"] -AllWRList = ["AllWR"] -AllRRList = ["AllRR"] - -for i in range(1,97): - trackID = i - - WRTime = MyLB.getVSWR(trackID) - RRTime = MyLB.getVSRR(trackID) - AllWRTime = MyLB.getAllWR(trackID) - AllRRTime = MyLB.getAllRR(trackID) - - WRList.append(WRTime) - RRList.append(RRTime) - AllWRList.append(AllWRTime) - AllRRList.append(AllRRTime) - -with open("data.csv", "w", newline="") as f: - writer = csv.writer(f) - - writer.writerow(trackList) - writer.writerow(WRList) - writer.writerow(RRList) - writer.writerow(AllWRList) - writer.writerow(AllRRList) \ No newline at end of file diff --git a/wr-python/src/wr_python/make_track_js.py b/wr-python/src/wr_python/make_track_js.py index eda6ec4..9629203 100644 --- a/wr-python/src/wr_python/make_track_js.py +++ b/wr-python/src/wr_python/make_track_js.py @@ -128,13 +128,8 @@ } -print(template.render(wr=wr)) +track_js = template.render(wr=wr) -# with open("data.csv", "w", newline="") as f: -# writer = csv.writer(f) - -# writer.writerow(trackList) -# writer.writerow(WRList) -# writer.writerow(RRList) -# writer.writerow(AllWRList) -# writer.writerow(AllRRList) +with open("../src/const/track.js", "w", encoding='utf-8') as f: + f.write(track_js) + f.write("\n")