Skip to content

Commit

Permalink
merging and debugging, next is merging the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierreaubert committed May 1, 2024
1 parent f87f012 commit 36c33c9
Show file tree
Hide file tree
Showing 133 changed files with 715 additions and 987 deletions.
3 changes: 0 additions & 3 deletions babel.config.json

This file was deleted.

69 changes: 69 additions & 0 deletions datas/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,40 @@ class Speaker(SpeakerRequired, total=False):
},
},
},
"Dayton Audio OPAL1": {
"skip": True,
"brand": "Dayton Audio",
"model": "OPAL1",
"type": "passive",
"price": "800",
"amount": "pair",
"shape": "bookshelves",
"default_measurement": "eac",
"measurements": {
"eac": {
"origin": "ErinsAudioCorner",
"format": "klippel",
"reviews": {
"eac": "https://www.erinsaudiocorner.com/loudspeakers/dayton_opal1/",
"yt": "https://youtu.be/BDv222LHNM0",
},
"review_published": "202404xx",
"specifications": {
"sensitivity": 78.5,
"impedance": 4.3,
"SPL": {
"peak": 102,
},
"size": {
"height": 356,
"width": 178,
"depth": 241,
},
"weight": 9.4,
},
},
},
},
"DB Audiotechnik 8S": {
"brand": "DB Audiotechnik",
"model": "8S",
Expand Down Expand Up @@ -22542,6 +22576,41 @@ class Speaker(SpeakerRequired, total=False):
},
},
},
"Wharfedale Super Denton": {
"skip": True,
"brand": "Wharfedale",
"model": "Super Denton",
"type": "passive",
"price": "1400",
"amount": "pair",
"shape": "bookshelves",
"default_measurement": "eac",
"measurements": {
"eac": {
"origin": "ErinsAudioCorner",
"format": "klippel",
"reviews": {
"eac": "https://www.erinsaudiocorner.com/loudspeakers/wharfedale_super_denton/",
"yt": "https://youtu.be/5Xb9Ku0Fy_E",
},
"review_published": "202404xx",
"specifications": {
"sensitivity": 87,
"impedance": 3.4,
"SPL": {
"peak": 103,
},
"size": {
"height": 360,
"width": 246,
"depth": 295,
},
"weight": 9.2,
},
},
},
},

"Wilson Audio TuneTot": {
"brand": "Wilson Audio",
"model": "TuneTot",
Expand Down
36 changes: 36 additions & 0 deletions datas/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"": {
"skip": True,
"brand": "",
"model": "",
"type": "passive",
"price": "",
"amount": "pair",
"shape": "bookshelves",
"default_measurement": "eac",
"measurements": {
"eac": {
"origin": "ASR",
"origin": "ErinsAudioCorner",
"format": "klippel",
"reviews": {
"asr": "",
"eac": "",
"yt": "",
},
"review_published": "202404xx",
"specifications": {
"sensitivity": ,
"impedance": ,
"SPL": {
"peak": ,
},
"size": {
"height": ,
"width": ,
"depth": ,
},
"weight": ,
},
},
},
},
67 changes: 31 additions & 36 deletions generate_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def main():
meta = json.load(f)

# load versions for various css and js files
versions = get_versions("./update_3rdparties.sh")
versions = get_versions("{}/update_3rdparties.sh".format(cpaths.CPATH_SCRIPTS))

# only build a dictionnary will all graphs
main_df = {}
Expand Down Expand Up @@ -316,7 +316,8 @@ def main():

# configure Mako
mako_templates = TemplateLookup(
directories=["src/website"], module_directory="./build/mako_modules"
directories=[cpaths.CPATH_WEBSITE, cpaths.CPATH_BUILD_WEBSITE],
module_directory=cpaths.CPATH_BUILD_MAKO,
)

# write index.html
Expand Down Expand Up @@ -436,37 +437,25 @@ def main():
"pmc.png",
"revel.png",
"spin.svg",
"volume-0.svg",
"volume-1.svg",
"volume-2.svg",
"volume-3.svg",
"volume-4.svg",
"volume-5.svg",
"volume-danger-0.svg",
"volume-danger-1.svg",
"volume-danger-2.svg",
"volume-danger-3.svg",
"volume-info-0.svg",
"volume-info-1.svg",
"volume-info-2.svg",
"volume-info-3.svg",
"volume-success-0.svg",
"volume-success-1.svg",
"volume-success-2.svg",
"volume-success-3.svg",
"volume.svg",
]:
file_in = cpaths.CPATH_DATAS_ICONS + "/" + f
file_out = cpaths.CPATH_DOCS + "/" + f
file_out = cpaths.CPATH_DOCS + "/pictures/" + f
shutil.copy(file_in, file_out)

# copy custom css
for f in [
"spinorama.css",
]:
file_in = cpaths.CPATH_WEBSITE + "/" + f
file_out = cpaths.CPATH_DOCS + "/css/" + f
shutil.copy(file_in, file_out)

# copy manifest
for f in [
"manifest.json",
]:
file_in = cpaths.CPATH_WEBSITE + "/" + f
file_out = cpaths.CPATH_DOCS + "/svg" + f
file_out = cpaths.CPATH_DOCS + "/" + f
shutil.copy(file_in, file_out)

