Improve play-m3u.ps1

This commit is contained in:
Markus Fleschutz 2021-04-21 09:03:42 +02:00
parent 506e9b334d
commit e98cae2a85

View File

@ -1,19 +1,15 @@
#!/usr/bin/pwsh
<#
.SYNTAX play-m3u.ps1 [<playlist-file>]
.DESCRIPTION plays the given playlist (M3U file format)
.DESCRIPTION plays the given playlist (in .M3U file format)
.LINK https://github.com/fleschutz/PowerShell
.NOTES Author: Markus Fleschutz / License: CC0
#>
param($Filename = "")
if ($Filename -eq "" ) {
$Filename = read-host "Enter the M3U playlist filename"
}
if ($Filename -eq "" ) { $Filename = read-host "Enter the M3U playlist filename" }
try {
write-progress "Reading playlist '$Filename' ..."
$Lines = get-content $Filename
add-type -assemblyName presentationCore
@ -22,7 +18,7 @@ try {
for ([int]$i=0; $i -lt $Lines.Count; $i++) {
$Line = $Lines[$i]
if ($Line[0] -ne "#") {
write-output "Playing '$Line' ..."
"▶️ Playing 🎵$Line ..."
$FullPath = (get-childItem "$Line").fullname
do {
$MediaPlayer.open($FullPath)