Last active
January 8, 2024 18:52
-
-
Save chrissabato/a3dc0c10f1300e4d198c3ff8f32d0253 to your computer and use it in GitHub Desktop.
vmix script: cycles through a text file to play one video at a time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' --------------------------- | |
' EDIT THE VARIABLES BELOW | |
' --------------------------- | |
' This is the location of your text files | |
Dim PlaylistFile as String = "C:\Users\sportsinfo\Dropbox\Bearcat Network\Spots\Ad List.txt" | |
' This is the name of the vMix playlist | |
Dim VmixPlaylist as String = "Ad" | |
Dim AdCount As Integer = 1 | |
Dim LogPrefix as String = "BKB" | |
' --------------------------- | |
' DO NOT EDIT BELOW THIS LINE | |
' --------------------------- | |
Console.WriteLine("") | |
Dim fileReader As String | |
fileReader = My.Computer.FileSystem.ReadAllText(PlaylistFile) | |
Dim playlist as Array = fileReader.Split(New String() {Environment.NewLine},StringSplitOptions.RemoveEmptyEntries) | |
Using writer As new StreamWriter(PlaylistFile, false) | |
For index As Integer = AdCount To playlist.length-1 | |
writer.WriteLine(playlist(index)) | |
Next | |
For index As Integer = 0 To AdCount-1 | |
writer.WriteLine(playlist(index)) | |
Next | |
End Using | |
'dim i = Input.Find(VmixPlaylist) | |
For index As Integer = 0 To AdCount-1 | |
Input.Find(VmixPlaylist).Function("ListRemove",1) 'remove first video on playlist | |
Next | |
Dim VideoFileName as Array | |
For index As Integer = 0 To AdCount-1 | |
Input.Find(VmixPlaylist).Function("ListAdd",playlist(index)) 'ad video to playlist | |
VideoFileName = playlist(index).Split("\") | |
Console.WriteLine("Loaded: " + VideoFileName(VideoFileName.length-1)) | |
Next | |
'Input.Find(VmixPlaylist).Function("PreviewInput") 'send playlist to preview | |
Console.WriteLine("") | |
' --------------------------- | |
' LOG | |
' --------------------------- | |
Dim tmp as Array = PlaylistFile.Split("\") | |
Dim AdFileName as String = tmp(tmp.length-1) | |
dim PlaylistFileLog as String = PlaylistFile.replace(AdFileName,"logs\" + DateTime.Now.ToString("yyyyMMdd") +" "+ LogPrefix +" Log.txt") | |
dim logInfo as String = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + " " + VideoFileName(VideoFileName.length-1) + Environment.NewLine | |
My.Computer.FileSystem.WriteAllText(PlaylistFileLog, logInfo, True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment