69 lines
3.2 KiB
Python
69 lines
3.2 KiB
Python
|
|
import sys
|
||
|
|
|
||
|
|
path = '/opt/wild-dragon/services/web-ui/public/screens-ingest.jsx'
|
||
|
|
src = open(path).read()
|
||
|
|
|
||
|
|
patches = [
|
||
|
|
# 1. growingCodec state initialiser — seed all 4 values
|
||
|
|
(
|
||
|
|
""" const [growingCodec, setGrowingCodec] = React.useState(recorder.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100');""",
|
||
|
|
""" const _validGC = new Set(['avci50','avci100','avci200','hevc_nvenc']);
|
||
|
|
const [growingCodec, setGrowingCodec] = React.useState(_validGC.has(recorder.growing_codec) ? recorder.growing_codec : 'avci100');""",
|
||
|
|
'growingCodec state seed',
|
||
|
|
),
|
||
|
|
# 2. <select> options — add avci50 and avci200
|
||
|
|
(
|
||
|
|
""" <option value="avci100">AVC-Intra 100 (CPU, MXF · Premiere-native)</option>
|
||
|
|
<option value="hevc_nvenc">HEVC all-intra (GPU/NVENC, frag-MOV)</option>""",
|
||
|
|
""" <option value="avci50">AVC-Intra 50 (CPU, MXF · ~100 Mbps @ 59.94)</option>
|
||
|
|
<option value="avci100">AVC-Intra 100 (CPU, MXF · ~200 Mbps @ 59.94)</option>
|
||
|
|
<option value="avci200">AVC-Intra 200 (CPU, MXF · ~400 Mbps @ 59.94)</option>
|
||
|
|
<option value="hevc_nvenc">HEVC all-intra (GPU/NVENC, frag-MOV · experimental)</option>""",
|
||
|
|
'<select> options',
|
||
|
|
),
|
||
|
|
# 3. Hint text below the select
|
||
|
|
(
|
||
|
|
""" {growingCodec === 'hevc_nvenc'
|
||
|
|
? 'GPU-offloaded HEVC 10-bit 4:2:0 in fragmented MOV. Frees CPU. NOTE: not all editors import frag-MOV growing files.'
|
||
|
|
: 'CPU AVC-Intra 100, 4:2:2 10-bit, true 1080p59.94 in MXF OP1a. Premiere-native growing.'}""",
|
||
|
|
""" {growingCodec === 'hevc_nvenc'
|
||
|
|
? 'GPU-offloaded HEVC 10-bit 4:2:0 in fragmented MOV. NOTE: Premiere does not import frag-MOV growing files.'
|
||
|
|
: growingCodec === 'avci50'
|
||
|
|
? 'AVC-Intra Class 50 — ~100 Mbps @ 1080p59.94. Lowest storage, broadcast-grade 4:2:2 10-bit. Premiere-native.'
|
||
|
|
: growingCodec === 'avci200'
|
||
|
|
? 'AVC-Intra Class 200 — ~400 Mbps @ 1080p59.94. Highest quality, 4:2:2 10-bit. Premiere-native.'
|
||
|
|
: 'AVC-Intra Class 100 — ~200 Mbps @ 1080p59.94. Balanced quality and storage. Premiere-native.'}""",
|
||
|
|
'hint text',
|
||
|
|
),
|
||
|
|
# 4. _normRecorder growingCodec — expand to 4-way
|
||
|
|
(
|
||
|
|
" growingCodec: r.growing_codec === 'hevc_nvenc' ? 'hevc_nvenc' : 'avci100',",
|
||
|
|
""" growingCodec: (['avci50','avci100','avci200','hevc_nvenc'].includes(r.growing_codec) ? r.growing_codec : 'avci100'),""",
|
||
|
|
'_normRecorder growingCodec',
|
||
|
|
),
|
||
|
|
# 5. GROWING badge label — show avci class
|
||
|
|
(
|
||
|
|
""" GROWING · {recorder.growingCodec === 'hevc_nvenc' ? 'GPU/HEVC' : 'CPU/AVCI'}""",
|
||
|
|
""" GROWING · {recorder.growingCodec === 'hevc_nvenc' ? 'GPU/HEVC'
|
||
|
|
: recorder.growingCodec === 'avci50' ? 'CPU/AVCI-50'
|
||
|
|
: recorder.growingCodec === 'avci200' ? 'CPU/AVCI-200'
|
||
|
|
: 'CPU/AVCI-100'}""",
|
||
|
|
'GROWING badge label',
|
||
|
|
),
|
||
|
|
]
|
||
|
|
|
||
|
|
ok = True
|
||
|
|
for old, new, label in patches:
|
||
|
|
if old in src:
|
||
|
|
src = src.replace(old, new, 1)
|
||
|
|
print(f'OK {label}')
|
||
|
|
else:
|
||
|
|
print(f'FAIL {label}')
|
||
|
|
ok = False
|
||
|
|
|
||
|
|
if ok:
|
||
|
|
open(path, 'w').write(src)
|
||
|
|
print('screens-ingest.jsx written OK')
|
||
|
|
else:
|
||
|
|
sys.exit(1)
|