Skip to content

Commit

Permalink
Add PowerShell script to run on a setlist
Browse files Browse the repository at this point in the history
  • Loading branch information
GenericMadScientist committed Sep 8, 2020
1 parent 28fdc7d commit 5103015
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CMakeCache.
## Usage

If you are unfamiliar with the intricacies of reading paths, read
[this guide](more-info/How-to-read-paths.md).
[this guide](misc/How-to-read-paths.md).

CHOpt has two versions, a command-line version and a graphical version. The
graphical version has the same options as the command-line version and is
Expand Down Expand Up @@ -46,6 +46,16 @@ by passing -h or --help to CHOpt, or by consulting the table below.
| --no-solos | Do not draw solo sections |
| --no-time-sigs | Do not draw time signatures |

If you would like to conveniently run CHOpt on a setlist and you happen to be
on Windows, I made a PowerShell script that I've put [here](misc/setlist.ps1).
Change the four variables then run the script. The simplest way to do that is
probably to open the folder the script is in, double click the top bar and type
in cmd then enter to open a command prompt in that folder, then run the command

```
> powershell -ExecutionPolicy Bypass -File setlist.ps1
```

## Dependencies

* [argparse](https://github.com/p-ranav/argparse) 2.1 for argument parsing
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
31 changes: 31 additions & 0 deletions misc/setlist.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# The location of CHOpt.exe (specifically, the CLI version)
$CHOPT_PATH = 'path\to\CHOpt\here'
# The location of the setlist you want to optimise
$SETLIST_PATH = 'path\to\setlist\here'
# The extra arguments (other than path and song location) you wish to pass to
# CHOpt, for example "--sqz 50 --ew 40" for 50% squeeze/40% whammy
$CHOPT_ARGS = ''
# The name of the image file you want (e.g., sqz-50.png)
$IMAGE_NAME = 'path.png'

$files = Get-ChildItem -LiteralPath $SETLIST_PATH -Recurse | Where-Object { ! $_.PSIsContainer }
$charts = $files | Where-Object { $_.Name -eq 'notes.chart' } | Select-Object Directory
$mids = $files | Where-Object { $_.Name -eq 'notes.mid' } | Select-Object Directory

# We do the notes.chart files before the notes.mid files because some songs
# will have both, and my understanding is Clone Hero will prioritise the
# notes.mid files in that situation.

foreach ($chart in $charts) {
$chartPath = Join-Path -Path $chart.Directory -ChildPath 'notes.chart'
$imgPath = Join-Path -Path $chart.Directory -ChildPath $IMAGE_NAME
$fullArgs = "-f `"$chartPath`" -o `"$imgPath`" $CHOPT_ARGS"
Start-Process -NoNewWindow -Wait -FilePath $CHOPT_PATH -ArgumentList $fullArgs
}

foreach ($mid in $mids) {
$midPath = Join-Path -Path $mid.Directory -ChildPath 'notes.mid'
$imgPath = Join-Path -Path $mid.Directory -ChildPath $IMAGE_NAME
$fullArgs = "-f `"$midPath`" -o `"$imgPath`" $CHOPT_ARGS"
Start-Process -NoNewWindow -Wait -FilePath $CHOPT_PATH -ArgumentList $fullArgs
}

0 comments on commit 5103015

Please sign in to comment.