Now playing title auto  updater with next up at xx:xx:xx

Free Now playing title auto updater with next up at xx:xx:xx

Mitchstein443

New Member
So I've been running a 24/7 streaming channel under vmix for ell over 8 years now. I just made the switch over to OBS.

For the record, I have exactly 72 hours of running OBS so far, but feel it is stable enough to do what I need it to do. The one rule of thumb for ny complex mission critical software package is DEDICATED SERVER! WHat I mean is, if your running OBS on a computer that also runs editing software, a bunch of other stuff and your using it to play games or daily net browsing, your simply doing it wrong. a computer nd 90% of the software out there will run perfectly if it is the only software your running.. in my 45+ years of computer experience I have always said "one mission, one computer".

With that being said.

I am running OBS now, it's working perfectly on a 2019 windows server, 8 core xenon processor, cheap onboard video card and has no sound card (which is why vmix won't run on it, but OBS has no problem).

So I had a powershell script for vmix that puts a title at the bottom of the screen showing the title NOW PLAYING and a title at the top of the screen that Shows a clock and UP NEXT at ##:##:##... the clock is to show the viewer te servers time since everyone is not in my time zone, lol..

Anyway it's using the built in lua clock script and tuna as addins..

and then this powershell script. I'll also post a screen shot that shows the sources.
you can view the channel at www.tvbydemand.com and no the website is not modernized I wrote it completely in classic asp back in 1992 long before anyone else was streaming video and other then some graphics has ot really been modernized much but works great and has been since 1992. So don't going acting like it won't work, it does and has proven itself to work better longer then most people have been on the web..

Here is the script:

while($foreverloop -lt 9999)
{

cls
$xmlurl = "http://127.0.0.1"+":1607"

#get current tile and info and save as current.txt
$data = (New-Object System.Net.WebClient).DownloadString($xmlurl)
Out-File -FilePath c:\livetv\current.txt -InputObject $data -Encoding ASCII



#inport contents of current.txt to variables
$duration = (Get-Content -Path c:\livetv\current.txt -TotalCount 2)[-1]
$progress = (Get-Content -Path c:\livetv\current.txt -TotalCount 3)[-1]
$status = (Get-Content -Path c:\livetv\current.txt -TotalCount 4)[-1]
$time_left = (Get-Content -Path c:\livetv\current.txt -TotalCount 5)[-1]
$titlepath = (Get-Content -Path c:\livetv\current.txt -TotalCount 6)[-1]

#cleanup variables end

$duration = $duration.TrimEnd(",")
$progress = $progress.TrimEnd(",")
$status = $status.TrimEnd(""",")
$time_left = $time_left.TrimEnd(",")
$titlepath = $titlepath.TrimEnd("""")

#cleanup variables start

$duration = $duration.TrimStart("""duration"": ")
$progress = $progress.TrimStart("""progress"": ")
$status = $status.TrimStart("""status"": """)
$time_left = $time_left.TrimStart("""time_left"": ")
$titlepath = $titlepath.TrimStart("""title"": """)

#just get title name
$title = Split-Path $titlePath -leaf

$title = $title.Substring(0,$title.Length-4) #removes the extension i.e. .mp4

#write title to file
$a = $title
If ($a.Length -gt 70) {

$b = $a.length - 70
$a = $a.Substring(0,$a.Length-$b)
}

Out-File -FilePath c:\livetv\nowplaying.txt -InputObject $a -Encoding ASCII

#figureout time left in time not milliseconds
$EpochStart = Get-Date 00:00:00
$myDateTime = $EpochStart.Addmilliseconds($time_left)

$seconds_left = [math]::Round($time_left/1000)
$minutes_left = [math]::Round(($time_left/1000)/60)
$hours_left = [math]::Round((($time_left/1000)/60)/60)


$d=Get-Date
$next_time = $d.AddSeconds($seconds_left)
$next_time = Get-Date -Date $next_time -Format "hh:mm:ss"



#find curent file in the playlist and read the next line
$titlepath1 = ($titlepath).Replace("\\","\")

[System.IO.StreamReader]$sr = [System.IO.File]::Open("c:\livetv\filelist.m3u8", [System.IO.FileMode]::Open)
while (-not $sr.EndOfStream){
$line = $sr.ReadLine()

If ($line -eq $titlepath1) {

$nextline = $sr.ReadLine()

}
}
$sr.Close()

#trim $nextline down to jut the title
$nexttitle = Split-Path $nextline -leaf
$nexttitle = $nexttitle.Substring(0,$nexttitle.Length-4) #removes the extension i.e. .mp4

#updte upnext file
$up_next_line1 = "Up Next @" + $next_time
Out-File -FilePath c:\livetv\upnext.txt -InputObject $up_next_line1 -Encoding ASCII
Out-File -FilePath c:\livetv\upnext.txt -InputObject $nexttitle -Encoding ASCII -Append

Write-Host $duration
Write-Host $progress
Write-Host $status
Write-Host $time_left
Write-Host $titlepath
Write-Host $title
Write-Host seconds = $seconds_left
write-host minutes left $minutes_left
write-host hours left $hours_left
write-host net time = $next_time
write-host next title = $nexttitle

sleep 5
}

:end of script
 
Top