]> git.lizzy.rs Git - local-nhentai.git/blob - select.js
Initial commit
[local-nhentai.git] / select.js
1 const child = require("child_process")
2 const fzf = require("./fzf")
3 const info = require("./info")
4
5 ;(async _ => {
6         const doujins = await info.doujins()
7         const tags = await info.tags()
8
9         let doujin, tag
10         while (!doujin) {
11                 try { tag    = await fzf(Object.keys(tags).sort()) } catch { return }
12                 try { doujin = await fzf(Object.values(tags[tag]).sort(), __dirname + "/fzf-previews") } catch {}
13         }
14
15         child.spawn("firefox", [`file://${process.cwd()}/${doujin}/index.html`])
16 })()