-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwindow.py
More file actions
1506 lines (1214 loc) · 66.8 KB
/
mainwindow.py
File metadata and controls
1506 lines (1214 loc) · 66.8 KB
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
# -*- coding: utf-8 -*-
import copy
import pprint
import sys
import re
import datetime
from mainwindow_ui import *
from PySide2 import QtGui
from PySide2 import QtWidgets
from PySide2 import QtCore
from PySide2.QtWidgets import QFileDialog
from PySide2.QtCore import QFileInfo
from PySide2.QtGui import QTextCursor
from PySide2.QtGui import QIntValidator
from PySide2.QtCore import QRegularExpression
from WavChecker import WavChecker
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
'''
WAVCHECKER MainWindow
'''
__version__ = WavChecker.__version__
def __init__(self, app):
super(MainWindow, self).__init__()
self.msgbuf = ""
self.wavchecker = WavChecker(self, WavChecker.MASTER)
self.wavchecker.logger_init()
self.setupUi(self)
self.setWindowTitle("QTWavChecker v" + self.__version__)
self.__initEv()
self.timerid = 0
self.lasttimer = False
self.dot_count = 0
self.starttime = ""
# save default pallete
self.defaultpalette = self.plainTextEdit_log.palette()
self.comboBox_source.setCurrentIndex(1)
self.comboBox_source.setCurrentIndex(0)
self.source_audioformatdict = {} # ex:{'avg_frame_rate': '0/0','bit_rate': '2304000','bits_per_sample': '24'}
self.original_audioformatdict = {} # ex:↑
self.sourcevideoisdrop = False
self.isbsordel = False
self.numkeylist = [Qt.Key_0, Qt.Key_1, Qt.Key_2, Qt.Key_3, Qt.Key_4, Qt.Key_5, Qt.Key_6, Qt.Key_7, Qt.Key_8,
Qt.Key_9]
def __initEv(self):
self.setAcceptDrops(True)
self.wavchecker.SIG_BEGINTIMER.connect(self.beginTimer)
self.wavchecker.SIG_STOPTIMER.connect(self.stopTimer)
self.pushButton_sourceQT.clicked.connect(self.SourceOrgWavselected)
self.lineEdit_sourcefile.setAcceptDrops(True)
self.comboBox_source.currentIndexChanged.connect(self._Modeindexchanged)
self.pushButton_Start.clicked.connect(self._CheckStarted)
self.pushButton_AllReset.clicked.connect(self._AllReset)
# 2ch stereo(InterLeave mode)
self.pushButton_2ch.clicked.connect(self.SourceOrgWavselected)
# 5.1ch(Include 2ch multi mono(FL,FR))
self.pushButton_51ch_FR.clicked.connect(self.SourceOrgWavselected)
self.pushButton_51ch_FL.clicked.connect(self.SourceOrgWavselected)
self.pushButton_51ch_RR.clicked.connect(self.SourceOrgWavselected)
self.pushButton_51ch_RL.clicked.connect(self.SourceOrgWavselected)
self.pushButton_51ch_FC.clicked.connect(self.SourceOrgWavselected)
self.pushButton_51ch_LFE.clicked.connect(self.SourceOrgWavselected)
self.pushButton_8ch_R.clicked.connect(self.SourceOrgWavselected)
self.pushButton_8ch_L.clicked.connect(self.SourceOrgWavselected)
self.wavchecker.finished.connect(self.finishThread)
self.status_label = QtWidgets.QLabel()
self.status_label = QtWidgets.QLabel()
self.status_label.setAlignment(QtCore.Qt.AlignLeft)
self.statusBar().addWidget(self.status_label)
self.groupBox_videoinout.clicked.connect(self.__hide_videoinout)
self.lineEdit_videoin.textChanged.connect(self.__videoinout_changed)
self.lineEdit_videohonben.textChanged.connect(self.__videoinout_changed)
self.__hide_videoinout(self.groupBox_videoinout.isChecked())
self.groupBox_videoinout.setDisabled(True)
self.iv = QIntValidator(0, 2147483647, self.lineEdit_videoin)
self.lineEdit_videoin.setValidator(self.iv)
self.rx = QRegExp("^(((([0-1][0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9]$))|")
self.honbenv = QRegExpValidator(self.rx, self.lineEdit_videohonben)
self.lineEdit_videohonben.setValidator(self.honbenv)
self.textEdit_errlog.hide()
self.label_errlog.hide()
self.installEventFilter(self)
self.lineEdit_videohonben.installEventFilter(self)
# set default size(all object displays at 1920x1080)
self.resize(self.minimumSize())
return
def _Modeindexchanged(self, index):
if index == 0:
# Interleave mode
self.stackedWidget.setCurrentIndex(index)
self.groupBox_original.setMaximumHeight(150)
self.pushButton_sourceQT.setText("Source QT,MXF,wav")
self.lineEdit_sourcefile.setPlaceholderText("D&D QT or MXF or wav(Interleave/Interleave or Mono/Mono)")
self.pushButton_2ch.setText("Original QT,MXF,wav")
self.lineEdit_2ch.setPlaceholderText("D&D QT or MXF or wav(Interleave/Interleave or Mono/Mono)")
self.checkBox_cinex.setChecked(False)
self.checkBox_cinex.hide()
# V130
self.groupBox_original.show()
self.__show_selectstream()
# v131b
self.groupBox_audio.show()
self.checkBox_force16bit.show()
# v140
self.checkBox_videoswapsrcorg.setChecked(False)
self.checkBox_videoswapsrcorg.setEnabled(False)
self.resize(self.width(),820)
elif index == 1:
# source interleave org mono 6ch(5.1) mode.
self._setvisible_RLRRFLLFE(True)
self._setvisible_LR(False)
self.stackedWidget.setCurrentIndex(index)
self.groupBox_original.setMaximumHeight(450)
self.pushButton_sourceQT.setText("Source QT,MXF")
self.lineEdit_sourcefile.setPlaceholderText("D&D QT,MXF(Interleave only)")
self.checkBox_cinex.setChecked(False)
self.checkBox_cinex.hide()
# V130
self.groupBox_original.show()
self.__hide_selectstream()
# v131b
self.groupBox_audio.show()
self.checkBox_force16bit.show()
# v140
self.checkBox_videoswapsrcorg.setEnabled(True)
self.checkBox_videoswapsrcorg.setChecked(False)
self.resize(self.width(),1000)
elif index == 2:
# source interleave org mono 2ch mode.
self._setvisible_RLRRFLLFE(False)
self._setvisible_LR(False)
self.stackedWidget.setCurrentIndex(1)
self.groupBox_original.setMaximumHeight(250)
self.pushButton_sourceQT.setText("Source QT,MXF")
self.lineEdit_sourcefile.setPlaceholderText("D&D QT,MXF(Interleave only)")
self.checkBox_cinex.setChecked(False)
self.checkBox_cinex.hide()
# V130
self.groupBox_original.show()
self.__hide_selectstream()
# v131b
self.groupBox_audio.show()
self.checkBox_force16bit.show()
# v140
self.checkBox_videoswapsrcorg.setEnabled(True)
self.checkBox_videoswapsrcorg.setChecked(False)
self.resize(self.width(),820)
elif index == 3:
# source multimono org mono 2ch or 8ch(2ch+5.1ch) mode
self._setvisible_LR(True)
self._setvisible_RLRRFLLFE(True)
self.stackedWidget.setCurrentIndex(1)
self.groupBox_original.setMaximumHeight(650)
self.pushButton_sourceQT.setText("Source MXF")
self.lineEdit_sourcefile.setPlaceholderText("D&D MXF(Multi Mono only)")
self.checkBox_cinex.show()
# V130
self.groupBox_original.show()
self.__hide_selectstream()
# v131b
self.groupBox_audio.show()
self.checkBox_force16bit.show()
# v140
self.checkBox_videoswapsrcorg.setChecked(False)
self.checkBox_videoswapsrcorg.setEnabled(False)
self.resize(self.width(),1080)
elif index == 4:
# source multimono org Interleave mode.
self.stackedWidget.setCurrentIndex(0)
self.groupBox_original.setMaximumHeight(150)
self.pushButton_sourceQT.setText("Source QT,MXF")
self.lineEdit_sourcefile.setPlaceholderText("D&D MXF(Multi Mono only)")
self.pushButton_2ch.setText("Original wav")
self.lineEdit_2ch.setPlaceholderText("D&D original wav(2ch Interleave only)")
self.checkBox_cinex.show()
# V130
self.__hide_selectstream()
self.groupBox_original.show()
# v131b
self.groupBox_audio.show()
self.checkBox_force16bit.show()
# v140
self.checkBox_videoswapsrcorg.setChecked(False)
self.checkBox_videoswapsrcorg.setEnabled(False)
self.resize(self.width(),820)
# V130
elif index == 5:
# v141 muon check mode
self.original_audioformatdict.clear()
self.stackedWidget.setCurrentIndex(0)
self.groupBox_original.hide()
self.pushButton_sourceQT.setText("Source wav")
self.lineEdit_sourcefile.setPlaceholderText("D&D wav")
self.checkBox_cinex.setChecked(False)
self.checkBox_cinex.hide()
self.checkBox_force16bit.setChecked(False)
self.checkBox_force16bit.hide()
self.__hide_selectstream()
# v140
self.checkBox_videoswapsrcorg.setChecked(False)
self.checkBox_videoswapsrcorg.setEnabled(False)
self.resize(self.width(),520)
def _setvisible_RLRRFLLFE(self, isvisible):
# RL hide
self.label_RLINFO.setVisible(isvisible)
self.lineEdit_51ch_RL.setVisible(isvisible)
self.pushButton_51ch_RL.setVisible(isvisible)
# RR hide
self.label_RRINFO.setVisible(isvisible)
self.lineEdit_51ch_RR.setVisible(isvisible)
self.pushButton_51ch_RR.setVisible(isvisible)
# FC
self.label_FCINFO.setVisible(isvisible)
self.lineEdit_51ch_FC.setVisible(isvisible)
self.pushButton_51ch_FC.setVisible(isvisible)
# LFE
self.label_LFEINFO.setVisible(isvisible)
self.lineEdit_51ch_LFE.setVisible(isvisible)
self.pushButton_51ch_LFE.setVisible(isvisible)
def _setvisible_LR(self, isvisible):
# L hide
self.label_LINFO.setVisible(isvisible)
self.lineEdit_8ch_L.setVisible(isvisible)
self.pushButton_8ch_L.setVisible(isvisible)
# R hide
self.label_RINFO.setVisible(isvisible)
self.lineEdit_8ch_R.setVisible(isvisible)
self.pushButton_8ch_R.setVisible(isvisible)
def dragEnterEvent(self, event):
if event.mimeData().hasUrls():
event.accept()
else:
event.ignore()
def dropEvent(self, event):
urls = event.mimeData().urls()
pathlist = [] # multiple file D&D for 2ch multimono or 5.1ch multi mono mode
# InterLeave mode with multiple files.
if len(urls) > 1 and self.comboBox_source.currentIndex() == 0:
return
for url in urls:
path = url.path()
pathlist.append(path)
# src drop
if (self.lineEdit_sourcefile.rect().contains(self.lineEdit_sourcefile.mapFromGlobal(QtGui.QCursor.pos()))):
# V130
if (QFileInfo(path).suffix() == "wav"):
#V130 muon check tsuika
if self.comboBox_source.currentIndex() == 0 or self.comboBox_source.currentIndex() == 5:
self.lineEdit_sourcefile.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_sourcefile, self.label_sourceAudio, True)
else:
QMessageBox.critical(self, None,
"Sourcheへのwav入力はインタリーブ<ー>インタリーブモードと無音チェックのみ対応です!",
QMessageBox.Ok)
elif QFileInfo(path).suffix() == "mov" or QFileInfo(path).suffix() == "mxf":
self.lineEdit_sourcefile.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_sourcefile, self.label_sourceVideo, True)
else:
# self.textEdit_errlog.append("Interleave mode allow mov and wav, other mode only mov !!.")
QMessageBox.critical(self, None,
"未サポートの拡張子です\nサポート拡張子はmov,mxf,wavです\n増やしたかったらサワツにお願いしてね!",
QMessageBox.Ok)
# org drop
if QFileInfo(path).suffix() == "wav":
# Interleave
if self.comboBox_source.currentIndex() == 0 and \
self.lineEdit_2ch.rect().contains(self.lineEdit_2ch.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_2ch.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_2ch, self.label_2chINFO)
# 5.1ch
elif self.comboBox_source.currentIndex() == 1:
self._51ch_drop(pathlist)
# 2ch multi mono
elif self.comboBox_source.currentIndex() == 2:
self._51ch_drop(pathlist)
# 8ch oa mode
elif self.comboBox_source.currentIndex() == 3:
self._8ch_drop(pathlist)
elif self.comboBox_source.currentIndex() == 4 and \
self.lineEdit_2ch.rect().contains(self.lineEdit_2ch.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_2ch.setText(path)
self.SourceOrgWavselected(path,self.lineEdit_2ch, self.label_2chINFO)
else:
pass
if QFileInfo(path).suffix() == "mov" or QFileInfo(path).suffix() == "mxf":
if self.lineEdit_2ch.rect().contains(self.lineEdit_2ch.mapFromGlobal(QtGui.QCursor.pos())):
if self.comboBox_source.currentIndex() == 0:
self.lineEdit_2ch.setText(path)
self.SourceOrgWavselected(path,self.lineEdit_2ch,self.label_2chINFO)
def closeEvent(self, event):
# ffmpegの途中経過出力用にとっといたwavを削除
self.wavchecker.tempfile_del()
def _51ch_drop(self, pathlist):
# '.L' '.R' のようにProtoolsの5.1ch書き出しファイル名でまとめてD&D入力するとそれっぽく自動でアサインするよ
# Protools慣習に従ってるだけだよ。
if len(pathlist) == 6 or len(pathlist) == 2:
for path in pathlist:
if path.endswith('.R.wav'):
# 5.1ch Front Right
self.lineEdit_51ch_FR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FR, self.label_FRINFO)
elif path.endswith('.L.wav'):
# 5.1ch Front Left
self.lineEdit_51ch_FL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FL, self.label_FLINFO)
elif path.endswith('.Rs.wav'):
self.lineEdit_51ch_RR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RR, self.label_RRINFO)
elif path.endswith('.Ls.wav'):
self.lineEdit_51ch_RL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RL, self.label_RLINFO)
elif path.endswith('.C.wav'):
self.lineEdit_51ch_FC.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FC, self.label_FCINFO)
elif path.endswith('.LFE.wav'):
self.lineEdit_51ch_LFE.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_LFE, self.label_LFEINFO)
else:
path = pathlist[0]
# 5.1ch Front Right
if self.lineEdit_51ch_FR.rect().contains(self.lineEdit_51ch_FR.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FR, self.label_FRINFO)
# 5.1ch Front Left
elif self.lineEdit_51ch_FL.rect().contains(self.lineEdit_51ch_FL.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FL, self.label_FLINFO)
# 5.1ch Rear Right
elif self.lineEdit_51ch_RR.rect().contains(self.lineEdit_51ch_RR.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_RR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RR, self.label_RRINFO)
# 5.1ch Rear Left
elif self.lineEdit_51ch_RL.rect().contains(self.lineEdit_51ch_RL.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_RL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RL, self.label_RLINFO)
# 5.1ch Front Center
elif self.lineEdit_51ch_FC.rect().contains(self.lineEdit_51ch_FC.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FC.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FC, self.label_FCINFO)
# 5.1ch LFE
elif self.lineEdit_51ch_LFE.rect().contains(self.lineEdit_51ch_LFE.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_LFE.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_LFE, self.label_LFEINFO)
def _8ch_drop(self, pathlist):
# L,Rを同時に入れるなら、ファイル名でええ感じに取り込んでやろう
if len(pathlist) == 2: # L,R
for path in pathlist:
if path.endswith('.R.wav'):
# 8ch Right
self.lineEdit_8ch_R.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_R, self.label_RINFO)
elif path.endswith('.L.wav'):
# 5.1ch Front Left
self.lineEdit_8ch_L.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_L, self.label_LINFO)
# D&D with the Protools 5.1ch export file name like '.L' and '.R', it will be automatically assigned.
# Just following Protools conventions.
elif len(pathlist) == 8:
for path in pathlist:
if path.endswith('.R.wav'):
# 8ch Right
self.lineEdit_8ch_R.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_R, self.label_RINFO)
elif path.endswith('.L.wav'):
# 5.1ch Front Left
self.lineEdit_8ch_L.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_L, self.label_LINFO)
elif path.endswith('.Fr.wav'):
# 5.1ch Front Right
self.lineEdit_51ch_FR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FR, self.label_FRINFO)
elif path.endswith('.Fl.wav'):
# 5.1ch Front Left
self.lineEdit_51ch_FL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FL, self.label_FLINFO)
elif path.endswith('.Rs.wav'):
self.lineEdit_51ch_RR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RR, self.label_RRINFO)
elif path.endswith('.Ls.wav'):
self.lineEdit_51ch_RL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RL, self.label_RLINFO)
elif path.endswith('.C.wav'):
self.lineEdit_51ch_FC.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FC, self.label_FCINFO)
elif path.endswith('.LFE.wav'):
self.lineEdit_51ch_LFE.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_LFE, self.label_LFEINFO)
else:
path = pathlist[0]
# 8ch L
if self.lineEdit_8ch_L.rect().contains(self.lineEdit_8ch_L.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_8ch_L.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_L, self.label_LINFO)
# 8ch R
if self.lineEdit_8ch_R.rect().contains(self.lineEdit_8ch_R.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_8ch_R.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_8ch_R, self.label_RINFO)
# 5.1ch Front Right
if self.lineEdit_51ch_FR.rect().contains(self.lineEdit_51ch_FR.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FR, self.label_FRINFO)
# 5.1ch Front Left
elif self.lineEdit_51ch_FL.rect().contains(self.lineEdit_51ch_FL.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FL, self.label_FLINFO)
# 5.1ch Rear Right
elif self.lineEdit_51ch_RR.rect().contains(self.lineEdit_51ch_RR.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_RR.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RR, self.label_RRINFO)
# 5.1ch Rear Left
elif self.lineEdit_51ch_RL.rect().contains(self.lineEdit_51ch_RL.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_RL.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_RL, self.label_RLINFO)
# 5.1ch Front Center
elif self.lineEdit_51ch_FC.rect().contains(self.lineEdit_51ch_FC.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_FC.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_FC, self.label_FCINFO)
# 5.1ch LFE
elif self.lineEdit_51ch_LFE.rect().contains(self.lineEdit_51ch_LFE.mapFromGlobal(QtGui.QCursor.pos())):
self.lineEdit_51ch_LFE.setText(path)
self.SourceOrgWavselected(path, self.lineEdit_51ch_LFE, self.label_LFEINFO)
def _CheckStarted(self):
if WavChecker.ISRUNNING and WavChecker.REQ_CANCEL == False:
WavChecker.REQ_CANCEL = True
return
self.wavchecker.reset()
self.progressBar_ffmpeg.setValue(0)
self.progressBar_orgwav.setValue(0)
self.progressBar_srcwav.setValue(0)
self.plainTextEdit_log.setStyleSheet("QPlainTextEdit {background-color:#FFFFFF;}")
self.textEdit_errlog.clear()
self.textEdit_errlog.setStyleSheet("QTextEdit {background-color: #FFFFFF;color: #000000}")
self.label_errlog.hide()
self.textEdit_errlog.hide()
WavChecker.tempfile_init()
orgpathlist = []
# If pcm data is big endian, convert it to little endian.
# The reason is that ffmpeg does not support bigendian WAV output using the RIFX header.
# For Example. Baselight output QT is bigendian.
if self.source_audioformatdict.get("codec_name").endswith("be"):
wk_aformat = self.source_audioformatdict.get("codec_name")
result = wk_aformat[:-2] + "le" # pcm_s24be -> pcm_s24le
self.wavchecker.aformat = result
# V130 for muon check
elif len(self.original_audioformatdict) and self.original_audioformatdict.get("codec_name").endswith("be"):
wk_aformat = self.original_audioformatdict.get("codec_name")
result = wk_aformat[:-2] + "le"
self.wavchecker.aformat = result
else:
self.wavchecker.aformat = self.source_audioformatdict.get("codec_name")
# Head cut function enabled?
if self.groupBox_videoinout.isEnabled() and self.groupBox_videoinout.isChecked():
if self.lineEdit_videoin.text():
if self.sourceisthousand:
# 23.98,29.97 has extra sound, so calculate the offset number of seconds.
# ---head 5sec------- --------honben------ ---tail 5sec-------
# <5sec> + <0.005sec> + <15sec> + <0.015sec> + <5sec> + <0.005>sec
# When specifying the position on the ffmpeg side, based on the above,
# you must add 1/1000th of a second to the head time and honben.
head_float = float(self.lineEdit_videoin.text())
head_float = head_float + head_float / 1000 # ex:120 -> 120.12, 5 -> 5.005
self.wavchecker.opdict[self.wavchecker.OPDICT_VIDEOHEADSKIPSEC] = str(head_float)
else:
# no adjust
self.wavchecker.opdict[self.wavchecker.OPDICT_VIDEOHEADSKIPSEC] = self.lineEdit_videoin.text()
if self.lineEdit_videohonben.text():
# If hh:mm:ss format, convert to total seconds, otherwise use as is
hmslist = self.lineEdit_videohonben.text().split(":")
if len(hmslist) == 1:
# sec only input
honben_float = float(hmslist[0])
elif len(hmslist) == 3:
# hh:mm:ss input
td = datetime.timedelta(hours=int(hmslist[0]), minutes=int(hmslist[1]), seconds=int(hmslist[2]))
honben_float = float(td.seconds)
else:
QMessageBox.critical(self, None,
"honbenの入力数値の形式が正しくありません!hh:mm:ssで入力してください!",
QMessageBox.Ok)
return
if self.sourceisthousand:
honben_float = honben_float + honben_float / 1000
self.wavchecker.opdict[self.wavchecker.OPDICT_VIDEOHONBENSEC] = str(honben_float)
# v140
if self.checkBox_videoswapsrcorg.isChecked():
self.wavchecker.opdict[self.wavchecker.OPDICT_VIDEOSRCORGSWAP] = True
if self.checkBox_force16bit.isChecked():
self.wavchecker.opdict[self.wavchecker.OPDICT_SOURCEWAVFORCE16BIT] = True
# v113
else:
self.wavchecker.opdict[self.wavchecker.OPDICT_SOURCEWAVFORCE16BIT] = False
if self.checkBox_cinex.isChecked():
self.wavchecker.opdict[self.wavchecker.OPDICT_CINEXCHECK] = True
# v113
else:
self.wavchecker.opdict[self.wavchecker.OPDICT_CINEXCHECK] = False
# Interleave <-> Interleave
if self.comboBox_source.currentIndex() == 0:
if QFileInfo(self.lineEdit_sourcefile.text()).exists() \
and QFileInfo(self.lineEdit_2ch.text()).exists():
# v130
if self.comboBox_sourcechannel.isVisible() and self.comboBox_sourcechannel.count() > 1:
self.wavchecker.opdict[self.wavchecker.OPDICT_SELECTINDEX] = self.comboBox_sourcechannel.currentIndex()
# src one index select in multi index(over write predict size).
self.wavchecker.opdict[self.wavchecker.OPDICT_SRCWAVFILESIZE] = self.wavchecker.opdict[self.wavchecker.OPDICT_ORGWAVFILESIZE]
self.wavchecker.mode = self.wavchecker.MODE_INTERLEAVE
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
orgpathlist.append(self.lineEdit_2ch.text())
WavChecker.ORGPATHS = orgpathlist.copy()
self.wavchecker.start()
# self.pushButton_Start.setEnabled(False)
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
# start checking?
else:
QMessageBox.critical(self, None,
"ソースのパスまたはオリジナルのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
# 5.1ch
elif self.comboBox_source.currentIndex() == 1:
if QFileInfo(self.lineEdit_sourcefile.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FL.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FR.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FC.text()).exists() \
and QFileInfo(self.lineEdit_51ch_LFE.text()).exists() \
and QFileInfo(self.lineEdit_51ch_RL.text()).exists() \
and QFileInfo(self.lineEdit_51ch_RR.text()).exists():
self.wavchecker.mode = self.wavchecker.MODE_51CH
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
self.wavchecker.aformat = self.source_audioformatdict.get("codec_name")
orgpathlist.append(self.lineEdit_51ch_FL.text())
orgpathlist.append(self.lineEdit_51ch_FR.text())
orgpathlist.append(self.lineEdit_51ch_FC.text())
orgpathlist.append(self.lineEdit_51ch_LFE.text())
orgpathlist.append(self.lineEdit_51ch_RL.text())
orgpathlist.append(self.lineEdit_51ch_RR.text())
WavChecker.ORGPATHS = orgpathlist.copy()
self.wavchecker.start()
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
else:
QMessageBox.critical(self, None,
"ソースのパスまたはオリジナルのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
# 2ch (multi mono)
elif self.comboBox_source.currentIndex() == 2:
if QFileInfo(self.lineEdit_sourcefile.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FL.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FR.text()).exists():
self.wavchecker.mode = self.wavchecker.MODE_2CH
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
self.wavchecker.aformat = self.source_audioformatdict.get("codec_name")
orgpathlist.append(self.lineEdit_51ch_FL.text())
orgpathlist.append(self.lineEdit_51ch_FR.text())
WavChecker.ORGPATHS = orgpathlist.copy()
self.wavchecker.start()
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
else:
QMessageBox.critical(self, None,
"ソースのパスまたはオリジナルのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
# 8ch (MXF OA mode)
elif self.comboBox_source.currentIndex() == 3:
# 2ch exists check
if QFileInfo(self.lineEdit_sourcefile.text()).exists() \
and QFileInfo(self.lineEdit_8ch_L.text()).exists() \
and QFileInfo(self.lineEdit_8ch_R.text()).exists():
self.wavchecker.mode = self.wavchecker.MODE_8CH_OA
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
self.wavchecker.aformat = self.source_audioformatdict.get("codec_name")
orgpathlist.append(self.lineEdit_8ch_L.text())
orgpathlist.append(self.lineEdit_8ch_R.text())
# +6ch exists ?
if QFileInfo(self.lineEdit_51ch_FL.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FR.text()).exists() \
and QFileInfo(self.lineEdit_51ch_FC.text()).exists() \
and QFileInfo(self.lineEdit_51ch_LFE.text()).exists() \
and QFileInfo(self.lineEdit_51ch_RL.text()).exists() \
and QFileInfo(self.lineEdit_51ch_RR.text()).exists():
# add 6ch paths
orgpathlist.append(self.lineEdit_51ch_FL.text())
orgpathlist.append(self.lineEdit_51ch_FR.text())
orgpathlist.append(self.lineEdit_51ch_FC.text())
orgpathlist.append(self.lineEdit_51ch_LFE.text())
orgpathlist.append(self.lineEdit_51ch_RL.text())
orgpathlist.append(self.lineEdit_51ch_RR.text())
WavChecker.ORGPATHS = orgpathlist.copy()
self.wavchecker.start()
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
else:
QMessageBox.critical(self, None,
"ソースのパスまたはオリジナルのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
elif self.comboBox_source.currentIndex() == 4:
if QFileInfo(self.lineEdit_sourcefile.text()).exists() \
and QFileInfo(self.lineEdit_2ch.text()).exists():
self.wavchecker.mode = self.wavchecker.MODE_MULTIMONO_INTERLEAVE_DANIEL
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
orgpathlist.append(self.lineEdit_2ch.text())
WavChecker.ORGPATHS = orgpathlist.copy()
self.wavchecker.start()
# self.pushButton_Start.setEnabled(False)
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
# start checking?
else:
QMessageBox.critical(self, None,
"ソースのパスまたはオリジナルのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
# V130
elif self.comboBox_source.currentIndex() == 5:
if QFileInfo(self.lineEdit_sourcefile.text()).exists():
self.wavchecker.mode = self.wavchecker.MODE_MUON_CHECK
WavChecker.SRCPATHS.append(self.lineEdit_sourcefile.text())
WavChecker.ORGPATHS = []
self.wavchecker.start()
self.pushButton_Start.setText("「Cancel..」")
self.pushButton_AllReset.setEnabled(False)
else:
QMessageBox.critical(self, None,
"ソースのパスが間違っています!\n正しく設定してください!",
QMessageBox.Ok)
else:
QMessageBox.critical(self, None,
"_CheckStartedのモードが存在しない内部矛盾だよ!サワツに連絡してね!",
QMessageBox.Ok)
def _AllReset(self):
self.lineEdit_sourcefile.clear()
self.label_sourceVideo.setText("..")
self.label_sourceAudio.setText("..")
# v141
self.comboBox_sourcechannel.clear()
self.comboBox_sourcechannel.hide()
# 2ch
self.lineEdit_2ch.clear()
self.label_2chINFO.setText("..")
# 5.1ch
self.lineEdit_51ch_FL.clear()
self.label_FLINFO.setText("..")
self.lineEdit_51ch_FR.clear()
self.label_FRINFO.setText("..")
self.lineEdit_51ch_RL.clear()
self.label_RLINFO.setText("..")
self.lineEdit_51ch_RR.clear()
self.label_RRINFO.setText("..")
self.lineEdit_51ch_FC.clear()
self.label_FCINFO.setText("..")
self.lineEdit_51ch_LFE.clear()
self.label_LFEINFO.setText("..")
# 8ch
self.lineEdit_8ch_L.clear()
self.label_LINFO.setText("..")
self.lineEdit_8ch_R.clear()
self.label_RINFO.setText("..")
# progress
self.progressBar_ffmpeg.setValue(0)
self.progressBar_orgwav.setValue(0)
self.progressBar_srcwav.setValue(0)
# log
self.plainTextEdit_log.clear()
self.plainTextEdit_log.setStyleSheet("QPlainTextEdit {background-color:#FFFFFF;}")
self.textEdit_errlog.clear()
self.textEdit_errlog.setStyleSheet("QTextEdit {background-color: #FFFFFF;color: #000000}")
self.label_errlog.hide()
self.textEdit_errlog.hide()
self.source_audioformatdict.clear()
self.original_audioformatdict.clear()
self.lineEdit_videoin.clear()
self.lineEdit_videohonben.clear()
self.groupBox_videoinout.setChecked(False)
self.groupBox_videoinout.setDisabled(True)
self.checkBox_force16bit.setChecked(False)
# v113
self.checkBox_cinex.setChecked(False)
self.wavchecker.opdict.clear()
self.sourcevideoisdrop = None
self.__hide_videoinout(False)
def finishThread(self):
self.__setprogress()
self.progressBar_ffmpeg.setValue(self.progressBar_ffmpeg.maximum())
self.progressBar_srcwav.setValue(self.progressBar_srcwav.maximum())
self.progressBar_orgwav.setValue(self.progressBar_orgwav.maximum())
self.__wavchecker_msgread()
if WavChecker.CHECKEDSTATUS == 0:
self.textEdit_errlog.setStyleSheet("QTextEdit {background-color: #FF0000;color: #FFFFFF}")
self.plainTextEdit_log.setStyleSheet("QPlainTextEdit {background-color: #90ee90;}")
elif WavChecker.CHECKEDSTATUS == 1:
# Warn
self.textEdit_errlog.setStyleSheet("QTextEdit {background-color: #FFFF00;color: #000000}")
self.label_errlog.show()
self.textEdit_errlog.show()
else:
# Error
self.textEdit_errlog.setStyleSheet("QTextEdit {background-color: #FF0000;color: #FFFFFF}")
self.label_errlog.show()
self.textEdit_errlog.show()
self.status_label.setText(WavChecker.STATUSMESSAGE)
self.pushButton_Start.setText("「Start Check」")
self.pushButton_AllReset.setEnabled(True)
def timerEvent(self, tevent):
if (tevent.timerId() == self.timerid):
# If Thread keeps crashing in debug, it's a good idea to comment out __setprogress.
self.__setprogress()
self.__wavchecker_msgread()
dotstr = ""
for i in range(self.dot_count):
# print(i)
dotstr += "."
self.status_label.setText(WavChecker.STATUSMESSAGE + dotstr)
self.dot_count += 1
if (self.dot_count == 4):
self.dot_count = 0
def __wavchecker_msgread(self):
if (WavChecker.msgtrylock(self)):
msg = WavChecker.msgread(self)
if msg:
self.plainTextEdit_log.moveCursor(QTextCursor.End)
self.plainTextEdit_log.insertPlainText(msg)
self.plainTextEdit_log.moveCursor(QTextCursor.End)
WavChecker.msgclear(self)
errmsg = WavChecker.msgread_error(self)
if errmsg:
self.textEdit_errlog.append(errmsg)
WavChecker.msgclear_error(self)
WavChecker.msgunlock(self)
def __getbit_str(self, strdata):
if strdata:
bits_str = re.findall('pcm_[sf][1-9]+le', strdata)
if bits_str:
return bits_str[0]
else:
return None
return
def __setprogress(self):
# If it is less than INT_MAX -2, treat it as is, but if it exceeds INT_MAX,
# keep it within the INT_MAX range for progressBar settings.
try:
if WavChecker.PROGRESS_MAX_ORGWAV and WavChecker.PROGRESS_ORGWAV:
if WavChecker.PROGRESS_MAX_ORGWAV < 2147483645:
self.progressBar_orgwav.setMaximum(WavChecker.PROGRESS_MAX_ORGWAV)
self.progressBar_orgwav.setValue(WavChecker.PROGRESS_ORGWAV)
else:
self.progressBar_orgwav.setMaximum(int(WavChecker.PROGRESS_MAX_ORGWAV / 1000))
self.progressBar_orgwav.setValue(int(WavChecker.PROGRESS_ORGWAV / 1000))
except OverflowError as e:
self.progressBar_orgwav.setMaximum(int(WavChecker.PROGRESS_MAX_ORGWAV / 1000))
self.progressBar_orgwav.setValue(int(WavChecker.PROGRESS_ORGWAV / 1000))
# Measures to prevent the bar from fluctuating when setValue and tMaximum are set to 0,0 for progressBar
# Set only when non-zero
# print("WavChecker.PROGRESS_MAX_FFMPEG" + str(WavChecker.PROGRESS_MAX_FFMPEG))
# print("PROGRESS_FFMPEG_SRC" + str(WavChecker.PROGRESS_FFMPEG_SRC))
# print("PROGRESS_FFMPEG_ORG" + str(WavChecker.PROGRESS_FFMPEG_ORG))
try:
if WavChecker.PROGRESS_FFMPEG_SRC + WavChecker.PROGRESS_FFMPEG_ORG < 2147483645:
self.progressBar_ffmpeg.setMaximum(WavChecker.PROGRESS_MAX_FFMPEG)
self.progressBar_ffmpeg.setValue(WavChecker.PROGRESS_FFMPEG_SRC + WavChecker.PROGRESS_FFMPEG_ORG)
else:
self.progressBar_ffmpeg.setMaximum(WavChecker.PROGRESS_MAX_FFMPEG / 1000)
self.progressBar_ffmpeg.setValue((WavChecker.PROGRESS_FFMPEG_SRC / 1000) + (WavChecker.PROGRESS_FFMPEG_ORG / 1000))
# debug
# print("PROGRESS_MAX_FFMPEG:{0} PROGRESS_FFMPEG_SRC:{1} PROGRESS_FFMPEG_ORG{2}".format(
# WavChecker.PROGRESS_MAX_FFMPEG,
# WavChecker.PROGRESS_FFMPEG_SRC,
# WavChecker.PROGRESS_FFMPEG_ORG
# ))
except OverflowError as e:
self.progressBar_ffmpeg.setMaximum(WavChecker.PROGRESS_MAX_FFMPEG / 1000)
self.progressBar_ffmpeg.setValue((WavChecker.PROGRESS_FFMPEG_SRC / 1000) + (WavChecker.PROGRESS_FFMPEG_ORG / 1000))
try:
if WavChecker.PROGRESS_MAX_SRCWAV and WavChecker.PROGRESS_SRCWAV:
if WavChecker.PROGRESS_MAX_SRCWAV < 2147483645:
self.progressBar_srcwav.setMaximum(WavChecker.PROGRESS_MAX_SRCWAV)
self.progressBar_srcwav.setValue(WavChecker.PROGRESS_SRCWAV)
else:
self.progressBar_srcwav.setMaximum(int(WavChecker.PROGRESS_MAX_SRCWAV / 1000))
self.progressBar_srcwav.setValue(int(WavChecker.PROGRESS_SRCWAV / 1000))
except OverflowError as e:
self.progressBar_srcwav.setMaximum(int(WavChecker.PROGRESS_MAX_SRCWAV / 1000))
self.progressBar_srcwav.setValue(int(WavChecker.PROGRESS_SRCWAV / 1000))
@QtCore.Slot()
def beginTimer(self, last=False):
self.timerid = QObject.startTimer(self, 2000)
self.lasttimer = last
@QtCore.Slot()
def stopTimer(self):
QObject.killTimer(self, self.timerid)
def SourceOrgWavselected(self, filePath=None, lineedit=None, label=None, issource = False):
# print("SourceOrgWavselected called")
sender = self.sender()
hasvideo = False
fpsstr = None
tcstr = None
if sender == self.pushButton_sourceQT:
lineedit = self.lineEdit_sourcefile