Skip to content

Instantly share code, notes, and snippets.

@akirak
Created July 18, 2017 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirak/1f7de06e3b77050cb4a594adf73f64df to your computer and use it in GitHub Desktop.
Save akirak/1f7de06e3b77050cb4a594adf73f64df to your computer and use it in GitHub Desktop.
A tiny shell script to add a book in your Manning library (on Dropbox) to your calibre library using fzf
#!/bin/bash
python <<PYTHON | fzf -m | xargs -d'\n' calibredb add
import os.path
import glob
root = os.path.expanduser('~/Dropbox/Apps/Manning Books')
files = glob.glob(os.path.join(root, '**/*.epub'))
result = sorted(list(map(lambda f: (f, os.path.getctime(f)), files)), key=lambda t: t[1], reverse=True)
candidates = list(map(lambda f: f[0], result))
for c in candidates:
print(c)
PYTHON
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment