diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:44:34 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2024-08-20 20:44:34 -0300 |
commit | e851401694daacaf1aba2c87ed557e5dbf00af02 (patch) | |
tree | d772b15f3a5ba9e015936f7162f448a7208a4001 /export-koreader-note | |
parent | d6a4d78d31ffa57e00a7d5b0a87baa38156cee06 (diff) | |
download | scripts-e851401694daacaf1aba2c87ed557e5dbf00af02.tar.gz scripts-e851401694daacaf1aba2c87ed557e5dbf00af02.tar.bz2 |
Move scripts to other repositories
Diffstat (limited to 'export-koreader-note')
-rwxr-xr-x | export-koreader-note | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/export-koreader-note b/export-koreader-note deleted file mode 100755 index ae2e0ef..0000000 --- a/export-koreader-note +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env lua --- --- Convert koreader metadata to markdown. --- - --- Sort by page number -function compare(a, b) - return a.page < b.page -end - --- Check if a file exists --- Thanks https://stackoverflow.com/questions/4990990/check-if-a-file-exists-with-lua#4991602 -function file_exists(name) - local f=io.open(name,"r") - if f~=nil then io.close(f) return true else return false end -end - --- Get filename -file = arg[1] - --- Usage -if file == nil then - print('usage: ' .. arg[0] .. ' <filename>') - os.exit(1) -else - if not file_exists(file) then - print('file not found: ' .. file) - os.exit(1) - end -end - --- Load metadata -content = assert(loadfile(file)) -data = content() -bookmarks = data.bookmarks - --- Sort -table.sort(bookmarks, compare) - --- Iterate over bookmarks -for key, item in ipairs(bookmarks) do - print('Page ' .. item.page .. ':') - print('') - print('> ' .. item.notes) - print('') -end |