baken-export 4.2.1

Bake'n Deck device export: writes a rekordbox USB export (export.pdb + ANLZ) from collection.xml
Documentation
//! Rows rekordbox writes identically into every fresh export, captured from
//! an empty rekordbox 7.0.5 export and cross-checked against a 587-track one.

/// Browse columns for the `columns` table (type 0x10): `(id, code, name)` in
/// row order. The code is rekordbox's per-column constant, not derived from the id.
/// Names are wrapped in U+FFFA / U+FFFB as rekordbox stores them.
pub const COLUMNS: [(u16, u16, &str); 27] = [
    (1, 0x0080, "\u{fffa}GENRE\u{fffb}"),
    (2, 0x0081, "\u{fffa}ARTIST\u{fffb}"),
    (3, 0x0082, "\u{fffa}ALBUM\u{fffb}"),
    (4, 0x0083, "\u{fffa}TRACK\u{fffb}"),
    (5, 0x0085, "\u{fffa}BPM\u{fffb}"),
    (6, 0x0086, "\u{fffa}RATING\u{fffb}"),
    (7, 0x0087, "\u{fffa}YEAR\u{fffb}"),
    (8, 0x0088, "\u{fffa}REMIXER\u{fffb}"),
    (9, 0x0089, "\u{fffa}LABEL\u{fffb}"),
    (10, 0x008a, "\u{fffa}ORIGINAL ARTIST\u{fffb}"),
    (11, 0x008b, "\u{fffa}KEY\u{fffb}"),
    (12, 0x008d, "\u{fffa}CUE\u{fffb}"),
    (13, 0x008e, "\u{fffa}COLOR\u{fffb}"),
    (14, 0x0092, "\u{fffa}TIME\u{fffb}"),
    (15, 0x0093, "\u{fffa}BITRATE\u{fffb}"),
    (16, 0x0094, "\u{fffa}FILE NAME\u{fffb}"),
    (17, 0x0084, "\u{fffa}PLAYLIST\u{fffb}"),
    (18, 0x0098, "\u{fffa}HOT CUE BANK\u{fffb}"),
    (19, 0x0095, "\u{fffa}HISTORY\u{fffb}"),
    (20, 0x0091, "\u{fffa}SEARCH\u{fffb}"),
    (21, 0x0096, "\u{fffa}COMMENTS\u{fffb}"),
    (22, 0x008c, "\u{fffa}DATE ADDED\u{fffb}"),
    (23, 0x0097, "\u{fffa}DJ PLAY COUNT\u{fffb}"),
    (24, 0x0090, "\u{fffa}FOLDER\u{fffb}"),
    (25, 0x00a1, "\u{fffa}DEFAULT\u{fffb}"),
    (26, 0x00a2, "\u{fffa}ALPHABET\u{fffb}"),
    (27, 0x00aa, "\u{fffa}MATCHING\u{fffb}"),
];

/// The 8 colour rows (type 0x06) with rekordbox's default names. Users can
/// rename them in rekordbox; the XML carries only RGB, so defaults are used.
pub const COLORS: [(u8, &str, u32); 8] = [
    (1, "Pink", 0xFF007F),
    (2, "Red", 0xFF0000),
    (3, "Orange", 0xFFA500),
    (4, "Yellow", 0xFFFF00),
    (5, "Green", 0x00FF00),
    (6, "Aqua", 0x25FDE9),
    (7, "Blue", 0x0000FF),
    (8, "Purple", 0x660099),
];

/// Table 0x11: browse category configuration (defaults).
pub const CATEGORY_ROWS: [[u8; 8]; 22] = [
    [0x01, 0x00, 0x01, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x05, 0x00, 0x06, 0x00, 0x05, 0x01, 0x00, 0x00],
    [0x06, 0x00, 0x07, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x07, 0x00, 0x08, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x08, 0x00, 0x09, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x09, 0x00, 0x0a, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x0a, 0x00, 0x0b, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x0d, 0x00, 0x0f, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x0e, 0x00, 0x13, 0x00, 0x04, 0x01, 0x00, 0x00],
    [0x0f, 0x00, 0x14, 0x00, 0x06, 0x01, 0x00, 0x00],
    [0x10, 0x00, 0x15, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x12, 0x00, 0x17, 0x00, 0x63, 0x01, 0x00, 0x00],
    [0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00],
    [0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x02, 0x00],
    [0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x03, 0x00],
    [0x0b, 0x00, 0x0c, 0x00, 0x63, 0x00, 0x04, 0x00],
    [0x11, 0x00, 0x05, 0x00, 0x63, 0x00, 0x05, 0x00],
    [0x13, 0x00, 0x16, 0x00, 0x63, 0x00, 0x06, 0x00],
    [0x14, 0x00, 0x12, 0x00, 0x63, 0x00, 0x07, 0x00],
    [0x1b, 0x00, 0x1a, 0x00, 0x63, 0x02, 0x08, 0x00],
    [0x18, 0x00, 0x11, 0x00, 0x63, 0x00, 0x09, 0x00],
    [0x16, 0x00, 0x1b, 0x00, 0x63, 0x00, 0x0a, 0x00],
];

/// Table 0x12: sort configuration (defaults).
pub const SORT_ROWS: [[u8; 8]; 17] = [
    [0x01, 0x00, 0x06, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x15, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x0e, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x08, 0x00, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x09, 0x00, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x0a, 0x00, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x0f, 0x00, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x0d, 0x00, 0x0f, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x17, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x16, 0x00, 0x11, 0x00, 0x01, 0x00, 0x00, 0x00],
    [0x19, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00],
    [0x1a, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00],
    [0x02, 0x00, 0x02, 0x00, 0x00, 0x03, 0x00, 0x00],
    [0x03, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00],
    [0x05, 0x00, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00],
    [0x06, 0x00, 0x05, 0x00, 0x00, 0x06, 0x00, 0x00],
    [0x0b, 0x00, 0x0c, 0x00, 0x00, 0x07, 0x00, 0x00],
];