1#ifndef SCAN_H
2#define SCAN_H
3
4#include <stddef.h>
5#include <stdint.h>
6
7struct item {
8 uint64_t id;
9 char* path;
10};
11
12struct library {
13 struct item* items;
14 size_t len;
15 size_t cap;
16};
17
18/* Free all memory owned by a library
19 Safe to call multiple times */
20void scan_library_free(struct library* l);
21
22/* Build library by recursively scanning given directory
23 Returns 0=Success, -1=Failure */
24int scan_library(struct library* l, const char* root);
25
26/* Rescan given directory and replace current library contents
27 On success, old library contents are freed.
28 Returns 0=Success, -1=Failure */
29int scan_library_rescan(struct library* l, const char* root);
30
31#endif /* SCAN_H */
32