# cleanup flow directives: currently unused
Expand All @@ -478,7 +467,7 @@ def main():
flow_param,
cpaths.CPATH_WEBSITE,
"--out-dir",
cpaths.CPATH_DOCS,
cpaths.CPATH_BUILD_WEBSITE,
)
status = subprocess.run(
[flow_command], shell=True, check=True, capture_output=True # noqa: S602
Expand All @@ -487,7 +476,7 @@ def main():
print("flow failed")

# copy css/js files
logger.info("Copy js files to %s", cpaths.CPATH_DOCS)
logger.info("Copy js files to %s", cpaths.CPATH_DOCS_JS)
try:
for item in (
"compare",
Expand All @@ -498,6 +487,7 @@ def main():
"meta",
"misc",
"onload",
"pagination",
"plot",
"scores",
"search",
Expand Down Expand Up @@ -532,21 +522,26 @@ def main():
min=".min" if flag_optim else "",
versions=versions,
)
item_filename = "{}/{}-{}.js".format(cpaths.CPATH_DOCS, item, CACHE_VERSION)
write_if_different(item_content, item_filename, force=False)
item_filename = "{}/{}-1-gen.js".format(cpaths.CPATH_BUILD_WEBSITE, item)
write_if_different(item_content, item_filename, force=True)
# compress files with terser
if flag_optim:
terser_command = "{0} {1}/{2} > {1}/{3}".format(
terser_command = "{0} {1}/{2} > {3}/{4}".format(
"./node_modules/.bin/terser",
cpaths.CPATH_DOCS,
"{}-{}.js".format(item, CACHE_VERSION),
cpaths.CPATH_BUILD_WEBSITE,
"{}-1-gen.js".format(item),
cpaths.CPATH_DOCS_JS,
"{}-{}.min.js".format(item, CACHE_VERSION),
)
status = subprocess.run(
[terser_command], shell=True, check=True, capture_output=True # noqa: S602
)
if status.returncode != 0:
print("terser failed for item {}".format(item))
# print(terser_command)
try:
status = subprocess.run(
[terser_command], shell=True, check=True, capture_output=True # noqa: S602
)
if status.returncode != 0:
print("terser failed for item {}".format(item))
except subprocess.CalledProcessError as e:
print("terser failed for item {} with {}".format(item, e))
# optimise files with critical
if flag_optim:
pass
Expand All @@ -573,7 +568,7 @@ def main():
)
item_filename = cpaths.CPATH_DOCS + "/" + item_name
# ok for robots but likely doesn't work for sitemap
write_if_different(item_content, item_filename, force=False)
write_if_different(item_content, item_filename, force=True)
except KeyError as key_error:
print("Generating various html files failed with {}".format(key_error))
sys.exit(1)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
"dependencies": {
"bulmajs": "^0.0.2",
"fnm": "^0.0.0",
"fuse.js": "^7.0.0",
"handlebars": "^4.7.8",
"html-validate": "^7.13.2",
"html-validator": "^5.1.18",
"html-validator-cli": "^2.0.0",
"node": "^21.1.0",
"npm": "^10.2.3",
"plotly": "^1.0.6",
"plotly.js": "^2.32.0",
"sass": "^1.58.0",
"typescript-language-server": "^3.3.2"
},
Expand All @@ -24,6 +26,6 @@
"terser": "^5.30.3",
"w3c-html-validator": "^1.7.0",
"workbox-cli": "^7.0.0",
"workbox-window": "^7.0.0"
"workbox-window": "^7.1.0"
}
}
2 changes: 1 addition & 1 deletion check_404.sh → scripts/check_404.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

pylinkvalidate.py -P https://www.spinorama.org

for f in docs/speakers/*/*/*/*.html; do
for f in ./docs/speakers/*/*/*/*.html; do
name=${f#docs/}
u=${name// /%20}
pylinkvalidate.py -P "https://www.spinorama.org/$u"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/svg2symbols.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!python3

from glob import glob
from os.path import basename
Expand Down Expand Up @@ -31,7 +31,7 @@ def process(filename, xml):

if __name__ == "__main__":
svg_paths = [
"src/website/icons/*.svg",
"src/website/svg/*.svg",
]

xml_pre()
Expand Down
File renamed without changes.
38 changes: 38 additions & 0 deletions scripts/update_3rdparties.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

# warning this section is read by a python script (generate_html) to grab the versions

PLOTLY=2.32.0
HANDLEBARS=4.7.8
BULMA=1.0.0
FUSE=7.0.0
WORKBOX=7.0.0

# end section

ASSETS=./docs
ASSETS_JS=${ASSETS}/js3rd
ASSETS_CSS=${ASSETS}/css

# BULMA
if ! test -f "${ASSETS}/handlebars-${HANDLEBARS}.min.js"; then
wget -O${ASSETS_JS}/handlebars-${HANDLEBARS}.min.js https://cdn.jsdelivr.net/npm/handlebars@${HANDLEBARS}/dist/handlebars.min.js
fi
if ! test -f "${ASSETS}/bulma-${BULMA}.min.css"; then
wget -O${ASSETS_CSS}/bulma-${BULMA}.min.css https://cdn.jsdelivr.net/npm/bulma@${BULMA}/css/bulma.min.css
fi

# PLOTLY
if ! test -f "${ASSETS}/plotly-${PLOTLY}.min.js"; then
wget -O${ASSETS_JS}/plotly-${PLOTLY}.min.js https://cdn.plot.ly/plotly-${PLOTLY}.min.js
fi

# FUSE.JS
npm install fuse.js
cp node_modules/fuse.js/dist/fuse.min.mjs ${ASSETS_JS}/fuse-${FUSE}.min.mjs

# WORKBOX
npm install workbox-window
cp node_modules/workbox-window/build/workbox-window.prod.mjs ${ASSETS_JS}/workbox-window-${WORKBOX}.min.js
cp node_modules/workbox-window/build/workbox-window.prod.mjs.map ${ASSETS_JS}/workbox-window-${WORKBOX}.min.js.map

Loading

0 comments on commit 36c33c9

Please sign in to comment.