27 lines
2.1 KiB
JavaScript
27 lines
2.1 KiB
JavaScript
|
|
// Read-only captures of a live playout channel. NEVER click transport/Channel off/Convert/Add.
|
||
|
|
const { chromium } = require('playwright');
|
||
|
|
const OUT='/home/zgaetano/media-command-guide/screenshots';
|
||
|
|
const COOKIE='REDACTED';
|
||
|
|
const SAFE=/^(Overview|Schedule prep|As-Run|Live inputs.*|Clips.*|Breaks.*|GamesTV)$/;
|
||
|
|
(async()=>{
|
||
|
|
const b=await chromium.launch({args:['--no-sandbox','--autoplay-policy=no-user-gesture-required']});
|
||
|
|
const c=await b.newContext({viewport:{width:1920,height:1080}});
|
||
|
|
await c.addCookies([{name:'dragonflight.sid',value:COOKIE,domain:'mediacmdr.com',path:'/',httpOnly:true,secure:true}]);
|
||
|
|
const p=await c.newPage();
|
||
|
|
const txt=async()=>(await p.evaluate(()=>document.body.innerText.replace(/\b\d\d:\d\d\b \| /g,'').replace(/\n+/g,' | '))).slice(0,1800);
|
||
|
|
const tab=async(label)=>{ if(!SAFE.test(label)) throw new Error('unsafe '+label);
|
||
|
|
const btn=p.locator('button',{hasText:label}).first(); await btn.click(); await p.waitForTimeout(5000);};
|
||
|
|
const home=async()=>{await p.goto('https://mediacmdr.com/#home',{waitUntil:'networkidle'});await p.goto('https://mediacmdr.com/#playout',{waitUntil:'networkidle'});await p.waitForTimeout(9000);};
|
||
|
|
await home();
|
||
|
|
await p.screenshot({path:`${OUT}/16-ops-playout.png`});
|
||
|
|
await p.screenshot({path:`${OUT}/16a-playout-full.png`,fullPage:true});
|
||
|
|
console.log('MAIN',await txt());
|
||
|
|
for (const [l,f] of [['Live inputs','16b-playout-live-inputs'],['Breaks','16c-playout-breaks']]) {
|
||
|
|
await tab(l); await p.screenshot({path:`${OUT}/${f}.png`}); }
|
||
|
|
for (const [l,f] of [['As-Run','16e-playout-asrun'],['Overview','16d-playout-overview'],['Schedule prep','16f-playout-schedule-prep']]) {
|
||
|
|
await home(); await tab(l); await p.screenshot({path:`${OUT}/${f}.png`}); console.log('==',l,p.url(),await txt()); await p.keyboard.press('Escape'); }
|
||
|
|
for (const [h,f] of [['monitor-wall','08-live-monitor-wall'],['home','02-dashboard-home']]) {
|
||
|
|
await p.goto('https://mediacmdr.com/#'+h,{waitUntil:'networkidle'});await p.waitForTimeout(10000);
|
||
|
|
await p.screenshot({path:`${OUT}/${f}.png`}); console.log('==',h,(await txt()).slice(0,800)); }
|
||
|
|
await b.close();})();
|