Handle streams separately in tree_add_track()
[cmus.git] / track_info.h
blobf458f3f273e13a77d0c59ee94321ef3cb40c2a79
1 /*
2 * Copyright 2004-2005 Timo Hirvonen
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17 * 02111-1307, USA.
20 #ifndef _TRACK_INFO_H
21 #define _TRACK_INFO_H
23 #include <time.h>
25 struct track_info {
26 struct keyval *comments;
28 // next track_info in the hash table (cache.c)
29 struct track_info *next;
31 time_t mtime;
32 int duration;
33 int ref;
34 char filename[0];
37 #define TI_MATCH_ARTIST (1 << 0)
38 #define TI_MATCH_ALBUM (1 << 1)
39 #define TI_MATCH_TITLE (1 << 2)
41 /* initializes only filename and ref */
42 extern struct track_info *track_info_new(const char *filename);
44 extern struct track_info *track_info_url_new(const char *url);
46 extern void track_info_ref(struct track_info *ti);
47 extern void track_info_unref(struct track_info *ti);
50 * returns: 1 if @ti has any of the following tags: artist, album, title
51 * 0 otherwise
53 extern int track_info_has_tag(const struct track_info *ti);
56 * @flags: TI_MATCH_*
58 * returns: 1 if all words in @text are found to match defined fields (@flags) in @ti
59 * 0 otherwise
61 extern int track_info_matches(struct track_info *ti, const char *text, unsigned int flags);
63 int track_info_cmp(const struct track_info *a, const struct track_info *b, const char * const *keys);
65 #endif