.\" Automatically generated by Pandoc 2.7.3 .\" .TH "PNBACKUP" "1" "" "pinboard-notes-backup" "" .hy .SH NAME .PP \f[B]pinboard-notes-backup\f[R] \[en] Back up the notes you\[cq]ve saved to Pinboard .SH SYNOPSIS .PP \f[B]pnbackup\f[R] \f[C][-v | --verbose] -t : \f[R] .SH OPTIONS .PP The following parameters must always be given: .TP .B \f[C]-t :\f[R] Your Pinboard username, a colon, and your Pinboard API token. You can find this on the Pinboard password settings page (https://pinboard.in/settings/password). .TP .B \f[C]\f[R] The name of the SQLite database file where your notes will be stored. This file will be created if it doesn\[cq]t yet exist. .PP The following options are available: .TP .B \f[C]-v, --verbose\f[R] Display more information about the sync progress. .TP .B \f[C]-h, --help\f[R] Display the usage information and exit. .TP .B \f[C]--version\f[R] Display the version number and exit. .SH DESCRIPTION .PP The program performs one-way synchronization between Pinboard and a local database: it will update your local file to match what\[cq]s on the server but it will never make any changes on the server. Notes will be created, modified, or deleted as appropriate in your local database to match what\[cq]s on the server. If the specified database file doesn\[cq]t exist, pnbackup will create it for you. .PP The Pinboard API requires a three-second wait between each request, and the text of each note must be downloaded in a separate request, so the initial download of your notes may take a while. Subsequent syncs will generally be much shorter, depending on how often you add or modify notes and how often you run pnbackup. .SH EXIT STATUS .PP pnbackup will return zero on success or nonzero on failure. .SH EXAMPLE .TP .B \f[C]pnbackup -t maciej:abc123456 Notes.sqlite\f[R] will put all of your notes into a SQLite database called \[lq]Notes.sqlite\[rq], assuming that your Pinboard username is \[lq]maciej\[rq] and your API token is \[lq]abc123456\[rq]. .SH DATA FORMAT .PP The notes are stored in a SQLite database. The database contains a single table, \[lq]notes\[rq], which has the following schema: .IP .nf \f[C] CREATE TABLE notes ( id TEXT NOT NULL UNIQUE, title TEXT NOT NULL, text TEXT NOT NULL, hash TEXT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL ); \f[R] .fi .PP These columns correspond exactly to the fields listed on the Pinboard API page (https://pinboard.in/api/). .PP SQLite is a binary format but there is a large ecosystem of tools that can work with it and, if you prefer, convert it to some text-based format instead. For example, if you\[cq]ve backed up your notes to a file called Notes.sqlite, you could use this quick and dirty Python script to print them in JSON format: .IP .nf \f[C] #!/usr/bin/env python3 from json import dumps import sqlite3 conn = sqlite3.connect(\[dq]Notes.sqlite\[dq]) conn.row_factory = sqlite3.Row curs = conn.cursor() curs.execute(\[dq]SELECT * FROM notes\[dq]) print(dumps([dict(r) for r in curs.fetchall()])) \f[R] .fi .SH AUTHOR .PP This program was created by Benjamin Esham (https://esham.io). .SH WEBSITE .PP The project is hosted at . .SH LICENSE .PP Copyright \[co] 2016\[en]2017, 2019 Benjamin D.\ Esham. .PP This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, but \f[B]without any warranty;\f[R] without even the implied warranty of \f[B]merchantability\f[R] or \f[B]fitness for a particular purpose.\f[R] See the GNU General Public License for more details. .PP You should have received a copy of the GNU General Public License along with this program. If not, see .