-
Notifications
You must be signed in to change notification settings - Fork 34
/
backend.php
2120 lines (1685 loc) · 61.7 KB
/
backend.php
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
<?php
//# Shortcuts
if ($_GET['action'] == 'pause') {
$outputtext = "pause video";
system ("/var/www/sync/dbuscontrol.sh pause > /dev/null 2>&1");
system("sudo /var/www/sync/mapperpause");
system("killall -9 /opt/fsayskeyboard");
}
if ($_GET['action'] == 'fastforward') {
$outputtext = "seek video forward";
system ("sudo /var/www/sync/dbuscontrol.sh seek 10000000");
}
if ($_GET['action'] == 'stop') {
$outputtext = "all players stopped";
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
}
if ($_GET['action'] == 'stopvideo') {
$outputtext = "stop video player only";
system ("sudo /var/www/sync/stopvideo > /dev/null 2>&1");
}
if ($_GET['action'] == 'getcontent') {
system ("sudo /var/www/sync/getcontent");
system ("sudo chmod 777 /media/internal/video/*");
$outputtext = "content from your defined websource downloaded";
}
if ($_GET['action'] == 'pause') {
exec("sudo /var/www/sync/pause.py");
$outputtext = "Pause, click again to resume";
}
if ($_GET['action'] == 'screenshot') {
exec("sudo /var/www/sync/screenshot");
$outputtext = "Printscreen saved in /media/internal/images";
}
//////////////////
//# Video Section
/////////////////
if ($_GET['action'] == 'setsync_long') {
$outputtext = "set sync script to long videos";
system ("sudo cp /var/www/sync/omxplayer-sync-long /usr/bin/omxplayer-sync");
}
if ($_GET['action'] == 'setsync_short') {
$outputtext = "stet sync script to short videos";
system ("sudo cp /var/www/sync/omxplayer-sync-short /usr/bin/omxplayer-sync");
}
if ($_GET['action'] == 'startseamless') {
$outputtext = "start seamless video loop player";
system ("sudo /var/www/sync/startseamless");
}
if ($_GET['action'] == 'startmasterwifi') {
$outputtext = "start master over wifi sync, be patient";
system ("sudo /var/www/sync/startmasterwifi");
}
if ($_GET['action'] == 'startslavewifi') {
$outputtext = "start slave over wifi sync, be patient";
system ("sudo /var/www/sync/startslavewifi");
}
if ($_GET['action'] == 'setseamlessscript') {
$outputtext = "set to seamless sync-script";
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system ("sudo cp /var/www/sync/omxplayer-sync /usr/bin/omxplayer-sync");
}
if ($_GET['action'] == 'setgapscript') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
$outputtext = "set to gap playlist sync-script";
system ("sudo cp /var/www/sync/omxplayer-sync-old /usr/bin/omxplayer-sync");
}
if ($_GET['action'] == 'setwifiscript') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
$outputtext = "increase sync window tolerance for wifi sync";
system ("sudo cp /var/www/sync/omxplayer-sync-wifi /usr/bin/omxplayer-sync");
}
if ($_GET['action'] == 'startseamless01') {
$outputtext = "start seamless video_01 loop";
system ("sudo /var/www/sync/startseamless01");
}
if ($_GET['action'] == 'startseamless02') {
$outputtext = "start seamless video_02 loop";
system ("sudo /var/www/sync/startseamless02");
}
if ($_GET['action'] == 'startseamless03') {
$outputtext = "start seamless video_03 loop";
system ("sudo /var/www/sync/startseamless03");
}
if ($_GET['action'] == 'startseamless04') {
$outputtext = "start seamless video_04 loop";
system ("sudo /var/www/sync/startseamless04");
}
if ($_GET['action'] == 'startseamless05') {
$outputtext = "start seamless video_05 loop";
system ("sudo /var/www/sync/startseamless05");
}
if ($_GET['action'] == 'startmaster') {
#exec("sudo /var/www/sync/startmaster");
exec("sudo /var/www/sync/alsatester");
$outputtext = "start player as master";
}
if ($_GET['action'] == 'startmaster01') {
exec("sudo /var/www/sync/startmaster01");
$outputtext = "start video 01 loop";
}
if ($_GET['action'] == 'startmaster02') {
exec("sudo /var/www/sync/startmaster02");
$outputtext = "start video 02 loop";
}
if ($_GET['action'] == 'startmaster03') {
exec("sudo /var/www/sync/startmaster03");
$outputtext = "start video 03 loop";
}
if ($_GET['action'] == 'startmaster04') {
exec("sudo /var/www/sync/startmaster04");
$outputtext = "start video 04 loop";
}
if ($_GET['action'] == 'startmaster05') {
exec("sudo /var/www/sync/startmaster05");
$outputtext = "start video 05 loop";
}
if ($_GET['action'] == 'startmaster06') {
exec("sudo /var/www/sync/startmaster06");
$outputtext = "start video 06 loop";
}
if ($_GET['action'] == 'startmaster07') {
exec("sudo /var/www/sync/startmaster07");
$outputtext = "start video 07 loop";
}
if ($_GET['action'] == 'startmaster08') {
exec("sudo /var/www/sync/startmaster08");
$outputtext = "start video 08 loop";
}
if ($_GET['action'] == 'startmaster09') {
exec("sudo /var/www/sync/startmaster09");
$outputtext = "start video 09 loop";
}
if ($_GET['action'] == 'startmaster10') {
exec("sudo /var/www/sync/startmaster10");
$outputtext = "start video 10 loop";
}
if ($_GET['action'] == 'startmaster11') {
exec("sudo /var/www/sync/startmaster11");
$outputtext = "start video 11 loop";
}
if ($_GET['action'] == 'startmaster12') {
exec("sudo /var/www/sync/startmaster12");
$outputtext = "start video 12 loop";
}
if ($_GET['action'] == 'startmaster13') {
exec("sudo /var/www/sync/startmaster13");
$outputtext = "start video 13 loop";
}
if ($_GET['action'] == 'startmaster14') {
exec("sudo /var/www/sync/startmaster14");
$outputtext = "start video 14 loop";
}
if ($_GET['action'] == 'startmaster15') {
exec("sudo /var/www/sync/startmaster15");
$outputtext = "start video 15 loop";
}
if ($_GET['action'] == 'startmaster16') {
exec("sudo /var/www/sync/startmaster16");
$outputtext = "start video 16 loop";
}
if ($_GET['action'] == 'startmasteronce') {
exec("sudo /var/www/sync/startmasterone");
$outputtext = "start player as master once";
}
if ($_GET['action'] == 'startmasteronce01') {
$outputtext = "start video 01 once";
exec("sudo /var/www/sync/startmasterone01 > /dev/null 2>&1");
}
if ($_GET['action'] == 'startmasteronce02') {
exec("sudo /var/www/sync/startmasterone02");
$outputtext = "start video 02 once";
}
if ($_GET['action'] == 'startmasteronce03') {
exec("sudo /var/www/sync/startmasterone03");
$outputtext = "start video 03 once";
}
if ($_GET['action'] == 'startmasteronce04') {
exec("sudo /var/www/sync/startmasterone04");
$outputtext = "start video 04 once";
}
if ($_GET['action'] == 'startmasteronce05') {
exec("sudo /var/www/sync/startmasterone05");
$outputtext = "start video 05 once";
}
if ($_GET['action'] == 'startmasteronce06') {
exec("sudo /var/www/sync/startmasterone06");
$outputtext = "start video 06 once";
}
if ($_GET['action'] == 'startmasteronce07') {
exec("sudo /var/www/sync/startmasterone07");
$outputtext = "start video 07 once";
}
if ($_GET['action'] == 'startmasteronce08') {
exec("sudo /var/www/sync/startmasterone08");
$outputtext = "start video 08 once";
}
if ($_GET['action'] == 'startmasteronce09') {
exec("sudo /var/www/sync/startmasterone09");
$outputtext = "start video 09 once";
}
if ($_GET['action'] == 'startmasteronce10') {
exec("sudo /var/www/sync/startmasterone10");
$outputtext = "start video 10 once";
}
if ($_GET['action'] == 'startmasteronce11') {
exec("sudo /var/www/sync/startmasterone11");
$outputtext = "start video 11 once";
}
if ($_GET['action'] == 'startmasteronce12') {
exec("sudo /var/www/sync/startmasterone12");
$outputtext = "start video 12 once";
}
if ($_GET['action'] == 'startmasteronce13') {
exec("sudo /var/www/sync/startmasterone13");
$outputtext = "start video 13 once";
}
if ($_GET['action'] == 'startmasteronce14') {
exec("sudo /var/www/sync/startmasterone14");
$outputtext = "start video 14 once";
}
if ($_GET['action'] == 'startmasteronce15') {
exec("sudo /var/www/sync/startmasterone15");
$outputtext = "start video 15 once";
}
if ($_GET['action'] == 'startmasteronce16') {
exec("sudo /var/www/sync/startmasterone16");
$outputtext = "start video 16 once";
}
if ($_GET['action'] == 'startmasteronce17') {
exec("sudo /var/www/sync/startmasterone17");
$outputtext = "start video 17 once";
}
if ($_GET['action'] == 'startmasteronce18') {
exec("sudo /var/www/sync/startmasterone18");
$outputtext = "start video 18 once";
}
if ($_GET['action'] == 'startmasteronce19') {
exec("sudo /var/www/sync/startmasterone19");
$outputtext = "start video 19 once";
}
if ($_GET['action'] == 'startmasteronce20') {
exec("sudo /var/www/sync/startmasterone20");
$outputtext = "start video 20 once";
}
///////////////////////
//# Video without sync
///////////////////////
if ($_GET['action'] == 'startless') {
exec("sudo /var/www/sync/startless > /dev/null 2>&1");
$outputtext = "start video without sync";
}
if ($_GET['action'] == 'startless01') {
exec("sudo /var/www/sync/startless01 > /dev/null 2>&1");
$outputtext = "start video 01";
}
if ($_GET['action'] == 'startless02') {
exec("sudo /var/www/sync/startless02 > /dev/null 2>&1");
$outputtext = "start video 02";
}
if ($_GET['action'] == 'startless03') {
exec("sudo /var/www/sync/startless03 > /dev/null 2>&1");
$outputtext = "start video 03";
}
if ($_GET['action'] == 'startless04') {
exec("sudo /var/www/sync/startless04 > /dev/null 2>&1");
$outputtext = "start video 04";
}
if ($_GET['action'] == 'startless05') {
exec("sudo /var/www/sync/startless05 > /dev/null 2>&1");
$outputtext = "start video 05";
}
if ($_GET['action'] == 'startless06') {
exec("sudo /var/www/sync/startless06 > /dev/null 2>&1");
$outputtext = "start video 06";
}
if ($_GET['action'] == 'startless07') {
exec("sudo /var/www/sync/startless07 > /dev/null 2>&1");
$outputtext = "start video 07";
}
if ($_GET['action'] == 'startless08') {
exec("sudo /var/www/sync/startless08 > /dev/null 2>&1");
$outputtext = "start video 08";
}
if ($_GET['action'] == 'startless09') {
exec("sudo /var/www/sync/startless09 > /dev/null 2>&1");
$outputtext = "start video 09";
}
if ($_GET['action'] == 'startless10') {
exec("sudo /var/www/sync/startless10 > /dev/null 2>&1");
$outputtext = "start video 10";
}
if ($_GET['action'] == 'startless11') {
exec("sudo /var/www/sync/startless11 > /dev/null 2>&1");
$outputtext = "start video 11";
}
if ($_GET['action'] == 'startless12') {
exec("sudo /var/www/sync/startless12 > /dev/null 2>&1");
$outputtext = "start video 12";
}
//////////////////////////
// Video once without sync
//////////////////////////
if ($_GET['action'] == 'startlessonce01') {
exec("sudo /var/www/sync/startlessonce01 > /dev/null 2>&1");
$outputtext = "start video 01 once";
}
if ($_GET['action'] == 'startlessonce02') {
exec("sudo /var/www/sync/startlessonce02 > /dev/null 2>&1");
$outputtext = "start video 02 once";
}
if ($_GET['action'] == 'startlessonce03') {
exec("sudo /var/www/sync/startlessonce03> /dev/null 2>&1");
$outputtext = "start video 03 once";
}
if ($_GET['action'] == 'startlessonce04') {
exec("sudo /var/www/sync/startlessonce04 > /dev/null 2>&1");
$outputtext = "start video 04 once";
}
if ($_GET['action'] == 'startlessonce05') {
exec("sudo /var/www/sync/startlessonce05 > /dev/null 2>&1");
$outputtext = "start video 05 once";
}
if ($_GET['action'] == 'startlessonce06') {
exec("sudo /var/www/sync/startlessonce06 > /dev/null 2>&1");
$outputtext = "start video 06 once";
}
if ($_GET['action'] == 'startlessonce07') {
exec("sudo /var/www/sync/startlessonce07 > /dev/null 2>&1");
$outputtext = "start video 07 once";
}
if ($_GET['action'] == 'startlessonce08') {
exec("sudo /var/www/sync/startlessonce08 > /dev/null 2>&1");
$outputtext = "start video 08 once";
}
if ($_GET['action'] == 'startlessonce09') {
exec("sudo /var/www/sync/startlessonce09 > /dev/null 2>&1");
$outputtext = "start video 09 once";
}
if ($_GET['action'] == 'startlessonce10') {
exec("sudo /var/www/sync/startlessonce10 > /dev/null 2>&1");
$outputtext = "start video 10 once";
}
//// video slave
/////
if ($_GET['action'] == 'stopslaves') {
$outputtext = "stop to all slaves sent";
system ("sudo /var/www/sync/stopslaves > /dev/null 2>&1");
}
if ($_GET['action'] == 'startslave') {
exec("sudo /var/www/sync/startslave > /dev/null 2>&1");
$outputtext = "start player as slave";
}
if ($_GET['action'] == 'startslaveonce') {
exec("sudo /var/www/sync/startslaveonce > /dev/null 2>&1");
$outputtext = "start player as slave once";
}
if ($_GET['action'] == 'startmasterusb') {
exec("sudo /var/www/sync/startmasterusb");
$outputtext = "start player in usb mode";
}
if ($_GET['action'] == 'starthplayer') {
exec("sudo /var/www/sync/starthplayer");
$outputtext = "start hplayer with OSC control";
}
/////////////////////////////
// Slideshow after video once
/////////////////////////////
if ($_GET['action'] == 'enableslideafter') {
$outputtext = "enable slideshow after video played once";
system ("sudo /var/www/sync/set_enableslideafter > /dev/null 2>&1");
}
if ($_GET['action'] == 'disableslideafter') {
$outputtext = "disable slideshow after video played once";
system ("sudo /var/www/sync/set_disableslideafter > /dev/null 2>&1");
}
//////////////////////
// Video fader
////////////////////////
if ($_GET['action'] == 'videofadeout') {
exec("sudo /var/www/sync/fadeOUTscript");
$outputtext = "Fade video to black (still playing)";
}
if ($_GET['action'] == 'videofadein') {
exec("sudo /var/www/sync/fadeINscript");
$outputtext = "Fade video In (still playing)";
}
//# Imageplayer
if ($_GET['action'] == 'stopimage') {
$outputtext = "image player stopped";
system("sudo killall fbi");
#hier muss noch kill feh und x rein?
}
if ($_GET['action'] == 'imagekenburn') {
$outputtext = "start image player";
system("sudo /var/www/sync/startimage > /dev/null &");
}
if ($_GET['action'] == 'image') {
$outputtext = "start image player";
system("sudo /var/www/sync/startimage > /dev/null &");
}
if ($_GET['action'] == 'imageusb') {
$outputtext = "start image player from usb";
system("sudo /var/www/sync/startimageusb");
}
if ($_GET['action'] == 'startimagemanual') {
$outputtext = "start image player manual";
system("sudo /var/www/sync/startimagemanual");
}
if ($_GET['action'] == 'overlay') {
$outputtext = "start .png overlay";
system ("sudo sed -i '/OVERLAY=/c OVERLAY=ON' /var/www/sync/startmaster");
system("sudo /var/www/sync/overlay");
}
if ($_GET['action'] == 'stopoverlay') {
$outputtext = "stop .png overlay";
system ("sudo sed -i '/OVERLAY=/c OVERLAY=OFF' /var/www/sync/startmaster");
system("sudo /var/www/sync/overlaystop");
//system("sudo killall -9 /home/pi/raspidmx/pngview/./pngview");
}
//# Softedge
if ($_GET['action'] == 'softedge100h') {
$outputtext = "start softedge 100pixel horizontal";
system("sudo /var/www/sync/softedge100h");
}
if ($_GET['action'] == 'softedge200h') {
$outputtext = "start softedge 200pixel horizontal";
system("sudo /var/www/sync/softedge200h");
}
if ($_GET['action'] == 'softedge100v') {
$outputtext = "start softedge 100pixel horizontal";
system("sudo /var/www/sync/softedge100v");
}
if ($_GET['action'] == 'softedge200v') {
$outputtext = "start softedge 200pixel horizontal";
system("sudo /var/www/sync/softedge200v");
}
//# Slideshow Time
if ($_GET['action'] == 'slidetime0') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=0.1/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=0.1/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 15s";
}
if ($_GET['action'] == 'slidetime5') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=5/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=5/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 5s";
}
if ($_GET['action'] == 'slidetime10') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=10/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=10/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 10s";
}
if ($_GET['action'] == 'slidetime15') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=15/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=15/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 15s";
}
if ($_GET['action'] == 'slidetime30') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=30/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=30/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 30s";
}
if ($_GET['action'] == 'slidetime60') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=60/' /var/www/sync/xsessionslideshow");
system("sudo sed -ri 's/^DELAY=.+$/DELAY=60/' /var/www/sync/xsessionslidesusb");
system("sudo /var/www/sync/startimage > /dev/null &");
$outputtext = "set slideshowtime to 60s";
}
//# PDF player
if ($_GET['action'] == 'startpdf') {
$outputtext = "start pdf player";
system("sudo /var/www/sync/startpdf > /dev/null &");
}
if ($_GET['action'] == 'startpdfusb') {
$outputtext = "start pdf player";
system("sudo /var/www/sync/startpdfusb > /dev/null &");
}
//# Testscreen
if ($_GET['action'] == 'testscreen') {
system("sudo /var/www/sync/testscreen &");
$outputtext = "testscreen activated";
}
if ($_GET['action'] == 'testscreenoff') {
system ("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo /var/www/sync/testscreenoff &");
$outputtext = "testscreen deactivated";
}
//# Audioplayer
if ($_GET['action'] == 'startaudio') {
exec("sudo /var/www/sync/startaudio");
$outputtext = "start audio player";
}
if ($_GET['action'] == 'startaudioslave') {
exec("sudo /var/www/sync/startaudioslave");
$outputtext = "start audio slave player";
}
if ($_GET['action'] == 'startaudiousb') {
$outputtext = "start audio player in usb mode";
exec("sudo /var/www/startaudiousb");
}
if ($_GET['action'] == 'stopaudio') {
$outputtext = "stop audio player only";
system("sudo killall -9 mpg321");
}
//# Testtone
if ($_GET['action'] == 'testtone') {
exec("sudo /var/www/sync/omxkill");
exec("sudo omxplayer-sync -mu /var/www/sync/testtone.mp3 > /dev/null 2>&1 & echo $!");
$outputtext = "sinus 440 testtone";
}
if ($_GET['action'] == 'testtoneright') {
exec("sudo /var/www/sync/omxkill");
exec("sudo omxplayer-sync -mu /var/www/sync/testtone_right.mp3 > /dev/null 2>&1 & echo $!");
$outputtext = "sinus testtone right";
}
if ($_GET['action'] == 'testtoneleft') {
exec("sudo /var/www/sync/omxkill");
exec("sudo omxplayer-sync -mu /var/www/sync/testtone_left.mp3 > /dev/null 2>&1 & echo $!");
$outputtext = "sinus testtone left";
}
if ($_GET['action'] == 'volume_up') {
system("sudo su - pvj -c 'amixer set Master 100%'");
system("sudo alsactl store");
$outputtext = "<pre>$output</pre>";
}
//# DMX OLA stuff
if ($_GET['action'] == 'startola') {
exec("sudo /etc/init.d/olad start");
$outputtext = "OLA Daemon started, ready on port :9090";
}
if ($_GET['action'] == 'stopola') {
exec("sudo /etc/init.d/olad stop");
$outputtext = "OLA Daemon stopped";
}
if ($_GET['action'] == 'startqlcplus') {
$outputtext = "start QLC+";
system("sudo /var/www/sync/startqlcplus");
}
//# Puredata stuff
if ($_GET['action'] == 'startpd') {
$outputtext = "start puredata";
system("sudo /var/www/sync/startpd");
}
//# USB Stick mount
if ($_GET['action'] == 'reboot') {
$outputtext = "rebooting now!";
system("sudo reboot");
}
if ($_GET['action'] == 'shutdown') {
$outputtext = "shutting down";
system("sudo poweroff");
}
if ($_GET['action'] == 'eject') {
$outputtext = "usb stick unmounted";
system("sudo umount /dev/sda1");
system("sudo umount /dev/sda2");
}
if ($_GET['action'] == 'mount') {
$outputtext = "usb stick mounted";
system("sudo mount /dev/sda2 /media/usb/");
}
//# Autostart behaviour
if ($_GET['action'] == 'setmaster') {
$outputtext = "master set";
system("sudo cp /var/www/sync/rc.local.master /etc/rc.local");
}
if ($_GET['action'] == 'autostartloop01') {
$outputtext = "master01 loop set";
system("sudo cp /var/www/sync/rc.local.master01 /etc/rc.local");
}
if ($_GET['action'] == 'autostartloop02') {
$outputtext = "master02 loop set";
system("sudo cp /var/www/sync/rc.local.master02 /etc/rc.local");
}
if ($_GET['action'] == 'setslave') {
$outputtext = "slave set";
system("sudo cp /var/www/sync/rc.local.slave /etc/rc.local");
}
if ($_GET['action'] == 'setslaveonce') {
$outputtext = "slaveonce set";
system("sudo cp /var/www/sync/rc.local.slaveonce /etc/rc.local");
}
if ($_GET['action'] == 'seamless') {
$outputtext = "set to seamless player";
system("sudo cp /var/www/sync/rc.local.seamless /etc/rc.local");
}
if ($_GET['action'] == 'streamermaster') {
$outputtext = "master with audioserver";
system("sudo cp /var/www/sync/rc.local.streamermaster /etc/rc.local");
}
if ($_GET['action'] == 'streamerslave') {
$outputtext = "slave with audioserver";
system("sudo cp /var/www/sync/rc.local.streamerslave /etc/rc.local");
}
if ($_GET['action'] == 'streamerseamless') {
$outputtext = "seamless with audioserver";
system("sudo cp /var/www/sync/rc.local.streamerseamless /etc/rc.local");
}
if ($_GET['action'] == 'streameraudio') {
$outputtext = "audio with audioserver";
system("sudo cp /var/www/sync/rc.local.streameraudio /etc/rc.local");
}
if ($_GET['action'] == 'extension1') {
$outputtext = "extension1 set to image presenter";
system("sudo cp /var/www/sync/xsessionimage /home/pi/.xsession");
system("sudo cp /var/www/sync/rc.local.ext1 /etc/rc.local");
}
if ($_GET['action'] == 'usb') {
$outputtext = "usb mode set";
system("sudo cp /var/www/sync/rc.local.usb /etc/rc.local");
}
if ($_GET['action'] == 'setimage') {
$outputtext = "set to image player";
system("sudo cp /var/www/sync/rc.local.image /etc/rc.local");
}
if ($_GET['action'] == 'setimageusb') {
$outputtext = "image player usb mode set";
system("sudo cp /var/www/sync/rc.local.imageusb /etc/rc.local");
}
if ($_GET['action'] == 'setaudio') {
$outputtext = "autostart audio set";
system("sudo cp /var/www/sync/rc.local.audio /etc/rc.local");
}
if ($_GET['action'] == 'setaudiousb') {
$outputtext = "autostart audio usb set";
system("sudo cp /var/www/sync/rc.local.audiousb /etc/rc.local");
}
if ($_GET['action'] == 'screenshare') {
$outputtext = "set to screenshare mode";
system("sudo cp /var/www/sync/vncstartup /home/pi/.config/lxsession/LXDE/autostart");
system("sudo cp /var/www/sync/rc.local.screenshare /etc/rc.local");
}
if ($_GET['action'] == 'setmapper') {
$outputtext = "set to mapping mode";
system("sudo cp /var/www/sync/rc.local.mapper /etc/rc.local");
}
if ($_GET['action'] == 'setmapperremote') {
$outputtext = "set to mappingremote mode";
system("sudo cp /var/www/sync/rc.local.mapperremote /etc/rc.local");
}
if ($_GET['action'] == 'setmappercam') {
$outputtext = "set to mapping with cam";
system("sudo cp /var/www/sync/rc.local.mappercam /etc/rc.local");
}
if ($_GET['action'] == 'setqlc') {
$outputtext = "set to QLC+ DMX console";
system("sudo cp /var/www/sync/xsessionqlcplus /home/pi/.config/lxsession/LXDE/autostart");
system("sudo cp /var/www/sync/rc.local.qlcplus /etc/rc.local");
}
if ($_GET['action'] == 'setpd') {
$outputtext = "set to puredata";
system("sudo cp /var/www/sync/xsessionpd /home/pi/.config/lxsession/LXDE/autostart");
system("sudo cp /var/www/sync/rc.local.pd /etc/rc.local");
}
if ($_GET['action'] == 'powerpoint') {
$outputtext = "set to presentationmode";
system("sudo cp /var/www/sync/xsessionppt /home/pi/.config/lxsession/LXDE/autostart");
system("sudo cp /var/www/sync/rc.local.impress /etc/rc.local");
}
if ($_GET['action'] == 'setimagemanual') {
$outputtext = "set to manual imageplayer";
system("sudo cp /var/www/sync/rc.local.imagemanual /etc/rc.local");
}
if ($_GET['action'] == 'setpdf') {
$outputtext = "set to pdf";
system("sudo cp /var/www/sync/rc.local.pdf /etc/rc.local");
}
if ($_GET['action'] == 'setsyphon') {
$outputtext = "set to TCPSClient";
system("sudo cp /var/www/sync/rc.local.syphon /etc/rc.local");
}
if ($_GET['action'] == 'autostartclock') {
$outputtext = "set to autostart with clock display";
system("sudo cp /var/www/sync/rc.local.clock /etc/rc.local");
}
if ($_GET['action'] == 'custom1') {
$outputtext = "set autostart custom1";
system("sudo cp /var/www/sync/rc.local.custom /etc/rc.local");
}
if ($_GET['action'] == 'custom2') {
$outputtext = "set autostart custom2";
system("sudo cp /var/www/sync/rc.local.custom2 /etc/rc.local");
}
if ($_GET['action'] == 'custom') {
$outputtext = "set autostart custom1";
system("sudo cp /var/www/sync/rc.local.custom /etc/rc.local");
}
if ($_GET['action'] == 'setprocessing') {
$outputtext = "autostart processing";
system("sudo cp /var/www/sync/rc.local.processing /etc/rc.local");
}
if ($_GET['action'] == 'setsuperpikixpi') {
$outputtext = "autostart setsuperpikixpi http://pikilipita.com/ (Donate!)";
system("sudo cp /var/www/sync/rc.local.superpikixpi /etc/rc.local");
}
if ($_GET['action'] == 'setosc') {
$outputtext = "autostart to OSC receiver";
system("sudo cp /var/www/sync/rc.local.osc /etc/rc.local");
}
//# Display IP
if ($_GET['action'] == 'ipwifi') {
$output = shell_exec("sudo /sbin/ifconfig -a wlan0 | awk '/(cast)/ { print $2 }' | cut -d':' -f2 | head -1");
$preoutputtext = "<pre>$output</pre>";
$outputtext = wordwrap($preoutputtext, 40, "<br />\n");
}
if ($_GET['action'] == 'iplan') {
$output = shell_exec("sudo /sbin/ifconfig -a eth0 | awk '/(cast)/ { print $2 }' | cut -d':' -f2 | head -1");
$preoutputtext = "<pre>$output</pre>";
$outputtext = wordwrap($preoutputtext, 40, "<br />\n");
}
//# Set Boot.conf resolution
if ($_GET['action'] == 'bootconf') {
$outputtext = "custom boot conf to boot";
system("sudo cp /media/internal/config.txt /boot/config.txt");
}
if ($_GET['action'] == 'bootconfusb') {
$outputtext = "custom boot conf from usb to boot";
system("sudo cp /media/usb/config.txt /boot/config.txt");
}
if ($_GET['action'] == 'hdmireset') {
$outputtext = "reset resolution settings, needs reboot!";
system("sudo cp /var/www/sync/defaulthdmi /boot/config.txt");
}
if ($_GET['action'] == 'hdmi1') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/forcehdmi1 /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'DMT 16 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 1024 768 1024 768 32");
$outputtext = "forced to use 1024x768";
}
if ($_GET['action'] == 'hdmi4') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/forcehdmi4 /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'CEA 19 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 1280 720 1280 720 32");
$outputtext = "forced to use hdmi 1280x720";
}
if ($_GET['action'] == 'hdmi5') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/forcehdmi5 /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'CEA 31 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 1920 1080 1920 1080 32");
$outputtext = "forced to 1920x1080";
}
if ($_GET['action'] == 'hdmi6') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/forcehdmi6 /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'DMT 28 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 1280 800 1280 800 32");
$outputtext = "forced to 1280x800";
}
if ($_GET['action'] == 'forcevga') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/forcevga /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'DMT 9 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 800 600 800 600 32");
$outputtext = "force 800x600";
}
if ($_GET['action'] == 'force1680') {
system("sudo /var/www/sync/stopall > /dev/null 2>&1");
system("sudo cp /var/www/sync/force1680 /boot/config.txt");
system("sudo tvservice --off");
system("sudo tvservice -e 'DMT 58 DVI'");
system("sudo chvt 2");
system("sudo chvt 1");
system("sudo fbset -g 1680 1050 1680 1050 32");
$outputtext = "force 1680 x 1050 rgb";
}