new db format; dir lister now has sane defaults w/o filters
[k8muffin.git] / dox / tagdb_fmt.txt
blob59187b6fa2d5af0b6c603655a1d37b40dc75c626
1 'dq' means uint64_t
3 stringidx is just an offset in 'string data'; all strings are 0-terminated;
4 before each string one can find it's length without trailing zero as dw.
7 #ifndef USE_DEVID_INODE
8 db 'MTD0'
9 #else
10 db 'MTD2'
11 #endif
12 dd file_count
13 dd tag_count
14 dd string_bytes  ; # of bytes in 'string data'
15 dd ofs_bytes     ; # of bytes in 'offsets'
16 dd o_tag_count   ; # of 'original' tags
17 dd t_tag_count   ; # of 'transliterated' tags
20 string data (see above):
21 db ?(string_bytes)
24 tag lists (for 'original' and for 'transliterated'):
25 ; offsets in tag block
26 dd tagidx(o_tag_count)
27 dd tagidx(t_tag_count)
30 file info (for each file, names should be unique):
31 dd real_name_stringidx
32 dd short_name_stringidx      ; this MUST be unique, it's used as 'file id' everywhere
33 ; file info (this fields are taken from stat() directly)
34 #ifdef USE_DEVID_INODE       ; devid and inode are obsolete
35 dq devid                     ; can be 0, it means 'undefined/unknown'
36 dq inode                     ; can be 0, it means 'undefined/unknown'
37 #endif
38 dq size                      ; can be 0, it means 'undefined/unknown'
39 dq mtime                     ; can be 0, it means 'undefined/unknown'
40 db tracknum                  ; 0: unknown; this can be used to generate short file names
41 dw year                      ; 0: unknown; else: must be already normalized
42 dd year_tagid                ; yes, years have their own textual tags, along with 'unknown year'
43 ; pair of tags; there can't be undefined tags, all undefined ones will be mapped to 'unknown_xxx'
44 ; this is INDICIES
45 dd artist_o, artist_t
46 dd album_o, album_t
47 dd title_o, title_t
48 dd genre_o, genre_t
49 dd yral_o, yeal_t  ; 'year album' and 'year_album'
52 tag info (for each tag, names should be unique), repeats twice -- first for 'o', then for 't':
53 dd name_stringidx
54 the following repeats 9 times, for year, artist_o, artist_t, album_o, album_t, title_o, title_t, genre_o, genre_t:
55  dd used_count           ; # of files that used this tag at least once
56  dd ofsidx               ; index in 'offsets'
59 ofs info (offsets):
60 dd fileidx(ofs_bytes/4)
63 this way we can simply mmap the whole tagdb if fusedrv.
65 note that badly crafted file will certainly crash the driver. i don't care. just don't trust other people
66 files (why you should use such files anyway? build your own database!)