-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathucPlaylist.vb
2534 lines (2165 loc) · 129 KB
/
ucPlaylist.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
Imports System.IO
Imports System.Data
Public Class ucPlaylist
Public i As Integer 'for loop
Public j As Integer
Public k As Integer
Public jj As Integer
Private Sub dgvclips_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvclips.CellContentClick
End Sub
Private Sub cmdrefreshtvclips_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdrefreshtvclips.Click
On Error Resume Next
initialisetvclips()
End Sub
Sub initialisetvclips()
On Error Resume Next
tvclips.Nodes.Clear()
Dim xx As String = ""
If frmmediaplayer.ucTab1.UcPlaylistSetting1.rdoclipfromfilesystem.Checked Then
tvclips.Nodes.Add(mediafullpath)
PopulateTreeView(mediafullpath, tvclips.Nodes(0))
ElseIf frmmediaplayer.uctab1.UcPlaylistSetting1.rdoclipfromserver.Checked Then
Dim aa() As String
If ServerVersion = 2.1 Then 'added because server 2.1 sends each files as indivisual , no folder name. 150119
'MsgBox("from 2.1")
CasparDevice.RefreshMediafiles()
Threading.Thread.Sleep(500)
ReDim aa(CasparDevice.Mediafiles.Count)
For iclips = 0 To CasparDevice.Mediafiles.Count - 1
Dim foldername As String = ""
foldername = Mid(CasparDevice.Mediafiles.Item(iclips).Name, 1, Len(CasparDevice.Mediafiles.Item(iclips).Name) - Len(Split(CasparDevice.Mediafiles.Item(iclips).Name, "/").Last) - 1)
aa(iclips) = "Clips\" & Replace(foldername, "/", "\")
Next
ElseIf ServerVersion = 2.0 Then
'MsgBox("from 2.07")
CasparDevice.RefreshMediafiles()
Threading.Thread.Sleep(500)
ReDim aa(CasparDevice.Mediafiles.Count)
For iclips = 0 To CasparDevice.Mediafiles.Count - 1
aa(iclips) = "Clips\" & CasparDevice.Mediafiles.Item(iclips).Folder
Next
ElseIf ServerVersion > 2.1 Then
'MsgBox("from 2.2 or 2.3")
Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString("http://" & frmmediaplayer.cmbhost.Text & ":8000/cls")
Dim bb() = Split(result, vbNewLine)
ReDim aa(bb.Count)
For iclips = 0 To bb.Count - 1
Dim foldername As String = ""
Dim clipname As String = Replace(Replace(Split(bb(iclips), " ")(0), "\", "/"), """", "")
foldername = Mid(clipname, 1, Len(clipname) - Len(Split(clipname, "/").Last) - 1)
aa(iclips) = "Clips\" & Replace(foldername, "/", "\")
Next
End If
50:
createTreeview(aa)
End If
tvclips.Sort() '210515
tvclips.Nodes(0).Expand()
End Sub
Sub createTreeview(aa() As String)
Dim nodeData As New List(Of String)(aa)
Dim TN As TreeNode
For Each nodePath As String In nodeData
TN = Nothing
For Each node As String In nodePath.Split("\"c)
If node <> "" Then
If IsNothing(TN) Then
If tvclips.Nodes.ContainsKey(node) Then
TN = tvclips.Nodes(node)
Else
TN = tvclips.Nodes.Add(node, node)
End If
Else
If TN.Nodes.ContainsKey(node) Then
TN = TN.Nodes(node)
Else
TN = TN.Nodes.Add(node, node)
End If
End If
End If
Next
Next
End Sub
Private Sub PopulateTreeView(ByVal dir As String, ByVal parentNode As TreeNode)
On Error Resume Next
Dim folder As String = String.Empty
Dim folders() As String = Directory.GetDirectories(dir)
If folders.Length <> 0 Then
Dim childNode As TreeNode = Nothing
For Each folder In folders
childNode = New TreeNode(IO.Path.GetFileName(folder))
parentNode.Nodes.Add(childNode)
PopulateTreeView(folder, childNode)
Next
End If
End Sub
Private Sub tvclips_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvclips.AfterSelect
On Error Resume Next
If frmmediaplayer.ucTab1.UcPlaylistSetting1.rdoclipfromfilesystem.Checked Then
lblsearch.Text = Replace(Mid(tvclips.SelectedNode.FullPath, Len(mediafullpath) + 2), "\", "/") & "/"
ElseIf frmmediaplayer.uctab1.UcPlaylistSetting1.rdoclipfromserver.Checked Then
lblsearch.Text = Replace(Mid(tvclips.SelectedNode.FullPath, 5 + 2), "\", "/") & "/"
End If
If lblsearch.Text = "/" Then lblsearch.Text = ""
txtsearch.Text = ""
End Sub
Sub initialiseplaylistdata()
On Error Resume Next
Me.DateTimePicker1.Value = Now
Me.DateTimePicker1.CustomFormat = "dd/MMM HH:mm:ss"
dgv1.Rows.Add(15)
Me.dgv1.Item("File_Name", 0).Value = "go1080p25.mp4"
Me.dgv1.Item("File_Name", 1).Value = "CG1080i50.mp4"
Me.dgv1.Item("File_Name", 2).Value = "amb.mp4"
Me.dgv1.Item("File_Name", 3).Value = "CG1080i50_A.mp4"
Me.dgv1.Item("File_Name", 4).Value = "go1080p25.mp4"
Me.dgv1.Item("File_Name", 5).Value = "CG1080i50.mp4"
Me.dgv1.Item("File_Name", 6).Value = "amb.mp4"
Me.dgv1.Item("Clip_Duration", 0).Value = "00:00:17"
Me.dgv1.Item("Clip_Duration", 1).Value = "00:00:10"
Me.dgv1.Item("Clip_Duration", 2).Value = "00:00:10"
Me.dgv1.Item("Clip_Duration", 3).Value = "00:00:10"
Me.dgv1.Item("Clip_Duration", 4).Value = "00:00:17"
Me.dgv1.Item("Clip_Duration", 5).Value = "00:00:10"
Me.dgv1.Item("Clip_Duration", 6).Value = "00:00:10"
Me.dgv1.Item("Column3", 0).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "go1080p25.png")
Me.dgv1.Item("Column3", 1).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "CG1080i50.png")
Me.dgv1.Item("Column3", 2).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "amb.png")
Me.dgv1.Item("Column3", 3).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "CG1080i50_A.png")
Me.dgv1.Item("Column3", 4).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "go1080p25.png")
Me.dgv1.Item("Column3", 5).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "CG1080i50.png")
Me.dgv1.Item("Column3", 6).Value = System.Drawing.Image.FromFile(thumbnailsfullpath & "amb.png")
Me.dgv1.Item("Template_File", 0).Value = "C:\casparcg\mydata\rundown\File_Based_Graphics_List.txt"
Dim i As Integer
For i = 0 To dgv1.Rows.Count - 1
dgv1.Item("x", i).Value = 1
dgv1.Item("Transition", i).Value = "MIX"
dgv1.Item("T_Duration", i).Value = 10
dgv1.Item("AudioLevel", i).Value = 1.0
Next
Me.dgv1.Item("FileType", 0).Value = "Others"
Me.dgv1.Item("FileType", 1).Value = "Program"
Me.dgv1.Item("FileType", 2).Value = "Promo"
Me.dgv1.Item("FileType", 3).Value = "Commercial"
Me.dgv1.Item("FileType", 4).Value = "Others"
Me.dgv1.Item("FileType", 5).Value = "Program"
Me.dgv1.Item("FileType", 6).Value = "Promo"
End Sub
Sub enableplaylist()
On Error Resume Next
chkplaylistlock.Checked = False
End Sub
Sub disableplaylist()
On Error Resume Next
chkplaylistlock.Checked = True
End Sub
Public Sub cmdstartplaylist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdstartplaylist.Click
On Error Resume Next
startPlaylist()
End Sub
Public Sub startPlaylist()
On Error Resume Next
'if nothing is selected
Dim bbb As Integer = 0
For aaa = 0 To dgv1.RowCount - 1
bbb = bbb + dgv1.Item("x", aaa).Value
Next
If bbb = 0 Then MsgBox("no clip is selected") : Exit Sub
playlist()
chkplaylistlock.Checked = True
txtdurationofplalist.Focus() 'Remove focus from startplaylist button, so that enter button should not click it again.
iclippauseresume = 1
End Sub
Sub playlist()
On Error Resume Next
currrow = Me.dgv1.CurrentRow.Index
If dgv1.CurrentRow.Cells("x").Value = 1 Then
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 8)).ToUpper = "DECKLINK" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "HTTP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " [HTML] " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "UDP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "TCP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTMP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTSP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTCP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If frmmediaplayer.ucTab1.UcPlaylistSetting1.chkLoadbg.Checked Then
If System.IO.Path.GetExtension(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
If ServerVersion > 2.1 Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek * 2 & " length " & cliplength * 2 & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
CasparDevice.SendString("loadbg " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("File_Name").Value) & """")
Else
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.CurrentRow.Cells("File_Name").Value) & """" & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
CasparDevice.SendString("loadbg " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("File_Name").Value) & """")
End If
Else
If System.IO.Path.GetExtension(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.CurrentRow.Cells("File_Name").Value) & """" & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
End If
30: sendmixercommandforclip() 'decklink play was not sending amcp command 'reported by forum member mrvdberg 11112019
End If
createasrunlog()
If dgv1.Rows(currrow).Cells("Column11").Value = True Then
calculateinterval()
Else
tmrnextclip.Interval = 1000
End If
tmrduration.Enabled = True
tmrfornotskiping.Enabled = True
Me.tmrstartattime.Enabled = False
chkplaylistlock.Checked = True
adjusttimeofplaylist()
linktemplatetoplaylist()
End Sub
Sub sendmixercommandforclip()
On Error Resume Next
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " volume " & dgv1.CurrentRow.Cells("AudioLevel").Value)
Threading.Thread.Sleep(frmmediaplayer.ucTab1.UcPlaylistSetting1.txtmixercommandforconversion.Text)
If dgv1.CurrentRow.Cells("Conversion").Value = 1 Then 'for conversion
'With ucPlaylistSetting
With frmmediaplayer.ucTab1.UcPlaylistSetting1
If .rdocentercutsetting.Checked Then
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill " & .txtcentercutsetting.Text)
ElseIf .rdoletterboxsettings.Checked Then
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill " & .txtletterboxsettings.Text)
ElseIf .rdopillarboxsettings.Checked Then
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill " & .txtpillarboxsettings.Text)
ElseIf .rdocropsettings.Checked Then
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill " & .txtcropsettings.Text)
ElseIf .rdoanamorphic.Checked Then
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill " & .txtanamorphic.Text)
End If
End With
Else
CasparDevice.SendString("mixer " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " fill 0 0 1 1")
End If
If dgv1.Rows(currrow).Cells("AMCPCommands").Value <> "" Then
Dim aa() = Split(dgv1.Rows(currrow).Cells("AMCPCommands").Value, ",,")
For inumberofcommands = 0 To aa.Count - 1
CasparDevice.SendString(aa(inumberofcommands))
Next
End If
End Sub
Sub calculateinterval()
Dim dH As Integer
Dim dM As Integer
Dim dS As Integer
Dim dd As Array = Split(dgv1.Rows(currrow).Cells("Clip_Duration").Value, ":")
dH = dd(0)
dM = dd(1)
dS = dd(2)
Dim totalsecond As Integer = dH * 3600 + dM * 60 + dS
tmrnextclip.Interval = totalsecond * 1000 - tmrfornotskiping.Interval
End Sub
Sub createasrunlog()
Dim filename As String = "c:/casparcg/mydata/asrunlog/asrunlog_" & DateTime.Now.ToString("ddMMyy") & ".txt"
If System.IO.File.Exists(filename) = False Then
System.IO.File.Create(filename)
End If
GC.Collect()
GC.WaitForPendingFinalizers()
Using sw As StreamWriter = System.IO.File.AppendText(filename)
sw.WriteLine(Now & vbTab & dgv1.CurrentRow.Cells("Clip_Duration").Value & vbTab & vbTab & dgv1.CurrentRow.Cells("File_Name").Value)
sw.Close()
End Using
End Sub
Sub openfile()
' On Error Resume Next
ofd2.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
ofd2.InitialDirectory = "c:\casparcg\mydata\playlist\"
If (ofd2.ShowDialog() = Windows.Forms.DialogResult.OK) Then
SaveToolStripMenuItem.Enabled = True
Using sr As StreamReader = New StreamReader(ofd2.FileName)
'clear list
dgv1.Rows.Clear()
'Loop through and add list to the file.
Dim g As Integer = 0
Dim li As String
Do Until sr.EndOfStream = True
li = sr.ReadLine()
dgv1.Rows.Add()
Dim xyz As Array = Split(li, Chr(2))
dgv1.Rows(g).Cells("File_Name").Value = xyz(0)
dgv1.Rows(g).Cells("Start_Time").Value = xyz(1)
dgv1.Rows(g).Cells("x").Value = xyz(2)
dgv1.Rows(g).Cells("Transition").Value = xyz(3)
dgv1.Rows(g).Cells("T_Duration").Value = xyz(4)
dgv1.Rows(g).Cells("LoopVideo").Value = xyz(5)
dgv1.Rows(g).Cells("Clip_Duration").Value = xyz(6)
If chkshowthumbnail.Checked Then
Dim aa As Array = Split(xyz(0), ".")
If aa.Length = 2 Then
If aa(1) = "txt" Then
readsubclip(mediafullpath & xyz(0))
If System.IO.File.Exists(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png")
End If
Else
If System.IO.File.Exists(thumbnailsfullpath & aa(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & aa(0) & ".png")
End If
End If
End If
End If
dgv1.Rows(g).Cells("Column11").Value = xyz(7)
dgv1.Rows(g).Cells("AudioLevel").Value = xyz(8)
dgv1.Rows(g).Cells("Conversion").Value = xyz(9)
dgv1.Rows(g).Cells("clmFilter").Value = xyz(10)
dgv1.Rows(g).Cells("Template_File").Value = xyz(11)
dgv1.Rows(g).Cells("FileType").Value = xyz(12)
dgv1.Rows(g).Cells("BackIn").Value = xyz(13)
dgv1.Rows(g).Cells("AMCPCommands").Value = xyz(14)
g = g + 1
Loop
sr.Close()
End Using
Me.lblplalistname.Text = "playlist= " & ofd2.FileName
End If
End Sub
Sub openfile(filename As String)
' On Error Resume Next
ofd2.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
ofd2.InitialDirectory = "c:\casparcg\mydata\playlist\"
SaveToolStripMenuItem.Enabled = True
Using sr As StreamReader = New StreamReader(filename)
'clear list
dgv1.Rows.Clear()
'Loop through and add list to the file.
Dim g As Integer = 0
Dim li As String
Do Until sr.EndOfStream = True
li = sr.ReadLine()
dgv1.Rows.Add()
Dim xyz As Array = Split(li, Chr(2))
dgv1.Rows(g).Cells("File_Name").Value = xyz(0)
dgv1.Rows(g).Cells("Start_Time").Value = xyz(1)
dgv1.Rows(g).Cells("x").Value = xyz(2)
dgv1.Rows(g).Cells("Transition").Value = xyz(3)
dgv1.Rows(g).Cells("T_Duration").Value = xyz(4)
dgv1.Rows(g).Cells("LoopVideo").Value = xyz(5)
dgv1.Rows(g).Cells("Clip_Duration").Value = xyz(6)
If chkshowthumbnail.Checked Then
Dim aa As Array = Split(xyz(0), ".")
If aa.Length = 2 Then
If aa(1) = "txt" Then
readsubclip(mediafullpath & xyz(0))
If System.IO.File.Exists(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png")
End If
Else
If System.IO.File.Exists(thumbnailsfullpath & aa(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & aa(0) & ".png")
End If
End If
End If
End If
dgv1.Rows(g).Cells("Column11").Value = xyz(7)
dgv1.Rows(g).Cells("AudioLevel").Value = xyz(8)
dgv1.Rows(g).Cells("Conversion").Value = xyz(9)
dgv1.Rows(g).Cells("clmFilter").Value = xyz(10)
g = g + 1
Loop
sr.Close()
End Using
Me.lblplalistname.Text = "playlist= " & filename
End Sub
Sub insertfile()
On Error Resume Next
ofd2.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
ofd2.InitialDirectory = "c:\casparcg\mydata\playlist\"
If (ofd2.ShowDialog() = Windows.Forms.DialogResult.OK) Then
Using sr As StreamReader = New StreamReader(ofd2.FileName)
Dim g As Integer = dgv1.CurrentRow.Index
Dim li As String
Do Until sr.EndOfStream = True
li = sr.ReadLine()
dgv1.Rows.Insert(dgv1.CurrentRow.Index, 1)
Dim xyz As Array = Split(li, Chr(2))
dgv1.Rows(g).Cells("File_Name").Value = xyz(0)
dgv1.Rows(g).Cells("Start_Time").Value = xyz(1)
dgv1.Rows(g).Cells("x").Value = xyz(2)
dgv1.Rows(g).Cells("Transition").Value = xyz(3)
dgv1.Rows(g).Cells("T_Duration").Value = xyz(4)
dgv1.Rows(g).Cells("LoopVideo").Value = xyz(5)
dgv1.Rows(g).Cells("Clip_Duration").Value = xyz(6)
If chkshowthumbnail.Checked Then
Dim aa As Array = Split(xyz(0), ".")
If aa.Length = 2 Then
If aa(1) = "txt" Then
readsubclip(mediafullpath & xyz(0))
If System.IO.File.Exists(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & Split(masterfilename, ".")(0) & ".png")
End If
Else
If System.IO.File.Exists(thumbnailsfullpath & aa(0) & ".png") Then
dgv1.Rows(g).Cells("Column3").Value = System.Drawing.Image.FromFile(thumbnailsfullpath & aa(0) & ".png")
End If
End If
End If
End If
dgv1.Rows(g).Cells("Column11").Value = xyz(7)
dgv1.Rows(g).Cells("AudioLevel").Value = xyz(8)
dgv1.Rows(g).Cells("Conversion").Value = xyz(9)
dgv1.Rows(g).Cells("clmFilter").Value = xyz(10)
dgv1.Rows(g).Cells("Template_File").Value = xyz(11)
dgv1.Rows(g).Cells("FileType").Value = xyz(12)
dgv1.Rows(g).Cells("BackIn").Value = xyz(13)
dgv1.Rows(g).Cells("AMCPCommands").Value = xyz(14)
g = g + 1
Loop
sr.Close()
End Using
Me.lblplalistname.Text = "playlist= " & Me.lblplalistname.Text & " + " & ofd2.FileName
End If
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
savefile()
End Sub
Sub savefile()
On Error Resume Next
osd2.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"
osd2.InitialDirectory = "c:\casparcg\mydata\playlist\"
osd2.FileName = Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName((Date.Today).DayOfWeek) & "_" & (Date.Today).Day & "_" & (Date.Today).Month & "_" & (Date.Today).Year & "_" & (TimeOfDay.Hour + 1) & "HRS"
If (osd2.ShowDialog() = Windows.Forms.DialogResult.OK) Then
Using sw As StreamWriter = New StreamWriter(osd2.FileName)
If dgv1.Rows.Count = 0 Then
sw.Write("")
Else
'Loop through and add list to the file.
Dim f As Integer = 0
Do Until f = dgv1.Rows.Count
If dgv1.Rows(f).Cells("x").Value = False Then dgv1.Rows(f).Cells("x").Value = "0"
If dgv1.Rows(f).Cells("Column11").Value = False Then dgv1.Rows(f).Cells("Column11").Value = "0"
If dgv1.Rows(f).Cells("Conversion").Value = False Then dgv1.Rows(f).Cells("Conversion").Value = "0"
If dgv1.Rows(f).Cells("BackIn").Value = False Then dgv1.Rows(f).Cells("BackIn").Value = "0"
sw.WriteLine(dgv1.Rows(f).Cells("File_Name").Value & Chr(2) & dgv1.Rows(f).Cells("Start_Time").Value & Chr(2) & dgv1.Rows(f).Cells("x").Value & Chr(2) & dgv1.Rows(f).Cells("Transition").Value & Chr(2) & dgv1.Rows(f).Cells("T_Duration").Value & Chr(2) & dgv1.Rows(f).Cells("LoopVideo").Value & Chr(2) & dgv1.Rows(f).Cells("Clip_Duration").Value & Chr(2) & dgv1.Rows(f).Cells("Column11").Value & Chr(2) & dgv1.Rows(f).Cells("AudioLevel").Value & Chr(2) & dgv1.Rows(f).Cells("Conversion").Value & Chr(2) & dgv1.Rows(f).Cells("clmFilter").Value & Chr(2) & dgv1.Rows(f).Cells("Template_File").Value & Chr(2) & dgv1.Rows(f).Cells("FileType").Value & Chr(2) & dgv1.Rows(f).Cells("BackIn").Value & Chr(2) & dgv1.Rows(f).Cells("AMCPCommands").Value)
f = f + 1
Loop
End If
sw.Close()
End Using
Me.lblplalistname.Text = "playlist= " & osd2.FileName
SaveToolStripMenuItem.Enabled = True
End If
End Sub
Sub showlivedecklink(devicenumber As Integer)
On Error Resume Next
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " decklink " & devicenumber)
End Sub
Private Sub btnstartattime_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnstartattime.Click
On Error Resume Next
'if nothing is selected
Dim bbb As Integer = 0
For aaa = 0 To dgv1.RowCount - 1
bbb = bbb + dgv1.Rows(aaa).Cells("x").Value
Next
If bbb = 0 Then MsgBox("no clip is selected") : Exit Sub
Dim aa As Date = DateTimePicker1.Value
Dim elapsed As Integer
elapsed = (aa.Date - Now.Date).Days
If ((23 < elapsed) Or (0 > elapsed)) Then
MsgBox("value must be less than 23 days" & "Your value is " & elapsed)
Exit Sub
End If
timeinterval = (86400000 * elapsed) + (aa.Hour - Now.Hour) * 3600000 + (aa.Minute - Now.Minute) * 60000 + (aa.Second - Now.Second) * 1000
If timeinterval < 0 Then
MsgBox("Past time is not allowed")
Exit Sub
End If
Me.tmrstartattime.Interval = timeinterval
Me.tmrstartattime.Enabled = True
chkplaylistlock.Checked = True
End Sub
Private Sub tmrstartattime_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrstartattime.Tick
On Error Resume Next
Me.tmrstartattime.Enabled = False
playlist()
End Sub
Private Sub cmddurationofplaylist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmddurationofplaylist.Click
On Error Resume Next
Dim dH As Integer = 0
Dim dM As Integer = 0
Dim dS As Integer = 0
For iduration = 0 To dgv1.Rows.Count - 1
If dgv1.Rows(iduration).Cells("x").Value = 1 Then
Dim dd As Array = Split(dgv1.Rows(iduration).Cells("Clip_Duration").Value, ":")
dH = dH + dd(0)
dM = dM + dd(1)
dS = dS + dd(2)
End If
Next
Dim totalsecond As Integer = dH * 3600 + dM * 60 + dS
Dim aa = TimeSpan.FromSeconds(totalsecond)
txtdurationofplalist.Text = aa.Hours & ":" & aa.Minutes & ":" & aa.Seconds
End Sub
Private Sub cmdremainingdurationofplaylist_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdremainingdurationofplaylist.Click
On Error Resume Next
Dim dH As Integer = Split(frmmediaplayer.lblremainintime.Text, ":")(0) ' Split(dgv1.CurrentRow.Cells("Duration").Value, ":")(0)
Dim dM As Integer = Split(frmmediaplayer.lblremainintime.Text, ":")(1)
Dim dS As Integer = Split(frmmediaplayer.lblremainintime.Text, ":")(2)
For iduration = ((dgv1.CurrentRow.Index) + 1) To dgv1.Rows.Count - 1
If dgv1.Rows(iduration).Cells("x").Value = 1 Then
Dim dd As Array = Split(dgv1.Rows(iduration).Cells("Clip_Duration").Value, ":")
dH = dH + dd(0)
dM = dM + dd(1)
dS = dS + dd(2)
End If
Next
Dim totalsecond As Integer = dH * 3600 + dM * 60 + dS
Dim aa = TimeSpan.FromSeconds(totalsecond)
txtremaingdurationofplaylist.Text = aa.Hours & ":" & aa.Minutes & ":" & aa.Seconds
End Sub
Public Sub PlaySingleClip()
On Error Resume Next
currrow = dgv1.CurrentRow.Index
If dgv1.CurrentRow.Cells("File_Name").Value = "" Then Exit Sub
playcommand()
sendmixercommandforclip()
tmrduration.Enabled = True
createasrunlog()
iclippauseresume = 1
End Sub
Sub playcommand()
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 8)).ToUpper = "DECKLINK" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "HTTP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " [HTML] " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "UDP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "TCP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTMP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTSP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTCP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf System.IO.Path.GetExtension(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
frmmediaplayer.ucCasparcgWindow1.txtmarkin.Text = clipseek
frmmediaplayer.ucCasparcgWindow1.txtmarkout.Text = cliplength + clipseek
If ServerVersion > 2.1 Then '
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & (clipseek) * 2 & " length " & (cliplength) * 2 & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
Else
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.CurrentRow.Cells("File_Name").Value) & """" & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
linktemplatetoplaylist()
End Sub
Sub linktemplatetoplaylist()
If chktemplatewithplaylist.Checked Then
dgv1.CurrentRow.Cells("Start_Time").Value = Format(Now, "HH:mm:ss")
ucTemplate.stopshedule()
ucTemplate.dgvrundown.Rows.Clear()
If dgv1.CurrentRow.Cells("Template_File").Value <> "" And File.Exists(dgv1.CurrentRow.Cells("Template_File").Value) Then
ucTemplate.openfilerundown(dgv1.CurrentRow.Cells("Template_File").Value)
ucTemplate.txtadjusttimeofrundownmin.Text = (Mid(dgv1.CurrentRow.Cells("Start_Time").Value, 1, 2)) * 60 + Mid(dgv1.CurrentRow.Cells("Start_Time").Value, 4, 2)
ucTemplate.txtadjusttimeofrundownsec.Text = Mid(dgv1.CurrentRow.Cells("Start_Time").Value, 7, 2)
ucTemplate.adjusttimeofrundown()
ucTemplate.sheduletemplate()
End If
End If
End Sub
Sub nextclipplay()
On Error Resume Next
'if nothing is selected
Dim bbb As Integer = 0
For aaa = 0 To dgv1.RowCount - 1
bbb = bbb + dgv1.Rows(aaa).Cells("x").Value
Next
If bbb = 0 Then MsgBox("no clip is selected") : Exit Sub
On Error Resume Next
20:
Dim i As Integer
i = dgv1.CurrentRow.Index
If i = (dgv1.Rows.Count - 1) Then
dgv1.CurrentCell = dgv1.Rows(0).Cells("File_Name")
currrow = 0
Else
dgv1.CurrentCell = dgv1.Rows(i + 1).Cells("File_Name")
currrow = currrow + 1
End If
If dgv1.CurrentRow.Cells("File_Name").Value = "" Or dgv1.CurrentRow.Cells("x").Value = 0 Then GoTo 20
playcommand()
sendmixercommandforclip()
tmrduration.Enabled = True
End Sub
Sub nextclip()
On Error Resume Next
20:
Dim i As Integer
i = dgv1.CurrentRow.Index
If i = (dgv1.Rows.Count - 1) Then
dgv1.CurrentCell = dgv1.Rows(0).Cells("File_Name")
currrow = 0
Else
dgv1.CurrentCell = dgv1.Rows(i + 1).Cells("File_Name")
currrow = currrow + 1
End If
If dgv1.CurrentRow.Cells("File_Name").Value = "" Or dgv1.CurrentRow.Cells("x").Value = 0 Then GoTo 20
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 8)).ToUpper = "DECKLINK" Then
CasparDevice.SendString("load " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "HTTP" Then
CasparDevice.SendString("load " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " [HTML] " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "UDP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "TCP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTMP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTSP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTCP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
ElseIf System.IO.Path.GetExtension(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
frmmediaplayer.ucCasparcgWindow1.txtmarkin.Text = clipseek
frmmediaplayer.ucCasparcgWindow1.txtmarkout.Text = cliplength + clipseek
If ServerVersion > 2.1 Then
CasparDevice.SendString("load " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek * 2 & " length " & cliplength * 2 & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("load " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
Else
CasparDevice.SendString("load " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.CurrentRow.Cells("File_Name").Value) & """" & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
sendmixercommandforclip()
tmrduration.Enabled = True
End Sub
Sub clipstop()
On Error Resume Next
CasparDevice.SendString("stop " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer)
End Sub
Sub clippause()
On Error Resume Next
If dgv1.CurrentRow.Cells("File_Name").Value = "" Then Exit Sub
If Microsoft.VisualBasic.Strings.Right(frmmediaplayer.ucCasparcgWindow1.lblplaying.Text, 3) <> "mav" Then
CasparDevice.SendString("pause " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer)
Else
CasparDevice.SendString("call " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " pause")
End If
End Sub
Sub clipresume()
On Error Resume Next
If iclippauseresume = 1 Then
If Microsoft.VisualBasic.Strings.Right(frmmediaplayer.ucCasparcgWindow1.lblplaying.Text, 3) <> "mav" Then
CasparDevice.SendString("pause " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer)
Else
CasparDevice.SendString("call " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " speed 0") 'for slow motion
End If
Else
If Microsoft.VisualBasic.Strings.Right(frmmediaplayer.ucCasparcgWindow1.lblplaying.Text, 3) <> "mav" Then
CasparDevice.SendString("resume " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer)
Else
CasparDevice.SendString("call " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " speed 1") 'for slow motion
End If
End If
iclippauseresume = iclippauseresume + 1
If iclippauseresume = 3 Then iclippauseresume = 1
tmrduration.Enabled = True
End Sub
Private Sub tmrnextclip_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrnextclip.Tick
On Error Resume Next
If dgv1.Rows(currrow).Cells("File_Name").Value = "end" Then
tmrnextclip.Enabled = False
Else
nextclipofplaylist()
End If
End Sub
Sub nextclipofplaylist()
On Error Resume Next
'if nothing is selected
Dim bbb As Integer = 0
For aaa = 0 To dgv1.RowCount - 1
bbb = bbb + dgv1.Rows(aaa).Cells("x").Value
Next
If bbb = 0 Then tmrnextclip.Enabled = False : Exit Sub
If ((clipsleftduration < 1.0) And (dgv1.Rows(currrow).Cells("LoopVideo").Value <> "loop")) Or (dgv1.Rows(currrow).Cells("x").Value = 0) Or tmrnextclip.Interval > 1000 Then
Dim tempcurrentrow As Integer = dgv1.CurrentRow.Index ' for selected row to remain same. Suggested by srk 04.06.18
20:
Dim inextclipofplaylist As Integer
inextclipofplaylist = dgv1.Rows(currrow).Index
If inextclipofplaylist = (dgv1.Rows.Count - 1) Then
dgv1.CurrentCell = dgv1.Rows(0).Cells("File_Name")
currrow = 0
Else
dgv1.CurrentCell = dgv1.Rows(inextclipofplaylist + 1).Cells("File_Name")
currrow = currrow + 1
End If
If dgv1.Rows(currrow).Cells("File_Name").Value = "" Or dgv1.Rows(currrow).Cells("x").Value = 0 Then GoTo 20
If Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 8) = "decklink" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "HTTP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " [HTML] " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If (Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "UDP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "TCP:" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTMP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTSP" Or
(Mid(dgv1.CurrentRow.Cells("File_Name").Value, 1, 4)).ToUpper = "RTCP" Then
CasparDevice.SendString("play " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & dgv1.CurrentRow.Cells("File_Name").Value & " " & dgv1.CurrentRow.Cells("Transition").Value & " " & dgv1.CurrentRow.Cells("T_Duration").Value & " " & dgv1.CurrentRow.Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
GoTo 30
End If
If frmmediaplayer.ucTab1.UcPlaylistSetting1.chkLoadbg.Checked Then
If System.IO.Path.GetExtension(mediafullpath & dgv1.Rows(currrow).Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
If ServerVersion > 2.1 Then
CasparDevice.SendString("PLAY " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek * 2 & " length " & cliplength * 2 & " " & dgv1.Rows(currrow).Cells("Transition").Value & " " & dgv1.Rows(currrow).Cells("T_Duration").Value & " " & dgv1.Rows(currrow).Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("PLAY " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.Rows(currrow).Cells("Transition").Value & " " & dgv1.Rows(currrow).Cells("T_Duration").Value & " " & dgv1.Rows(currrow).Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
CasparDevice.SendString("loadbg " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(currrow + 1).Cells("File_Name").Value) & """")
Else
CasparDevice.SendString("PLAY " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(currrow).Cells("File_Name").Value) & """" & " " & dgv1.Rows(currrow).Cells("Transition").Value & " " & dgv1.Rows(currrow).Cells("T_Duration").Value & " " & dgv1.Rows(currrow).Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
CasparDevice.SendString("loadbg " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(currrow + 1).Cells("File_Name").Value) & """")
End If
Else
If System.IO.Path.GetExtension(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString) = ".txt" Then
readsubclip(mediafullpath & dgv1.CurrentRow.Cells("File_Name").Value.ToString)
CasparDevice.SendString("PLAY " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(masterfilename) & """" + " seek " & clipseek & " length " & cliplength & " " & dgv1.Rows(currrow).Cells("Transition").Value & " " & dgv1.Rows(currrow).Cells("T_Duration").Value & " " & dgv1.Rows(currrow).Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
Else
CasparDevice.SendString("PLAY " & g_int_ChannelNumber & "-" & g_int_PlaylistLayer & " " & """" & ModifyFilename(dgv1.Rows(currrow).Cells("File_Name").Value) & """" & " " & dgv1.Rows(currrow).Cells("Transition").Value & " " & dgv1.Rows(currrow).Cells("T_Duration").Value & " " & dgv1.Rows(currrow).Cells("LoopVideo").Value & " " & dgv1.CurrentRow.Cells("clmFilter").Value)
End If
End If
30:
sendmixercommandforclip()
If dgv1.Rows(currrow).Cells("File_Name").Value <> "end" Then 'no chance to enable tmrnextclip
tmrfornotskiping.Enabled = True
End If
If dgv1.Rows(currrow).Cells("Column11").Value = True Then
calculateinterval()
Else
tmrnextclip.Interval = 1000
End If
adjusttimeofplaylist()
tmrnextclip.Enabled = False
createasrunlog()
linktemplatetoplaylist()
If frmmediaplayer.ucTab1.UcPlaylistSetting1.chkStayOnSelected.Checked Then
dgv1.CurrentCell = dgv1.Rows(tempcurrentrow).Cells("File_Name") ' for selected row to remain same. Suggested by srk 04.06.18
End If
End If
End Sub
Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
newdgv()
End Sub
Sub newdgv()
On Error Resume Next
dgv1.Rows.Clear()
dgv1.Rows.Add(20)
Me.lblplalistname.Text = "playlist= " & "new playlist"
End Sub
Sub insertend()
On Error Resume Next
dgv1.Rows.Insert(dgv1.CurrentRow.Index + 1)
dgv1.CurrentCell = dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("File_Name")
dgv1.Rows(dgv1.CurrentRow.Index).Cells("File_Name").Value = "end"
dgv1.Rows(dgv1.CurrentRow.Index).Cells("x").Value = 1
dgv1.Rows(dgv1.CurrentRow.Index).Cells("Transition").Value = "MIX"
dgv1.Rows(dgv1.CurrentRow.Index).Cells("T_Duration").Value = 10
End Sub
Sub insertlivedecklink(devicenumber As Integer)
On Error Resume Next
dgv1.Rows.Insert(dgv1.CurrentRow.Index + 1)
dgv1.CurrentCell = dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("File_Name")
dgv1.Rows(dgv1.CurrentRow.Index).Cells("File_Name").Value = "decklink " & devicenumber
dgv1.Rows(dgv1.CurrentRow.Index).Cells("x").Value = 1
dgv1.Rows(dgv1.CurrentRow.Index).Cells("Transition").Value = "MIX"
dgv1.Rows(dgv1.CurrentRow.Index).Cells("T_Duration").Value = 10
dgv1.Rows(dgv1.CurrentRow.Index).Cells("Clip_Duration").Value = "00:30:00"
dgv1.Rows(dgv1.CurrentRow.Index).Cells("Column11").Value = True
dgv1.Rows(dgv1.CurrentRow.Index).Cells("AudioLevel").Value = 1.0
dgv1.CurrentRow.Cells("FileType").Value = "Others"
End Sub
'ttt
Private Sub cmdinsert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdinsert.Click
On Error Resume Next
clipinsert()
End Sub
Sub clipinsert()
On Error Resume Next
If dgv1.CurrentRow.Index < currrow Then
currrow = currrow + 1
End If
dgv1.NotifyCurrentCellDirty(True)
dgv1.NotifyCurrentCellDirty(False)
dgv1.Rows.Insert(dgv1.CurrentRow.Index + 1)
dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("x").Value = 1
dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("Transition").Value = "MIX"
dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("T_Duration").Value = 10
dgv1.Rows(dgv1.CurrentRow.Index + 1).Cells("AudioLevel").Value = 1.0
End Sub
Sub deleteclip()
On Error Resume Next
If dgv1.CurrentRow.DefaultCellStyle.BackColor <> Color.LightGreen Then
If dgv1.CurrentRow.Index < currrow Then
currrow = currrow - 1
End If
dgv1.NotifyCurrentCellDirty(True)
dgv1.NotifyCurrentCellDirty(False)
dgv1.Rows.RemoveAt(dgv1.CurrentRow.Index)
adjusttimeofplaylistfornewclip(dgv1.CurrentRow.Index)
Else
MsgBox("Online clip cann't be deleted.")
End If
End Sub
Private Sub CasparcgWindowToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
frmmediaplayer.ucCasparcgWindow1.SetProcessParent("casparcg")
End Sub
Private Sub StartToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
playlist()
End Sub
Private Sub NextToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
nextclip()
End Sub
Private Sub PauseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
clippause()
End Sub
Private Sub ResumeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
clipresume()
End Sub
Private Sub InToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
clipinsert()
End Sub
Private Sub DeleteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
On Error Resume Next
deleteclip()
End Sub
Private Sub cmdmoveup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdmoveup.Click
On Error Resume Next