aboutsummaryrefslogtreecommitdiff
path: root/select.js
blob: 6938749cdaeb166e649688f1341f15eb6fe74635 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const child = require("child_process")
const fzf = require("./fzf")
const info = require("./info")

;(async _ => {
	const doujins = await info.doujins()
	const tags = await info.tags()

	let doujin, tag
	while (!doujin) {
		try { tag    = await fzf(Object.keys(tags).sort()) } catch { return }
		try { doujin = await fzf(Object.values(tags[tag]).sort(), __dirname + "/fzf-previews") } catch {}
	}

	child.spawn("firefox", [`file://${process.cwd()}/${doujin}/index.html`])
})()