perf(site): serve responsive WebP and compressed Hub videos
This commit is contained in:
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
from html.parser import HTMLParser
|
||||
from urllib.parse import urlsplit,unquote
|
||||
from collections import Counter
|
||||
import json,re,subprocess
|
||||
import json,re,subprocess,hashlib
|
||||
r=Path(__file__).resolve().parents[1];fail=[];assets=set();anchors=[]
|
||||
class Page(HTMLParser):
|
||||
def __init__(self):super().__init__();self.ids=[];self.refs=[];self.h1=0;self.scripts=[];self.ld=False;self.text=[];self.script=False;self.canonical=[]
|
||||
@@ -51,6 +51,11 @@ def videos(data):
|
||||
if src.endswith(('.mp4','.mov','.webm')):result.add(src)
|
||||
return result
|
||||
oldvideos=videos(old);newvideos=videos(new)
|
||||
video_manifest = json.loads((r/'content/media-video-variants.json').read_text()) if (r/'content/media-video-variants.json').exists() else {'videos': []}
|
||||
for item in video_manifest['videos']:
|
||||
assert hashlib.sha256((r/item['original']).read_bytes()).hexdigest() == item['sha256Original']
|
||||
assert hashlib.sha256((r/item['output']).read_bytes()).hexdigest() == item['sha256Output']
|
||||
if './'+item['output'] in newvideos: newvideos.add('./'+item['source'])
|
||||
assert oldvideos<=newvideos,oldvideos-newvideos
|
||||
knowledge=json.loads((r/'content/knowledge.json').read_text())
|
||||
def active_nodes(nodes):
|
||||
|
||||
Reference in New Issue
Block a user