128 lines
6.2 KiB
JavaScript
128 lines
6.2 KiB
JavaScript
|
|
const { chromium } = require('playwright');
|
||
|
|
const fs = require('fs');
|
||
|
|
const OUT = '/home/zgaetano/media-command-guide/screenshots';
|
||
|
|
const BMG = '5ebf74aa-f5b4-4a83-b089-c9af2cb25d1f';
|
||
|
|
const COOKIE = 'REDACTED';
|
||
|
|
const pause = p => p.evaluate(() => document.querySelectorAll('video').forEach(v => { try { v.pause() } catch(e){} }));
|
||
|
|
|
||
|
|
(async () => {
|
||
|
|
const b = await chromium.launch({ headless: true, 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();
|
||
|
|
|
||
|
|
// Helper: dump visible text of menus, buttons, dropdowns
|
||
|
|
const dumpUI = () => p.evaluate(() => {
|
||
|
|
const els = [...document.querySelectorAll('button, select, [role=menu], [role=menuitem], [class*=dropdown], [class*=menu], [class*=sub], .nav-item, [class*=tab]')]
|
||
|
|
.filter(e => e.offsetHeight > 0 && e.innerText.trim())
|
||
|
|
.map(e => ({ tag: e.tagName, cls: e.className.slice(0,60), text: e.innerText.trim().slice(0,80) }));
|
||
|
|
return els;
|
||
|
|
});
|
||
|
|
|
||
|
|
// 1. SCHEDULE — explore sub-menus
|
||
|
|
await p.goto('https://mediacmdr.com/#schedule', { waitUntil: 'networkidle' });
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
console.log('=== SCHEDULE ===');
|
||
|
|
const schedUI = await dumpUI();
|
||
|
|
schedUI.forEach(e => console.log(` [${e.tag}] ${e.cls.slice(0,40)} :: ${e.text}`));
|
||
|
|
// Screenshot the main schedule
|
||
|
|
await p.screenshot({ path: `${OUT}/06-live-schedule.png` });
|
||
|
|
// Look for buttons like "Record now", "New schedule", view toggles
|
||
|
|
const schedButtons = await p.evaluate(() => [...document.querySelectorAll('button')]
|
||
|
|
.filter(e => e.offsetHeight > 0).map(e => e.innerText.trim()).filter(Boolean));
|
||
|
|
console.log('Schedule buttons:', schedButtons);
|
||
|
|
|
||
|
|
// Try clicking "New schedule" or similar
|
||
|
|
const clicked = await p.evaluate(() => {
|
||
|
|
const btn = [...document.querySelectorAll('button')].find(b => /new schedule/i.test(b.innerText));
|
||
|
|
if (btn) { btn.click(); return btn.innerText.trim(); }
|
||
|
|
return null;
|
||
|
|
});
|
||
|
|
console.log('Clicked:', clicked);
|
||
|
|
await p.waitForTimeout(2500);
|
||
|
|
await p.screenshot({ path: `${OUT}/06b-schedule-new-event.png` });
|
||
|
|
// Close any modal
|
||
|
|
await p.evaluate(() => { const c = document.querySelector('[class*=modal] button[class*=close], [class*=dialog] button'); if(c) c.click(); });
|
||
|
|
await p.waitForTimeout(1000);
|
||
|
|
|
||
|
|
// Try view toggles (Day/Week/List)
|
||
|
|
for (const label of ['Week', 'List']) {
|
||
|
|
const ok = await p.evaluate(l => {
|
||
|
|
const b = [...document.querySelectorAll('button')].find(b => b.innerText.trim() === l);
|
||
|
|
if (b) { b.click(); return true; } return false;
|
||
|
|
}, label);
|
||
|
|
if (ok) {
|
||
|
|
await p.waitForTimeout(2000);
|
||
|
|
await p.screenshot({ path: `${OUT}/06c-schedule-${label.toLowerCase()}.png` });
|
||
|
|
console.log('Schedule view:', label);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 2. RECORDERS — sub-menus and previews
|
||
|
|
await p.goto('https://mediacmdr.com/#recorders', { waitUntil: 'networkidle' });
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
console.log('\n=== RECORDERS ===');
|
||
|
|
const recUI = await dumpUI();
|
||
|
|
recUI.forEach(e => console.log(` [${e.tag}] ${e.cls.slice(0,40)} :: ${e.text}`));
|
||
|
|
await p.screenshot({ path: `${OUT}/05-live-recorders.png` });
|
||
|
|
// Click on a recorder card with SIGNAL to see preview/details
|
||
|
|
const recCard = await p.evaluate(() => {
|
||
|
|
const cards = [...document.querySelectorAll('[class*=card],[class*=port],[class*=recorder]')]
|
||
|
|
.filter(e => e.offsetHeight > 40 && /SIGNAL/i.test(e.innerText));
|
||
|
|
if (cards.length) { cards[0].click(); return cards[0].innerText.replace(/\s+/g,' ').slice(0,80); }
|
||
|
|
return null;
|
||
|
|
});
|
||
|
|
console.log('Recorder card clicked:', recCard);
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
await pause(p);
|
||
|
|
await p.screenshot({ path: `${OUT}/05b-recorder-detail.png` });
|
||
|
|
// Check for sub-menus (codec dropdown, actions)
|
||
|
|
const recDetail = await p.evaluate(() => {
|
||
|
|
const btns = [...document.querySelectorAll('button, select')].filter(e => e.offsetHeight > 0)
|
||
|
|
.map(e => e.innerText.trim() || e.value).filter(Boolean);
|
||
|
|
return btns;
|
||
|
|
});
|
||
|
|
console.log('Recorder detail buttons:', recDetail);
|
||
|
|
|
||
|
|
// 3. AI ANALYSIS page
|
||
|
|
await p.goto('https://mediacmdr.com/#analysis', { waitUntil: 'networkidle' });
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
console.log('\n=== ANALYSIS ===');
|
||
|
|
const analysisText = await p.evaluate(() => (document.querySelector('main') || document.body).innerText.replace(/\n{2,}/g,'\n').slice(0,1500));
|
||
|
|
console.log(analysisText);
|
||
|
|
await p.screenshot({ path: `${OUT}/40-ai-analysis.png` });
|
||
|
|
// Check for sub-sections
|
||
|
|
const analysisTabs = await p.evaluate(() => [...document.querySelectorAll('button,[role=tab]')]
|
||
|
|
.filter(e => e.offsetHeight > 0).map(e => e.innerText.trim()).filter(Boolean));
|
||
|
|
console.log('Analysis tabs:', analysisTabs);
|
||
|
|
|
||
|
|
// 4. REFRAME page
|
||
|
|
await p.goto('https://mediacmdr.com/reframe.html', { waitUntil: 'networkidle' }).catch(() => {});
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
console.log('\n=== REFRAME ===');
|
||
|
|
const reframeText = await p.evaluate(() => document.body.innerText.replace(/\n{2,}/g,'\n').slice(0,1500));
|
||
|
|
console.log(reframeText);
|
||
|
|
await p.screenshot({ path: `${OUT}/41-reframe.png` });
|
||
|
|
|
||
|
|
// 5. CONTRIBUTION page — what does it actually show?
|
||
|
|
await p.goto(`https://mediacmdr.com/#contribution`, { waitUntil: 'networkidle' });
|
||
|
|
await p.waitForTimeout(4000);
|
||
|
|
console.log('\n=== CONTRIBUTION ===');
|
||
|
|
const contribText = await p.evaluate(() => (document.querySelector('main') || document.body).innerText.replace(/\n{2,}/g,'\n').slice(0,2000));
|
||
|
|
console.log(contribText);
|
||
|
|
await p.screenshot({ path: `${OUT}/11-media-contribution.png` });
|
||
|
|
const contribButtons = await p.evaluate(() => [...document.querySelectorAll('button, a')]
|
||
|
|
.filter(e => e.offsetHeight > 0).map(e => e.innerText.trim()).filter(Boolean));
|
||
|
|
console.log('Contribution buttons:', contribButtons);
|
||
|
|
|
||
|
|
// 6. Look at the sidebar nav to confirm "Projects" is still there
|
||
|
|
const sidebarItems = await p.evaluate(() => {
|
||
|
|
return [...document.querySelectorAll('.nav-item, [class*=sidebar] a, [class*=sidebar] button')]
|
||
|
|
.filter(e => e.offsetHeight > 0).map(e => e.innerText.trim()).filter(Boolean);
|
||
|
|
});
|
||
|
|
console.log('\n=== SIDEBAR ===');
|
||
|
|
console.log(sidebarItems);
|
||
|
|
|
||
|
|
await b.close();
|
||
|
|
})();
|