00001 /* 00002 * Copyright (C) 2003-2009 The Music Player Daemon Project 00003 * http://www.musicpd.org 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, write to the Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 */ 00019 00020 #ifndef MPD_SONG_H 00021 #define MPD_SONG_H 00022 00023 #include <stddef.h> 00024 #include <stdbool.h> 00025 #include <sys/time.h> 00026 00027 #define SONG_BEGIN "songList begin" 00028 #define SONG_END "songList end" 00029 00030 #define SONG_FILE "file: " 00031 #define SONG_TIME "Time: " 00032 00033 struct song { 00034 struct tag *tag; 00035 struct directory *parent; 00036 time_t mtime; 00037 char url[sizeof(int)]; 00038 }; 00039 00041 struct song * 00042 song_remote_new(const char *url); 00043 00045 struct song * 00046 song_file_new(const char *path, struct directory *parent); 00047 00053 struct song * 00054 song_file_load(const char *path, struct directory *parent); 00055 00056 void 00057 song_free(struct song *song); 00058 00059 bool 00060 song_file_update(struct song *song); 00061 00062 bool 00063 song_file_update_inarchive(struct song *song); 00064 00072 char * 00073 song_get_uri(const struct song *song); 00074 00075 static inline bool 00076 song_in_database(const struct song *song) 00077 { 00078 return song->parent != NULL; 00079 } 00080 00081 static inline bool 00082 song_is_file(const struct song *song) 00083 { 00084 return song_in_database(song) || song->url[0] == '/'; 00085 } 00086 00087 #endif