-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-playstore-screenshots.ps1
More file actions
97 lines (77 loc) · 2.98 KB
/
create-playstore-screenshots.ps1
File metadata and controls
97 lines (77 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#Requires -Version 5.1
<#
.SYNOPSIS
Generates Play Store screenshots for all required device form factors.
.DESCRIPTION
1. Reads SCREENSHOT_STEAM_ID from .env.screenshots
2. Fetches real match data from OpenDota API
3. Captures screenshots via Playwright for phone, 7" tablet, 10" tablet, Chromebook
4. Outputs PNGs to meta\screenshots\<device>\
.EXAMPLE
.\create-playstore-screenshots.ps1
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$Root = $PSScriptRoot
# ---------------------------------------------------------------------------
# 1. Load .env.screenshots
# ---------------------------------------------------------------------------
$EnvFile = Join-Path $Root ".env.screenshots"
if (-not (Test-Path $EnvFile)) {
Write-Error @"
.env.screenshots not found.
Copy the example and fill in your Steam64 ID:
Copy-Item .env.screenshots.example .env.screenshots
Then edit .env.screenshots and set:
SCREENSHOT_STEAM_ID=76561198XXXXXXXXX
"@
exit 1
}
foreach ($line in Get-Content $EnvFile) {
$line = $line.Trim()
if (-not $line -or $line.StartsWith("#")) { continue }
$parts = $line -split "=", 2
if ($parts.Count -eq 2) {
$key = $parts[0].Trim()
$val = $parts[1].Trim().Trim('"').Trim("'")
[System.Environment]::SetEnvironmentVariable($key, $val, "Process")
}
}
if (-not $env:SCREENSHOT_STEAM_ID) {
Write-Error "SCREENSHOT_STEAM_ID is not set in .env.screenshots"
exit 1
}
Write-Host ""
Write-Host "=== Dota Keeper - Play Store Screenshots ===" -ForegroundColor Cyan
Write-Host "Steam ID : $($env:SCREENSHOT_STEAM_ID.Substring(0, 10))..." -ForegroundColor DarkGray
Write-Host ""
# ---------------------------------------------------------------------------
# 2. Fetch mock data from OpenDota
# ---------------------------------------------------------------------------
Write-Host "Step 1/2 Fetching match data from OpenDota..." -ForegroundColor Yellow
npm run screenshots:fetch
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to fetch mock data. Check your Steam ID and that your OpenDota profile is public."
exit 1
}
Write-Host ""
# ---------------------------------------------------------------------------
# 3. Capture screenshots
# ---------------------------------------------------------------------------
Write-Host "Step 2/2 Capturing screenshots..." -ForegroundColor Yellow
npm run screenshots
if ($LASTEXITCODE -ne 0) {
Write-Error "Screenshot capture failed."
exit 1
}
# ---------------------------------------------------------------------------
# 4. Summary
# ---------------------------------------------------------------------------
$OutDir = Join-Path $Root "meta\screenshots"
$Files = @(Get-ChildItem -Path $OutDir -Recurse -Filter "*.png" -ErrorAction SilentlyContinue)
Write-Host ""
Write-Host "Done!" -ForegroundColor Green
Write-Host "$($Files.Count) screenshots saved to: $OutDir" -ForegroundColor Green
Write-Host ""
# Open the folder in Explorer
Start-Process explorer.exe $OutDir