mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-01 22:45:18 +00:00
Small screenshot improvements
This commit is contained in:
parent
ddbda78a2c
commit
c22f2ea497
5 changed files with 108 additions and 18 deletions
|
|
@ -1,6 +1,14 @@
|
|||
const fs = require("fs");
|
||||
const puppeteer = require("puppeteer");
|
||||
const Filehound = require("filehound");
|
||||
const JSZip = require("jszip");
|
||||
|
||||
const validateZip = u =>
|
||||
new Promise((resolve, reject) => {
|
||||
fs.readFile(u, (err, buffer) => {
|
||||
JSZip.loadAsync(buffer).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
|
||||
const config = {
|
||||
equalizer: true,
|
||||
|
|
@ -9,6 +17,21 @@ const config = {
|
|||
noMarquee: true,
|
||||
audioUrl: null,
|
||||
initialState: {
|
||||
equalizer: {
|
||||
sliders: {
|
||||
"60": 52,
|
||||
"170": 74,
|
||||
"310": 83,
|
||||
"600": 91,
|
||||
"1000": 74,
|
||||
"3000": 54,
|
||||
"6000": 23,
|
||||
"12000": 19,
|
||||
"14000": 34,
|
||||
"16000": 75,
|
||||
preamp: 56
|
||||
}
|
||||
},
|
||||
media: {
|
||||
status: "PLAYING",
|
||||
kbps: 128,
|
||||
|
|
@ -34,6 +57,14 @@ const config = {
|
|||
|
||||
for (const skin of files) {
|
||||
const screenshotFile = `screenshots/${skin.replace(/\//g, "-")}.png`;
|
||||
const skinUrl = `experiments/automated_screenshots/${skin}`;
|
||||
console.log("Going to try", screenshotFile);
|
||||
try {
|
||||
await validateZip(`./${skin}`);
|
||||
} catch (e) {
|
||||
console.log("Error parsing", skinUrl, e);
|
||||
continue;
|
||||
}
|
||||
if (fs.existsSync(screenshotFile)) {
|
||||
console.log(screenshotFile, "exists already");
|
||||
continue;
|
||||
|
|
@ -43,16 +74,15 @@ const config = {
|
|||
page.on("console", (...args) => {
|
||||
console.log("PAGE LOG:", ...args);
|
||||
});
|
||||
config.skinUrl = `automated_screenshots/${skin}`;
|
||||
config.skinUrl = skinUrl;
|
||||
const url = `http://localhost:8080/#${JSON.stringify(config)}`;
|
||||
console.log({ url });
|
||||
await page["goto"](url);
|
||||
await page.waitForSelector("#loaded");
|
||||
await page.waitForSelector("#loaded", { timeout: 1000 });
|
||||
|
||||
console.log("Writing screenshot to", screenshotFile);
|
||||
await page.screenshot({ path: screenshotFile });
|
||||
await page.close();
|
||||
break;
|
||||
}
|
||||
browser.close();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"filehound": "^1.16.2",
|
||||
"jszip": "^3.1.4",
|
||||
"puppeteer": "^0.10.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ concat-stream@1.6.0:
|
|||
readable-stream "^2.2.2"
|
||||
typedarray "^0.0.6"
|
||||
|
||||
core-js@~2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.3.0.tgz#fab83fbb0b2d8dc85fa636c4b9d34c75420c6d65"
|
||||
|
||||
core-util-is@~1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
|
||||
|
|
@ -59,6 +63,10 @@ es6-promise@^4.0.3:
|
|||
version "4.1.1"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.1.1.tgz#8811e90915d9a0dba36274f0b242dbda78f9c92a"
|
||||
|
||||
es6-promise@~3.0.2:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.0.2.tgz#010d5858423a5f118979665f46486a95c6ee2bb6"
|
||||
|
||||
es6-promisify@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203"
|
||||
|
|
@ -129,6 +137,10 @@ https-proxy-agent@^2.1.0:
|
|||
agent-base "^4.1.0"
|
||||
debug "^2.4.1"
|
||||
|
||||
immediate@~3.0.5:
|
||||
version "3.0.6"
|
||||
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
|
||||
|
||||
inflight@^1.0.4:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
|
||||
|
|
@ -136,7 +148,7 @@ inflight@^1.0.4:
|
|||
once "^1.3.0"
|
||||
wrappy "1"
|
||||
|
||||
inherits@2, inherits@^2.0.3, inherits@~2.0.3:
|
||||
inherits@2, inherits@^2.0.3, inherits@~2.0.1, inherits@~2.0.3:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
|
||||
|
|
@ -144,6 +156,22 @@ isarray@~1.0.0:
|
|||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
|
||||
|
||||
jszip@^3.1.4:
|
||||
version "3.1.4"
|
||||
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.1.4.tgz#fc323fe41bb1730348d20dd022aa4d8b57cbbcf9"
|
||||
dependencies:
|
||||
core-js "~2.3.0"
|
||||
es6-promise "~3.0.2"
|
||||
lie "~3.1.0"
|
||||
pako "~1.0.2"
|
||||
readable-stream "~2.0.6"
|
||||
|
||||
lie@~3.1.0:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/lie/-/lie-3.1.1.tgz#9a436b2cc7746ca59de7a41fa469b3efb76bd87e"
|
||||
dependencies:
|
||||
immediate "~3.0.5"
|
||||
|
||||
lodash@^4.13.1:
|
||||
version "4.17.4"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
|
||||
|
|
@ -186,6 +214,10 @@ once@^1.3.0:
|
|||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
pako@~1.0.2:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.6.tgz#0101211baa70c4bca4a0f63f2206e97b7dfaf258"
|
||||
|
||||
path-is-absolute@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
|
||||
|
|
@ -240,6 +272,17 @@ readable-stream@^2.2.2:
|
|||
string_decoder "~1.0.3"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
readable-stream@~2.0.6:
|
||||
version "2.0.6"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
|
||||
dependencies:
|
||||
core-util-is "~1.0.0"
|
||||
inherits "~2.0.1"
|
||||
isarray "~1.0.0"
|
||||
process-nextick-args "~1.0.6"
|
||||
string_decoder "~0.10.x"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
retry@^0.10.0:
|
||||
version "0.10.1"
|
||||
resolved "https://registry.yarnpkg.com/retry/-/retry-0.10.1.tgz#e76388d217992c252750241d3d3956fed98d8ff4"
|
||||
|
|
@ -254,6 +297,10 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1:
|
|||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
|
||||
|
||||
string_decoder@~0.10.x:
|
||||
version "0.10.31"
|
||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
|
||||
|
||||
string_decoder@~1.0.3:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { CLICKED_TRACK, CTRL_CLICKED_TRACK } from "../../actionTypes";
|
|||
const Track = props => {
|
||||
const {
|
||||
skinPlaylistStyle,
|
||||
artist,
|
||||
selected,
|
||||
current,
|
||||
title,
|
||||
|
|
@ -28,7 +29,9 @@ const Track = props => {
|
|||
>
|
||||
<div className="playlist-track-number">{number}.</div>
|
||||
<div className="playlist-track-title">
|
||||
<span>{title}</span>
|
||||
<span>
|
||||
{artist} - {title}
|
||||
</span>
|
||||
</div>
|
||||
<div className="playlist-track-duration">{getTimeStr(duration)}</div>
|
||||
</div>
|
||||
|
|
@ -45,6 +48,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||
return {
|
||||
skinPlaylistStyle,
|
||||
selected: track.selected,
|
||||
artist: track.artist,
|
||||
title: track.title,
|
||||
duration: track.duration,
|
||||
current: currentTrack === ownProps.id
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
|
|||
>
|
||||
<div>
|
||||
<div
|
||||
className="playlist-track selected"
|
||||
className="playlist-track current"
|
||||
onClick={[Function]}
|
||||
onContextMenu={[Function]}
|
||||
style={
|
||||
Object {
|
||||
"backgroundColor": undefined,
|
||||
"color": null,
|
||||
"backgroundColor": null,
|
||||
"color": undefined,
|
||||
}
|
||||
}
|
||||
>
|
||||
|
|
@ -62,13 +62,15 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
|
|||
className="playlist-track-title"
|
||||
>
|
||||
<span>
|
||||
Rock Is Dead
|
||||
DJ Mike Llama
|
||||
-
|
||||
Llama Whipping Intro
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="playlist-track-duration"
|
||||
>
|
||||
03:11
|
||||
03:41
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
@ -92,23 +94,25 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
|
|||
className="playlist-track-title"
|
||||
>
|
||||
<span>
|
||||
Spybreak! (Short One)
|
||||
Marilyn Manson
|
||||
-
|
||||
Rock Is Dead
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="playlist-track-duration"
|
||||
>
|
||||
03:11
|
||||
03:41
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="playlist-track selected current"
|
||||
className="playlist-track selected"
|
||||
onClick={[Function]}
|
||||
onContextMenu={[Function]}
|
||||
style={
|
||||
Object {
|
||||
"backgroundColor": undefined,
|
||||
"color": undefined,
|
||||
"color": null,
|
||||
}
|
||||
}
|
||||
>
|
||||
|
|
@ -122,13 +126,15 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
|
|||
className="playlist-track-title"
|
||||
>
|
||||
<span>
|
||||
Clubbed to Death
|
||||
Propellerheads
|
||||
-
|
||||
Spybreak! (Short One)
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="playlist-track-duration"
|
||||
>
|
||||
03:11
|
||||
02:51
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
|
@ -152,13 +158,15 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
|
|||
className="playlist-track-title"
|
||||
>
|
||||
<span>
|
||||
Leave You Far Behind
|
||||
Rob D
|
||||
-
|
||||
Clubbed to Death
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
className="playlist-track-duration"
|
||||
>
|
||||
03:11
|
||||
03:35
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue