data.h (2006B)
1#pragma once 2 3#include "list.h" 4 5#include <stdbool.h> 6 7struct tag { 8 char *name, *fpath; 9 struct list tracks; 10 bool index_dirty; 11 bool reordered; 12 13 struct list_link link; /* tags list */ 14 struct list_link link_sel; /* selected tags list */ 15}; 16 17struct track { 18 char *name, *fpath; 19 struct tag *tag; 20 21 struct list_link link; /* tracks list */ 22 struct list_link link_pl; /* player playlist */ 23 struct list_link link_tt; /* tag tracks list */ 24 struct list_link link_pq; /* player queue */ 25 struct list_link link_hs; /* player history */ 26}; 27 28bool path_exists(const char *path); 29bool make_dir(const char *path); 30bool move_dir(const char *dst, const char *src); 31bool rm_dir(const char *path, bool recursive); 32bool rm_file(const char *path); 33bool copy_file(const char *dst, const char *src); 34bool dup_file(const char *dst, const char *src); 35bool move_file(const char *dst, const char *src); 36 37struct track *tracks_vis_track(struct list_link *link); 38 39void playlist_clear(void); 40void playlist_update(void); 41 42struct tag *tag_create(const char *fname); 43struct tag *tag_add(const char *fname); 44struct tag *tag_find(const char *name); 45bool tag_rm(struct tag *tag, bool sync_fs); 46bool tag_rename(struct tag *tag, const char *name); 47 48void tag_clear_tracks(struct tag *tag); 49void tag_load_tracks(struct tag *tag); 50void tag_save_tracks(struct tag *tag); 51bool tag_reindex_tracks(struct tag *tag); 52 53struct track *track_add(struct tag *tag, const char *fname); 54bool track_rm(struct track *track, bool sync_fs); 55bool track_rename(struct track *track, const char *name); 56bool track_move(struct track *track, struct tag *tag); 57 58bool acquire_lock(const char *path); 59bool release_lock(const char *path); 60 61void data_load(void); 62void data_save(void); 63void data_free(void); 64 65extern const char *datadir; 66 67extern struct list tracks; /* struct track (link) */ 68extern struct list tags; /* struct track (link) */ 69extern struct list tags_sel; /* struct tag (link_sel) */ 70 71extern struct tag *trash_tag; 72 73extern bool playlist_outdated;