mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-28 15:46:35 +01:00
Improved the scripts
This commit is contained in:
parent
9c606fbdd7
commit
8e384b6d67
@ -13,6 +13,7 @@ if ($Filename -eq "" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
write-progress "Reading playlist '$Filename' ..."
|
||||||
$Lines = get-content $Filename
|
$Lines = get-content $Filename
|
||||||
|
|
||||||
add-type -assemblyName presentationCore
|
add-type -assemblyName presentationCore
|
||||||
@ -21,8 +22,17 @@ 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 "#") {
|
||||||
$MediaPlayer.open("$Line")
|
write-output "Playing '$Line' ..."
|
||||||
|
$FullPath = (get-childItem "$Line").fullname
|
||||||
|
do {
|
||||||
|
$MediaPlayer.open("$Line")
|
||||||
|
$Duration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||||
|
} until ($Duration)
|
||||||
|
$MediaPlayer.Volume = 1
|
||||||
$MediaPlayer.play()
|
$MediaPlayer.play()
|
||||||
|
start-sleep -milliseconds $Duration
|
||||||
|
$MediaPlayer.stop()
|
||||||
|
$MediaPlayer.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -13,10 +13,20 @@ if ($Filename -eq "" ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
add-type -assemblyName presentationCore
|
add-type -assemblyName PresentationCore
|
||||||
$MediaPlayer = new-object system.windows.media.mediaplayer
|
$MediaPlayer = new-object System.Windows.Media.MediaPlayer
|
||||||
$MediaPlayer.open("$Filename")
|
|
||||||
|
$FullPath = (get-childItem $Filename).fullname
|
||||||
|
do {
|
||||||
|
$MediaPlayer.open($FullPath)
|
||||||
|
$Duration = $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds
|
||||||
|
} until ($Duration)
|
||||||
|
write-progress "Playing $Filename ..."
|
||||||
|
$MediaPlayer.Volume = 1
|
||||||
$MediaPlayer.play()
|
$MediaPlayer.play()
|
||||||
|
start-sleep -milliseconds $Duration
|
||||||
|
$MediaPlayer.stop()
|
||||||
|
$MediaPlayer.close()
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
} catch {
|
} catch {
|
||||||
|
Loading…
Reference in New Issue
Block a user