mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-02-16 17:51:28 +01:00
Improve play-m3u.ps1
This commit is contained in:
parent
506e9b334d
commit
e98cae2a85
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user