Improve play-files.ps1 and play-mp3.ps1

This commit is contained in:
Markus Fleschutz 2021-05-07 15:09:23 +02:00
parent d5d33dc2b1
commit 96596a7581
2 changed files with 7 additions and 5 deletions

View File

@ -1,14 +1,16 @@
<#
.SYNTAX play-files.ps1 [<file(s)>]
.SYNTAX play-files.ps1 [<pattern>]
.DESCRIPTION plays the given audio files (supporting MP3 and WAV format)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Files = "*")
param($Pattern = "*")
try {
foreach ($File in (get-childItem -path "$Files" -attributes !Directory)) {
$Files = (get-childItem -path "$Pattern" -attributes !Directory)
"Playing $($Files.Count) files ..."
foreach ($File in $Files) {
if ("$File" -like "*.mp3") {
& "$PSScriptRoot/play-mp3.ps1" "$File"
} elseif ("$File" -like "*.wav") {

View File

@ -23,7 +23,7 @@ try {
[int]$Minutes = $Milliseconds / 60000
[int]$Seconds = ($Milliseconds / 1000) % 60
"▶️Playing for $($Minutes.ToString('00')):$($Seconds.ToString('00')) sec.: 🎵$Filename ..."
"▶️ Playing 🎵$Filename ($($Minutes.ToString('00')):$($Seconds.ToString('00')) sec.) ..."
$PreviousTitle = $host.ui.RawUI.WindowTitle
$host.ui.RawUI.WindowTitle = "▶️ $Filename"
$MediaPlayer.Volume = 1