directory.h 1.92 KB
Newer Older
Warren Dukes's avatar
Warren Dukes committed
1
/* the Music Player Daemon (MPD)
2
 * Copyright (C) 2003-2007 by Warren Dukes (warren.dukes@gmail.com)
Warren Dukes's avatar
Warren Dukes committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * 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 DIRECTORY_H
#define DIRECTORY_H

22 23
#include "../config.h"

Warren Dukes's avatar
Warren Dukes committed
24
#include "song.h"
25
#include "list.h"
Warren Dukes's avatar
Warren Dukes committed
26

27 28 29 30 31 32 33 34
typedef List DirectoryList;

typedef struct _DirectoryStat {
	ino_t inode;
	dev_t device;
} DirectoryStat;

typedef struct _Directory {
Avuton Olrich's avatar
Avuton Olrich committed
35 36 37 38 39
	char *path;
	DirectoryList *subDirectories;
	SongList *songs;
	struct _Directory *parent;
	DirectoryStat *stat;
40 41
} Directory;

42
void readDirectoryDBIfUpdateIsFinished(void);
43

44
int isUpdatingDB(void);
45

46 47
void directory_sigChldHandler(int pid, int status);

48
int updateInit(int fd, List * pathList);
49

50
void initMp3Directory(void);
Warren Dukes's avatar
Warren Dukes committed
51

52
void closeMp3Directory(void);
Warren Dukes's avatar
Warren Dukes committed
53

Max Kellermann's avatar
Max Kellermann committed
54
int isRootDirectory(const char *name);
55

Max Kellermann's avatar
Max Kellermann committed
56
int printDirectoryInfo(int fd, const char *dirname);
Warren Dukes's avatar
Warren Dukes committed
57

58
int checkDirectoryDB(void);
59

60
int writeDirectoryDB(void);
Warren Dukes's avatar
Warren Dukes committed
61

62
int readDirectoryDB(void);
Warren Dukes's avatar
Warren Dukes committed
63

64
void updateMp3Directory(void);
Warren Dukes's avatar
Warren Dukes committed
65

Avuton Olrich's avatar
Avuton Olrich committed
66
Song *getSongFromDB(char *file);
Warren Dukes's avatar
Warren Dukes committed
67

68
time_t getDbModTime(void);
Warren Dukes's avatar
Warren Dukes committed
69

70 71 72
int traverseAllIn(int fd, char *name,
		  int (*forEachSong) (int, Song *, void *),
		  int (*forEachDir) (int, Directory *, void *), void *data);
73

74
#define getDirectoryPath(dir) ((dir && dir->path) ? dir->path : "")
75

Warren Dukes's avatar
Warren Dukes committed
76
#endif