mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-03 05:31:03 +02:00
Improve output of play-m3u.ps1
This commit is contained in:
parent
94455bb7c5
commit
59a7e492fe
@ -18,15 +18,17 @@ try {
|
||||
for ([int]$i=0; $i -lt $Lines.Count; $i++) {
|
||||
$Line = $Lines[$i]
|
||||
if ($Line[0] -ne "#") {
|
||||
"▶️ Playing 🎵$Line ..."
|
||||
$FullPath = (get-childItem "$Line").fullname
|
||||
do {
|
||||
$MediaPlayer.open($FullPath)
|
||||
$Duration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||
} until ($Duration)
|
||||
$Milliseconds = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||
} until ($Milliseconds)
|
||||
[int]$Minutes = $Milliseconds / 60000
|
||||
[int]$Seconds = ($Milliseconds / 1000) % 60
|
||||
"▶️Playing 🎵$Line ($($Minutes):$Seconds) ..."
|
||||
$MediaPlayer.Volume = 1
|
||||
$MediaPlayer.play()
|
||||
start-sleep -milliseconds $Duration
|
||||
start-sleep -milliseconds $Milliseconds
|
||||
$MediaPlayer.stop()
|
||||
$MediaPlayer.close()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user