2004-02-24 00:41:20 +01:00
|
|
|
/* the Music Player Daemon (MPD)
|
2007-04-05 05:22:33 +02:00
|
|
|
* Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
|
2004-02-24 00:41:20 +01:00
|
|
|
* This project's homepage is: http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SONG_H
|
|
|
|
#define SONG_H
|
|
|
|
|
2008-10-08 11:03:39 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
2008-10-08 10:49:29 +02:00
|
|
|
#include <sys/time.h>
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2004-11-11 01:41:28 +01:00
|
|
|
#define SONG_BEGIN "songList begin"
|
|
|
|
#define SONG_END "songList end"
|
|
|
|
|
2006-10-28 01:07:34 +02:00
|
|
|
#define SONG_FILE "file: "
|
|
|
|
#define SONG_TIME "Time: "
|
|
|
|
|
2008-10-08 10:49:11 +02:00
|
|
|
struct song {
|
2008-08-29 09:38:11 +02:00
|
|
|
struct tag *tag;
|
2008-10-08 11:05:34 +02:00
|
|
|
struct directory *parent;
|
2004-02-24 00:41:20 +01:00
|
|
|
time_t mtime;
|
2008-10-08 10:49:29 +02:00
|
|
|
char url[sizeof(int)];
|
2008-10-08 10:49:11 +02:00
|
|
|
};
|
2008-10-06 18:46:52 +02:00
|
|
|
|
2008-10-08 11:05:25 +02:00
|
|
|
/** allocate a new song with a remote URL */
|
2008-10-08 10:49:11 +02:00
|
|
|
struct song *
|
2008-10-08 11:05:25 +02:00
|
|
|
song_remote_new(const char *url);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-10-08 11:05:25 +02:00
|
|
|
/** allocate a new song with a local file name */
|
2008-10-08 10:49:11 +02:00
|
|
|
struct song *
|
2008-10-08 11:05:25 +02:00
|
|
|
song_file_new(const char *path, struct directory *parent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* allocate a new song structure with a local file name and attempt to
|
|
|
|
* load its metadata. If all decoder plugin fail to read its meta
|
|
|
|
* data, NULL is returned.
|
|
|
|
*/
|
|
|
|
struct song *
|
|
|
|
song_file_load(const char *path, struct directory *parent);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-10-08 10:49:11 +02:00
|
|
|
void
|
2008-10-08 11:05:34 +02:00
|
|
|
song_free(struct song *song);
|
2004-05-13 20:46:38 +02:00
|
|
|
|
2008-10-08 11:06:26 +02:00
|
|
|
bool
|
2008-10-08 11:05:34 +02:00
|
|
|
song_file_update(struct song *song);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-04-12 06:08:18 +02:00
|
|
|
/*
|
2008-10-08 11:05:34 +02:00
|
|
|
* song_get_url - Returns a path of a song in UTF8-encoded form
|
2008-04-12 06:08:18 +02:00
|
|
|
* path_max_tmp is the argument that the URL is written to, this
|
|
|
|
* buffer is assumed to be MPD_PATH_MAX or greater (including
|
|
|
|
* terminating '\0').
|
|
|
|
*/
|
2008-10-08 10:49:11 +02:00
|
|
|
char *
|
2008-10-14 11:10:44 +02:00
|
|
|
song_get_url(const struct song *song, char *path_max_tmp);
|
2004-11-11 03:36:25 +01:00
|
|
|
|
2008-10-08 11:03:39 +02:00
|
|
|
static inline bool
|
2008-10-08 10:49:11 +02:00
|
|
|
song_is_file(const struct song *song)
|
2008-10-06 18:52:13 +02:00
|
|
|
{
|
2008-10-08 11:05:34 +02:00
|
|
|
return song->parent != NULL;
|
2008-10-06 18:52:13 +02:00
|
|
|
}
|
|
|
|
|
2004-02-24 00:41:20 +01:00
|
|
|
#endif
|