Convert album_artist tag to albumartist
[cmus.git] / cmus.h
blob3212431a91e82fa303923a1b107a7ea138a468ec
1 #ifndef _CMUS_H
2 #define _CMUS_H
4 #include "track_db.h"
6 /*
7 * these types are only used to determine what jobs we should cancel.
8 * for example ":load" cancels jobs for the current view before loading
9 * new playlist.
12 #define JOB_TYPE_LIB 1
13 #define JOB_TYPE_PL 2
14 #define JOB_TYPE_QUEUE 3
16 enum file_type {
17 /* not found, device file... */
18 FILE_TYPE_INVALID,
20 FILE_TYPE_URL,
21 FILE_TYPE_PL,
22 FILE_TYPE_DIR,
23 FILE_TYPE_FILE
26 typedef int (*track_info_cb)(void *data, struct track_info *ti);
28 /* lib_for_each, pl_for_each */
29 typedef int (*for_each_ti_cb)(track_info_cb cb, void *data);
31 /* lib_for_each_sel, pl_for_each_sel, play_queue_for_each_sel */
32 typedef int (*for_each_sel_ti_cb)(track_info_cb cb, void *data, int reverse);
34 /* lib_add_track, pl_add_track, play_queue_append, play_queue_prepend */
35 typedef void (*add_ti_cb)(struct track_info *);
37 int cmus_init(void);
38 void cmus_exit(void);
39 void cmus_play_file(const char *filename);
41 /* detect file type, returns absolute path or url in @ret */
42 enum file_type cmus_detect_ft(const char *name, char **ret);
44 /* add to library, playlist or queue view
46 * @add callback that does the actual adding
47 * @name playlist, directory, file, URL
48 * @ft detected FILE_TYPE_*
49 * @jt JOB_TYPE_{LIB,PL,QUEUE}
51 * returns immediately, actual work is done in the worker thread.
53 void cmus_add(add_ti_cb, const char *name, enum file_type ft, int jt);
55 int cmus_save(for_each_ti_cb for_each_ti, const char *filename);
57 void cmus_update_lib(void);
58 void cmus_update_tis(struct track_info **tis, int nr);
60 struct track_info *cmus_get_track_info(const char *name);
62 int cmus_is_playlist(const char *filename);
63 int cmus_is_playable(const char *filename);
64 int cmus_is_supported(const char *filename);
66 int cmus_playlist_for_each(const char *buf, int size, int reverse,
67 int (*cb)(void *data, const char *line),
68 void *data);
70 void cmus_next(void);
71 void cmus_prev(void);
73 #endif