2021-05-01 09:26:26 +02:00
|
|
|
|
<#
|
2021-05-07 15:09:23 +02:00
|
|
|
|
.SYNTAX play-files.ps1 [<pattern>]
|
2021-05-01 09:26:26 +02:00
|
|
|
|
.DESCRIPTION plays the given audio files (supporting MP3 and WAV format)
|
|
|
|
|
.LINK https://github.com/fleschutz/PowerShell
|
|
|
|
|
.NOTES Author: Markus Fleschutz / License: CC0
|
|
|
|
|
#>
|
|
|
|
|
|
2021-05-07 15:09:23 +02:00
|
|
|
|
param($Pattern = "*")
|
2021-05-01 09:26:26 +02:00
|
|
|
|
|
|
|
|
|
try {
|
2021-05-07 15:09:23 +02:00
|
|
|
|
$Files = (get-childItem -path "$Pattern" -attributes !Directory)
|
|
|
|
|
"Playing $($Files.Count) files ..."
|
|
|
|
|
foreach ($File in $Files) {
|
2021-05-01 09:26:26 +02:00
|
|
|
|
if ("$File" -like "*.mp3") {
|
|
|
|
|
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
2021-05-01 10:23:46 +02:00
|
|
|
|
} elseif ("$File" -like "*.wav") {
|
2021-05-01 09:26:26 +02:00
|
|
|
|
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
|
|
|
|
} else {
|
|
|
|
|
"Skipping $File ..."
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
exit 0
|
|
|
|
|
} catch {
|
2021-05-02 21:30:48 +02:00
|
|
|
|
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
2021-05-01 09:26:26 +02:00
|
|
|
|
exit 1
|
|
|
|
|
}
|