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
12 #define JOB_TYPE_LIB 1
14 #define JOB_TYPE_QUEUE 3
17 /* not found, device 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
*);
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
),