Cotton code
783 lines · 15.9 KB · JSONRaw
{  "format_version": 1,  "id": "book",  "name": "Book",  "plural": "Books",  "picture": null,  "builtin": false,  "visibility": "owner",  "engine": null,  "columns": [    {      "key": "title",      "name": "Title",      "type": "text",      "required": true,      "placeholder": "The book's title"    },    {      "key": "author",      "name": "Author",      "type": "text",      "placeholder": "Who wrote it"    },    {      "key": "cover",      "name": "Cover",      "type": "photo"    },    {      "key": "file",      "name": "Book",      "type": "file",      "readonly": true    },    {      "key": "format",      "name": "Kind",      "type": "choice",      "choices": [        "epub",        "pdf"      ],      "labels": {        "epub": "EPUB",        "pdf": "PDF"      },      "readonly": true    },    {      "key": "status",      "name": "Status",      "type": "choice",      "choices": [        "want_to_read",        "reading",        "finished",        "stopped"      ],      "labels": {        "want_to_read": "Want to read",        "reading": "Reading",        "finished": "Finished",        "stopped": "Stopped"      },      "default": "want_to_read"    },    {      "key": "rating",      "name": "Rating",      "type": "number",      "units": {        "one": "{n} of 5",        "other": "{n} of 5"      }    },    {      "key": "review",      "name": "Review",      "type": "longtext",      "placeholder": "What you thought"    },    {      "key": "added_on",      "name": "Added",      "type": "date"    },    {      "key": "started_on",      "name": "Started",      "type": "date"    },    {      "key": "finished_on",      "name": "Finished",      "type": "date"    },    {      "key": "read_count",      "name": "Times read",      "type": "number"    },    {      "key": "position",      "name": "Place",      "type": "text"    },    {      "key": "progress",      "name": "Read",      "type": "number",      "units": {        "one": "{n}%",        "other": "{n}%"      }    },    {      "key": "position_at",      "name": "Last read",      "type": "date",      "format": "calendar-datetime"    },    {      "key": "pages",      "name": "Pages",      "type": "number",      "units": {        "one": "page",        "other": "pages"      }    },    {      "key": "series",      "name": "Series",      "type": "text"    },    {      "key": "series_number",      "name": "Number in series",      "type": "number"    },    {      "key": "year",      "name": "First published",      "type": "text"    },    {      "key": "language",      "name": "Language",      "type": "text"    },    {      "key": "isbn",      "name": "ISBN",      "type": "text"    },    {      "key": "ol_work",      "name": "Open Library",      "type": "text",      "readonly": true    },    {      "key": "goodreads_id",      "name": "Goodreads",      "type": "text",      "readonly": true    },    {      "key": "source",      "name": "Came from",      "type": "choice",      "choices": [        "file",        "lookup",        "goodreads",        "typed"      ],      "labels": {        "file": "A file",        "lookup": "Open Library",        "goodreads": "Goodreads",        "typed": "Typed"      },      "readonly": true    },    {      "key": "on_phone",      "name": "On this phone",      "type": "choice",      "choices": [        "absent",        "keeping",        "kept"      ],      "labels": {        "absent": "Not on this phone",        "keeping": "Coming down",        "kept": "On this phone"      },      "readonly": true    },    {      "key": "publisher",      "name": "Publisher",      "type": "text"    },    {      "key": "description",      "name": "About",      "type": "longtext"    },    {      "key": "subjects",      "name": "Subjects",      "type": "text"    },    {      "key": "ol_edition",      "name": "Open Library edition",      "type": "text",      "readonly": true    },    {      "key": "doi",      "name": "DOI",      "type": "text"    },    {      "key": "filled_from",      "name": "Filled from",      "type": "longtext",      "readonly": true    },    {      "key": "deleted_at",      "name": "Deleted at",      "type": "text",      "readonly": true    },    {      "key": "sent_by",      "name": "Sent by",      "type": "text",      "readonly": true    },    {      "key": "sent_by_number",      "name": "Sent from",      "type": "text",      "readonly": true    },    {      "key": "sent_at",      "name": "Sent",      "type": "date",      "format": "calendar-datetime",      "readonly": true    },    {      "key": "send_id",      "name": "Send",      "type": "text",      "readonly": true    }  ],  "seal": {    "clear": [      "cover",      "file",      "format",      "status",      "added_on",      "started_on",      "finished_on",      "read_count",      "progress",      "position_at",      "source",      "on_phone",      "filled_from",      "deleted_at",      "sent_at",      "send_id"    ],    "blind": [      "title",      "author"    ]  },  "title": "title",  "date": "finished_on",  "project": null,  "order": null,  "slip": {    "title": "title",    "subtitle": "author",    "trailing": "status",    "photo": "cover",    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "cover",        "title",        "author",        "status",        "rating",        "progress"      ]    },    {      "heading": "Reading",      "columns": [        "added_on",        "started_on",        "finished_on",        "read_count",        "position_at"      ]    },    {      "heading": "Review",      "columns": [        "review"      ]    },    {      "heading": "About",      "columns": [        "description"      ]    },    {      "heading": "Book",      "columns": [        "series",        "series_number",        "publisher",        "year",        "pages",        "language",        "subjects",        "isbn",        "doi",        "format",        "on_phone",        "source",        "ol_work",        "ol_edition",        "goodreads_id"      ]    }  ],  "sort": {    "column": "added_on",    "descending": true  },  "empty": {    "title": "A place for your next book."  },  "create": {    "label": "Add a book",    "doors": [      {        "id": "find",        "label": "Find a book",        "object": "catalogue",        "act": {          "name": "find_book",          "argument": "query",          "lands": "book",          "signed_out": "Sign in to find books by name"        }      },      {        "id": "file",        "label": "Add a file",        "object": "parcel",        "files": {          "types": [            "org.idpf.epub-container",            "com.adobe.pdf"          ],          "many": true        }      },      {        "id": "folder",        "label": "Add a folder",        "object": "parcel",        "files": {          "types": [            "public.folder"          ]        }      },      {        "id": "goodreads",        "label": "Bring Goodreads in",        "object": "stack",        "files": {          "types": [            "public.comma-separated-values-text"          ]        }      }    ]  },  "instructions": "One row per book the owner owns, is reading, has read or means to read. A book with a file (format epub or pdf, the file in the object's media under books/) is read in the app; one without is a shelf entry. status is want_to_read, reading, finished or stopped (did not finish); added_on, started_on and finished_on are the days the owner gave or the app stamped, never guessed; rating is out of 5 in half steps, null when unrated; read_count is how many times it was finished. position is a Readium Locator (JSON text) and progress (0 to 100) how far through, both written by the reader alone, as is position_at. Start reading and Finished are the acts start_book { book } and finish_book { book, rating? }: they stamp the day and count the reading, and Finished writes the stars it asked for. Rate sets rating, Review writes review, Find details is find_book { book } (by the book's isbn, else its title and author), and Add file gives a book with no file its EPUB or PDF. find_book { query } | { isbn } looks a book up on Open Library and fills only empty columns (a query with no match is refused); import_goodreads { file } brings a Goodreads library export, each book found again by goodreads_id, other shelves made lists. publisher, description (plain text), subjects (comma separated), doi, ol_edition (an Open Library edition id, OL…M) and series with series_number come from the file's own package document (an EPUB's OPF, a Calibre metadata.opf) or a lookup, filling only while empty. source says where the row came from. filled_from says, as JSON, where each fill's columns came from (opf, goodreads, open_library), kept by the app. on_phone is answered by each phone (absent, keeping, kept) and never stored. Lists are this table's groups.",  "commands": [    {      "id": "read",      "label": "Read",      "object": "page",      "kind": "update",      "method": "reader.open",      "bindings": {        "id": "$id"      },      "when": {        "file": {          "not": false        }      }    },    {      "id": "start",      "label": "Start reading",      "kind": "update",      "method": "object.act",      "data": {        "act": "start_book"      },      "bindings": {        "book": "$id"      },      "when": {        "status": [          "want_to_read",          "stopped",          "finished"        ]      },      "receipt": "Reading {name}",      "object": "slip"    },    {      "id": "finish",      "label": "Finished",      "kind": "update",      "method": "object.act",      "data": {        "act": "finish_book"      },      "bindings": {        "book": "$id"      },      "when": {        "status": "reading"      },      "pick": {        "argument": "rating",        "kind": "number",        "label": "How many stars",        "min": 1,        "max": 5,        "optional": true,        "labels": {          "1": "★",          "2": "★★",          "3": "★★★",          "4": "★★★★",          "5": "★★★★★"        }      },      "receipt": "Finished {name}",      "does": "completes",      "object": "stamp"    },    {      "id": "stop",      "label": "Stop reading",      "kind": "update",      "verb": "update_record",      "data": {        "table": "book",        "patch": {          "status": "stopped"        }      },      "bindings": {        "id": "$id"      },      "when": {        "status": "reading"      },      "receipt": "Stopped {name}",      "undo": "resume",      "does": "puts-away",      "object": "folder"    },    {      "id": "resume",      "label": "Back to reading",      "kind": "update",      "verb": "update_record",      "data": {        "table": "book",        "patch": {          "status": "reading"        }      },      "bindings": {        "id": "$id"      },      "when": {        "status": "stopped"      },      "receipt": "Reading {name}",      "undo": "stop",      "object": "slip"    },    {      "id": "want",      "label": "Want to read",      "kind": "update",      "verb": "update_record",      "data": {        "table": "book",        "patch": {          "status": "want_to_read"        }      },      "bindings": {        "id": "$id"      },      "when": {        "status": [          "finished",          "stopped"        ]      },      "receipt": "On your list",      "object": "folder"    },    {      "id": "keep_on_phone",      "label": "Keep on phone",      "kind": "update",      "method": "settings.openFlow",      "data": {        "flow": "keepBook",        "origin_table": "book"      },      "bindings": {        "origin_id": "$id"      },      "when": {        "on_phone": "absent"      },      "receipt": "Keeping {name} on this phone",      "object": "folder"    },    {      "id": "remove_download",      "label": "Remove download",      "kind": "update",      "method": "settings.openFlow",      "data": {        "flow": "removeBookDownload",        "origin_table": "book"      },      "bindings": {        "origin_id": "$id"      },      "when": {        "on_phone": [          "keeping",          "kept"        ]      },      "receipt": "Removed {name} from this phone",      "object": "bin"    },    {      "id": "rate",      "label": "Rate",      "kind": "update",      "verb": "update_record",      "data": {        "table": "book"      },      "bindings": {        "id": "$id"      },      "pick": {        "argument": "patch.rating",        "kind": "number",        "label": "How many stars",        "min": 1,        "max": 5,        "labels": {          "1": "★",          "2": "★★",          "3": "★★★",          "4": "★★★★",          "5": "★★★★★"        }      },      "receipt": "Rated {name}",      "object": "star"    },    {      "id": "review",      "label": "Review",      "kind": "update",      "verb": "update_record",      "data": {        "table": "book"      },      "bindings": {        "id": "$id"      },      "pick": {        "argument": "patch.review",        "kind": "text",        "label": "Review"      },      "receipt": "Reviewed {name}",      "object": "slip"    },    {      "id": "find_details",      "label": "Find details",      "kind": "update",      "method": "object.act",      "data": {        "act": "find_book"      },      "bindings": {        "book": "$id"      },      "receipt": "Found details for {name}",      "object": "catalogue"    },    {      "id": "add_file",      "label": "Add file",      "kind": "update",      "method": "settings.openFlow",      "data": {        "flow": "addBookFile",        "origin_table": "book"      },      "bindings": {        "origin_id": "$id"      },      "when": {        "file": false      },      "receipt": "Added a file to {name}",      "object": "parcel"    }  ],  "card": {    "face": "book.hardback",    "pages": [      "review"    ],    "opens": {      "table": "highlight",      "by": "book",      "order": [        "progress"      ]    },    "fields": [      {        "slot": "photo",        "column": "cover"      },      {        "slot": "title",        "column": "title"      },      {        "slot": "subtitle",        "column": "author"      },      {        "slot": "used",        "column": "progress"      },      {        "slot": "state",        "column": "status",        "only": [          "want_to_read",          "reading",          "finished",          "stopped"        ]      },      {        "slot": "started",        "column": "started_on"      },      {        "slot": "last_read",        "column": "position_at",        "form": "day_month"      },      {        "slot": "pages",        "column": "pages"      },      {        "slot": "date",        "column": "finished_on"      },      {        "slot": "count",        "column": "rating"      },      {        "slot": "body",        "column": "review"      }    ]  },  "groups": {    "stack": "covers"  },  "send": {    "columns": [      "title",      "author",      "cover",      "file",      "format",      "pages",      "series",      "series_number",      "year",      "language",      "isbn",      "ol_work",      "ol_edition",      "goodreads_id",      "publisher",      "description",      "subjects",      "doi"    ],    "files": [      "cover",      "file"    ],    "same": [      [        "file"      ],      [        "isbn"      ],      [        "ol_work"      ],      [        "doi"      ],      [        "title",        "author"      ]    ]  }}