-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
120 lines (97 loc) · 4.11 KB
/
setup.ps1
File metadata and controls
120 lines (97 loc) · 4.11 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
if (!(Get-Command uv -ErrorAction SilentlyContinue)) {
Write-Host "Installing uv ..."
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
}
if (!(Get-Command ffmpeg -ErrorAction SilentlyContinue)) {
Write-Host "Installing FFmpeg ..."
powershell -ExecutionPolicy ByPass -c "winget install Gyan.FFmpeg"
}
cd .\bonsai
if (!(Test-Path "./Bonsai.exe")) {
Invoke-WebRequest "https://github.com/bonsai-rx/bonsai/releases/download/2.8.2/Bonsai.zip" -OutFile "temp.zip"
Move-Item -Path "NuGet.config" "temp.config"
Expand-Archive "temp.zip" -DestinationPath "." -Force
Move-Item -Path "temp.config" "NuGet.config" -Force
Remove-Item -Path "temp.zip"
Remove-Item -Path "Bonsai32.exe"
}
& .\Bonsai.exe --no-editor
cd ..
# Checks if the output directory already exists
if (!(Test-Path ".\config")) {
New-Item -ItemType Directory -Path "config"
}
# Define repository owner and name
$repoOwner = "fchampalimaud"
$repoName = "CDC.SoundLateralizationTask"
$assetName = "template.yml" # Replace with the name of the specific file you want to download
# Get the latest release information
$apiUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/latest"
$releaseInfo = Invoke-RestMethod -Uri $apiUrl
# Find the specific asset
$asset = $releaseInfo.assets | Where-Object { $_.name -eq $assetName }
if ($asset) {
# Get the URL of the specific asset
$assetUrl = $asset.browser_download_url
# Check if the file already exists
$outputFile = "config/template.yml"
if (-Not (Test-Path -Path $outputFile)) {
# Download the specific asset
Invoke-WebRequest -Uri $assetUrl -OutFile $outputFile
Write-Output "Downloaded $assetName to $outputFile"
} else {
Write-Output "$assetName already exists. Skipping download."
}
} else {
Write-Output "Asset $assetName not found in the latest release."
}
$assetName = "setup.csv" # Replace with the name of the specific file you want to download
# Get the latest release information
$apiUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/latest"
$releaseInfo = Invoke-RestMethod -Uri $apiUrl
# Find the specific asset
$asset = $releaseInfo.assets | Where-Object { $_.name -eq $assetName }
if ($asset) {
# Get the URL of the specific asset
$assetUrl = $asset.browser_download_url
# Check if the file already exists
$outputFile = "config/$assetName"
if (-Not (Test-Path -Path $outputFile)) {
# Download the specific asset
Invoke-WebRequest -Uri $assetUrl -OutFile $outputFile
Write-Output "Downloaded $assetName to $outputFile"
} else {
Write-Output "$assetName already exists. Skipping download."
}
} else {
Write-Output "Asset $assetName not found in the latest release."
}
$assetName = "training.csv" # Replace with the name of the specific file you want to download
# Get the latest release information
$apiUrl = "https://api.github.com/repos/$repoOwner/$repoName/releases/latest"
$releaseInfo = Invoke-RestMethod -Uri $apiUrl
# Find the specific asset
$asset = $releaseInfo.assets | Where-Object { $_.name -eq $assetName }
if ($asset) {
# Get the URL of the specific asset
$assetUrl = $asset.browser_download_url
# Check if the file already exists
$outputFile = "config/$assetName"
if (-Not (Test-Path -Path $outputFile)) {
# Download the specific asset
Invoke-WebRequest -Uri $assetUrl -OutFile $outputFile
Write-Output "Downloaded $assetName to $outputFile"
} else {
Write-Output "$assetName already exists. Skipping download."
}
} else {
Write-Output "Asset $assetName not found in the latest release."
}
if (!(Test-Path ".\assets\toSoundCard.exe")) {
Invoke-WebRequest "https://github.com/fchampalimaud/cdc-speaker-calibration/releases/download/v0.3.0-alpha/toSoundCard.exe" -OutFile ".\python\assets\toSoundCard.exe"
}
if (!(Test-Path ".\assets\LibUsbDotNet.dll")) {
Invoke-WebRequest "https://github.com/fchampalimaud/cdc-speaker-calibration/releases/download/v0.3.0-alpha/LibUsbDotNet.dll" -OutFile ".\python\assets\LibUsbDotNet.dll"
}
cd .\python
uv run config