mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-06-03 08:55:41 +02:00
Improve play-m3u.ps1
This commit is contained in:
parent
506e9b334d
commit
e98cae2a85
@ -1,19 +1,15 @@
|
|||||||
#!/usr/bin/pwsh
|
#!/usr/bin/pwsh
|
||||||
<#
|
<#
|
||||||
.SYNTAX play-m3u.ps1 [<playlist-file>]
|
.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
|
.LINK https://github.com/fleschutz/PowerShell
|
||||||
.NOTES Author: Markus Fleschutz / License: CC0
|
.NOTES Author: Markus Fleschutz / License: CC0
|
||||||
#>
|
#>
|
||||||
|
|
||||||
param($Filename = "")
|
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 {
|
try {
|
||||||
write-progress "Reading playlist '$Filename' ..."
|
|
||||||
$Lines = get-content $Filename
|
$Lines = get-content $Filename
|
||||||
|
|
||||||
add-type -assemblyName presentationCore
|
add-type -assemblyName presentationCore
|
||||||
@ -22,7 +18,7 @@ try {
|
|||||||
for ([int]$i=0; $i -lt $Lines.Count; $i++) {
|
for ([int]$i=0; $i -lt $Lines.Count; $i++) {
|
||||||
$Line = $Lines[$i]
|
$Line = $Lines[$i]
|
||||||
if ($Line[0] -ne "#") {
|
if ($Line[0] -ne "#") {
|
||||||
write-output "Playing '$Line' ..."
|
"▶️ Playing 🎵$Line ..."
|
||||||
$FullPath = (get-childItem "$Line").fullname
|
$FullPath = (get-childItem "$Line").fullname
|
||||||
do {
|
do {
|
||||||
$MediaPlayer.open($FullPath)
|
$MediaPlayer.open($FullPath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user