Cotton code
544 lines · 11.9 KB · JSONRaw
{  "format_version": 1,  "id": "music_album",  "name": "Album",  "plural": "Albums",  "picture": null,  "builtin": false,  "visibility": "owner",  "engine": null,  "columns": [    {      "key": "title",      "name": "Title",      "type": "text",      "required": true,      "placeholder": "The album's title"    },    {      "key": "artist",      "name": "Album artist",      "type": "link",      "link_to": "artist"    },    {      "key": "artist_name",      "name": "By",      "type": "text",      "placeholder": "Who it is by"    },    {      "key": "cover",      "name": "Cover",      "type": "photo"    },    {      "key": "year",      "name": "Year",      "type": "text"    },    {      "key": "compilation",      "name": "Compilation",      "type": "bool"    },    {      "key": "discs",      "name": "Discs",      "type": "number",      "units": {        "one": "disc",        "other": "discs"      }    },    {      "key": "songs",      "name": "Songs",      "type": "number",      "units": {        "one": "song",        "other": "songs"      },      "computed": {        "rollup": {          "table": "song",          "link": "album",          "op": "count"        }      }    },    {      "key": "length",      "name": "Length",      "type": "number",      "format": "duration",      "computed": {        "rollup": {          "table": "song",          "link": "album",          "op": "sum",          "column": "duration"        }      }    },    {      "key": "album_gain",      "name": "Album gain",      "type": "number",      "units": {        "one": "{n} dB",        "other": "{n} dB"      },      "readonly": true    },    {      "key": "album_peak",      "name": "Album peak",      "type": "number",      "readonly": true    },    {      "key": "added_on",      "name": "Added",      "type": "date"    },    {      "key": "last_played_at",      "name": "Last played",      "type": "date",      "format": "calendar-datetime",      "readonly": true    },    {      "key": "original_year",      "name": "First released",      "type": "text"    },    {      "key": "release_type",      "name": "Kind of release",      "type": "text"    },    {      "key": "label",      "name": "Label",      "type": "text"    },    {      "key": "catalog_number",      "name": "Catalogue number",      "type": "text"    },    {      "key": "barcode",      "name": "Barcode",      "type": "text"    },    {      "key": "bought_on",      "name": "Bought",      "type": "date"    },    {      "key": "store_url",      "name": "Shop page",      "type": "url"    },    {      "key": "store_id",      "name": "Shop's id",      "type": "text",      "readonly": true    },    {      "key": "booklet",      "name": "Booklet",      "type": "file",      "readonly": true    },    {      "key": "mb_release",      "name": "MusicBrainz release",      "type": "text",      "readonly": true    },    {      "key": "mb_release_group",      "name": "MusicBrainz release group",      "type": "text",      "readonly": true    },    {      "key": "filled_from",      "name": "Filled from",      "type": "longtext",      "readonly": true    },    {      "key": "on_phone",      "name": "On this phone",      "type": "choice",      "choices": [        "absent",        "some",        "keeping",        "kept"      ],      "labels": {        "absent": "Not on this phone",        "some": "Some on this phone",        "keeping": "Coming down",        "kept": "On this phone"      },      "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": [      "artist",      "cover",      "year",      "compilation",      "discs",      "album_gain",      "album_peak",      "added_on",      "last_played_at",      "original_year",      "release_type",      "bought_on",      "booklet",      "filled_from",      "on_phone",      "sent_at",      "send_id"    ],    "blind": [      "title",      "artist_name"    ]  },  "title": "title",  "date": "added_on",  "project": null,  "order": null,  "slip": {    "title": "title",    "subtitle": [      "artist_name",      "year"    ],    "trailing": "songs",    "photo": "cover",    "toggle": null  },  "tile": {    "face": "slip-list"  },  "page": [    {      "heading": null,      "columns": [        "cover",        "title",        "artist",        "artist_name",        "year",        "songs",        "length"      ]    },    {      "heading": "Album",      "columns": [        "compilation",        "discs",        "original_year",        "release_type",        "label",        "catalog_number",        "barcode",        "bought_on",        "store_url",        "store_id",        "booklet",        "added_on",        "last_played_at",        "album_gain",        "album_peak",        "on_phone",        "mb_release",        "mb_release_group",        "filled_from"      ]    }  ],  "sort": {    "column": "artist_name",    "descending": false,    "tie": "year"  },  "create": {    "label": "Add music",    "doors": [      {        "id": "files",        "label": "Add files",        "object": "singles",        "files": {          "types": [            "public.audio",            "public.zip-archive"          ],          "many": true        }      },      {        "id": "folder",        "label": "Add a folder",        "object": "crate",        "files": {          "types": [            "public.folder"          ]        }      }    ]  },  "empty": {    "title": "No albums yet",    "message": "Albums gather from the songs that come in."  },  "instructions": "One row per album, gathered from its songs as they come in, in one go per album: keyed on the album artist and the title, so an album never splits because some of its songs carry the compilation mark and some do not. \"Various Artists\" is one album artist; a set of discs is one album whose songs carry their disc_number. artist links the album artist and artist_name is the album artist as tagged. cover is the embedded picture, else the folder's cover.jpg, else what fetch_cover { album } finds (Cover Art Archive by mb_release or mb_release_group, then Deezer), else what the phone finds on iTunes; it is only ever filled while empty, and a cover the owner chose is never replaced. year, compilation, discs, album_gain and album_peak come from the songs' tags; original_year is the year the release first came out (ORIGINALDATE, TDOR), release_type the kind of release as the tags say it, lower-cased: album, single, ep, compilation, live, soundtrack or other; label, catalog_number and barcode are the release's as tagged (LABEL or TPUB, CATALOGNUMBER, BARCODE), and fetch_cover fills the empty ones of release_type, label, catalog_number and barcode from MusicBrainz when mb_release is known; bought_on, store_url and store_id remember where it was bought, for any shop: an album ZIP brings them (store_url and store_id, bandcamp:<artist>/<album>, from a Bandcamp album page named in the ZIP's note; bought_on the ZIP's own file date), filling only what is empty, and the owner may type them; booklet is the ZIP's PDF booklet, kept as a book file the reader opens. mb_release and mb_release_group from the tags or MusicBrainz, filling only what the tags left empty, each fill named in filled_from. songs and length are counted from its songs. last_played_at is the player's alone: the last time one of its songs counted as a play. Opening an album deals its songs in disc_number then track_number order. on_phone is answered by each phone from its songs (absent, some, keeping, kept) and never stored.",  "commands": [    {      "id": "play",      "label": "Play",      "kind": "update",      "method": "shell.player",      "data": {        "table": "music_album",        "op": "play"      },      "bindings": {        "id": "$id"      },      "receipt": "Playing {name}",      "object": "slip"    },    {      "id": "shuffle",      "label": "Play shuffled",      "kind": "update",      "method": "shell.player",      "data": {        "table": "music_album",        "op": "shuffle"      },      "bindings": {        "id": "$id"      },      "receipt": "Shuffling {name}",      "object": "loop"    },    {      "id": "play_next",      "label": "Play next",      "kind": "update",      "method": "shell.player",      "data": {        "table": "music_album",        "op": "queue_next"      },      "bindings": {        "id": "$id"      },      "receipt": "{name} plays next",      "object": "slip"    },    {      "id": "add_to_queue",      "label": "Add to queue",      "kind": "update",      "method": "shell.player",      "data": {        "table": "music_album",        "op": "queue_add"      },      "bindings": {        "id": "$id"      },      "receipt": "Added {name} to the queue",      "object": "folder"    },    {      "id": "find_details",      "label": "Find details",      "kind": "update",      "method": "music.findDetails",      "data": {        "table": "music_album"      },      "bindings": {        "id": "$id"      },      "receipt": "Looking up {name}",      "object": "loop"    },    {      "id": "keep_on_phone",      "label": "Keep on phone",      "kind": "update",      "method": "settings.openFlow",      "data": {        "flow": "keepAlbum",        "origin_table": "music_album"      },      "bindings": {        "origin_id": "$id"      },      "when": {        "on_phone": [          "absent",          "some"        ]      },      "receipt": "Keeping {name} on this phone",      "object": "folder"    },    {      "id": "remove_download",      "label": "Remove download",      "kind": "update",      "method": "settings.openFlow",      "data": {        "flow": "removeAlbumDownload",        "origin_table": "music_album"      },      "bindings": {        "origin_id": "$id"      },      "when": {        "on_phone": [          "some",          "keeping",          "kept"        ]      },      "receipt": "Removed {name} from this phone",      "object": "bin"    }  ],  "card": {    "face": "album.sleeve",    "offers": [      "album.sleeve",      "album.tray"    ],    "fields": [      {        "slot": "photo",        "column": "cover"      },      {        "slot": "title",        "column": "title"      },      {        "slot": "subtitle",        "column": "artist_name"      },      {        "slot": "year",        "column": "year"      },      {        "slot": "count",        "column": "songs"      },      {        "slot": "length",        "column": "length",        "form": "clock"      }    ],    "opens": {      "table": "song",      "by": "album",      "order": [        "disc_number",        "track_number"      ]    }  },  "groups": {    "stack": "covers"  },  "send": {    "columns": [      "title",      "artist_name",      "cover",      "year",      "compilation",      "discs",      "album_gain",      "album_peak",      "original_year",      "release_type",      "label",      "catalog_number",      "barcode",      "booklet",      "mb_release",      "mb_release_group"    ],    "files": [      "cover",      "booklet"    ],    "same": [      [        "mb_release"      ],      [        "barcode"      ],      [        "title",        "artist_name"      ]    ],    "with": [      {        "table": "song",        "by": "album"      }    ]  }}