mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-23 00:13:36 +01:00
Improve play-files.ps1 and play-mp3.ps1
This commit is contained in:
parent
d5d33dc2b1
commit
96596a7581
@ -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)
|
.DESCRIPTION plays the given audio files (supporting MP3 and WAV format)
|
||||||
.LINK https://github.com/fleschutz/PowerShell
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Files = "*")
|
param($Pattern = "*")
|
||||||
|
|
||||||
try {
|
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") {
|
if ("$File" -like "*.mp3") {
|
||||||
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
& "$PSScriptRoot/play-mp3.ps1" "$File"
|
||||||
} elseif ("$File" -like "*.wav") {
|
} elseif ("$File" -like "*.wav") {
|
||||||
|
@ -23,7 +23,7 @@ try {
|
|||||||
|
|
||||||
[int]$Minutes = $Milliseconds / 60000
|
[int]$Minutes = $Milliseconds / 60000
|
||||||
[int]$Seconds = ($Milliseconds / 1000) % 60
|
[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
|
$PreviousTitle = $host.ui.RawUI.WindowTitle
|
||||||
$host.ui.RawUI.WindowTitle = "▶️ $Filename"
|
$host.ui.RawUI.WindowTitle = "▶️ $Filename"
|
||||||
$MediaPlayer.Volume = 1
|
$MediaPlayer.Volume = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user