diff --git a/.github/workflows/dtchsyn.yml b/.github/workflows/dtchsyn.yaml similarity index 81% rename from .github/workflows/dtchsyn.yml rename to .github/workflows/dtchsyn.yaml index 7ef0e1e..356fe61 100644 --- a/.github/workflows/dtchsyn.yml +++ b/.github/workflows/dtchsyn.yaml @@ -14,9 +14,9 @@ jobs: id: set-destination run: | if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then - echo "DESTINATION=/Lantaeu/dtch/" >> $GITHUB_ENV + echo "DESTINATION=/LantaeuSSD/dtch/" >> $GITHUB_ENV else - echo "DESTINATION=/Lantaeu/dtch_dev/" >> $GITHUB_ENV + echo "DESTINATION=/LantaeuSSD/dtch_dev/" >> $GITHUB_ENV fi - name: Checkout @@ -25,6 +25,7 @@ jobs: - name: SFTP upload uses: Dylan700/sftp-upload-action@latest with: + dry-run: false server: ${{secrets.SYNADDR}} username: ${{secrets.SYNUSR}} password: ${{secrets.SYNPASS}} @@ -32,7 +33,6 @@ jobs: uploads: | ./ => ${{ env.DESTINATION }} ignore: | - *.git - */**/*git* + .git config.php data/**/*.json \ No newline at end of file diff --git a/discord/report_new_matches.ps1 b/discord/report_new_matches.ps1 index 5fee7cd..3585188 100644 --- a/discord/report_new_matches.ps1 +++ b/discord/report_new_matches.ps1 @@ -1,13 +1,21 @@ -Start-Transcript -Path '/var/log/dtch/report_new_matches.log' -Append - +$logprefix = Get-Date -Format "ddMMyyyy_HHmmss" if ($PSScriptRoot.length -eq 0) { $scriptroot = Get-Location } else { $scriptroot = $PSScriptRoot } +$RelativeLogdir = Join-Path -Path $scriptroot -ChildPath "..\logs" +$logDir = (Resolve-Path -Path $RelativeLogdir).Path + +Start-Transcript -Path "$logDir/report_new_matches_$logprefix.log" -Append . $scriptroot\..\includes\ps1\lockfile.ps1 new-lock -by "report_new_matches" +write-output "Scriptroot: $scriptroot" +write-output "Scriptname: $($MyInvocation.MyCommand)" +write-output "Script: $($MyInvocation.MyCommand.Path)" +write-output "PSScriptroot: $PSScriptRoot" +write-output "Logdir: $logDir" $fileContent = Get-Content -Path "$scriptroot/../config/config.php" -Raw @@ -85,6 +93,8 @@ try { catch { Write-Output 'Unable to read file exitin' } +Write-Output $player_matches +Write-Output $new_win_matches $new_win_matches = $player_matches[-1].new_win_matches # Gebruik nu de lijst van nieuwe verloren matches uit het JSON-bestand @@ -119,14 +129,14 @@ foreach ($winid in $new_win_matches) { $2D_replay_url = $2D_replay_url + "?follow=$($winners[0])" $match_stats = Invoke-RestMethod -Uri "https://api.pubg.com/shards/steam/matches/$winid" -Method GET -Headers $headers - if($winmatches[0].gameMode -eq 'tdm' ){ + if ($winmatches[0].gameMode -eq 'tdm' ) { continue } #skip tdm matches if ($winmatches[0].matchType -eq 'custom') { - $players_to_report = $match_stats.included.attributes.stats + $players_to_report = $match_stats.included.attributes.stats | where-object { $_.playerId -notlike "ai.*" } } else { - $players_to_report = ($match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 }) + $players_to_report = $match_stats.included.attributes.stats | where-object { $_.winplace -eq 1 } } if ($new_win_matches.count -le 10) { diff --git a/logs/REAMD.MD b/logs/REAMD.MD new file mode 100644 index 0000000..940fe81 --- /dev/null +++ b/logs/REAMD.MD @@ -0,0 +1 @@ +Location for logs \ No newline at end of file