00001 /* 00002 * Copyright (C) 2003-2011 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 /* 00021 * Maps directory and song objects to file system paths. 00022 */ 00023 00024 #ifndef MPD_MAPPER_H 00025 #define MPD_MAPPER_H 00026 00027 #include <glib.h> 00028 #include <stdbool.h> 00029 00030 #define PLAYLIST_FILE_SUFFIX ".m3u" 00031 00032 struct directory; 00033 struct song; 00034 00035 void mapper_init(const char *_music_dir, const char *_playlist_dir); 00036 00037 void mapper_finish(void); 00038 00042 G_GNUC_CONST 00043 const char * 00044 mapper_get_music_directory_utf8(void); 00045 00050 G_GNUC_CONST 00051 const char * 00052 mapper_get_music_directory_fs(void); 00053 00057 G_GNUC_CONST 00058 static inline bool 00059 mapper_has_music_directory(void) 00060 { 00061 return mapper_get_music_directory_utf8() != NULL; 00062 } 00063 00069 G_GNUC_PURE 00070 const char * 00071 map_to_relative_path(const char *path_utf8); 00072 00078 G_GNUC_MALLOC 00079 char * 00080 map_uri_fs(const char *uri); 00081 00088 G_GNUC_MALLOC 00089 char * 00090 map_directory_fs(const struct directory *directory); 00091 00100 G_GNUC_MALLOC 00101 char * 00102 map_directory_child_fs(const struct directory *directory, const char *name); 00103 00111 G_GNUC_MALLOC 00112 char * 00113 map_song_fs(const struct song *song); 00114 00122 G_GNUC_MALLOC 00123 char * 00124 map_fs_to_utf8(const char *path_fs); 00125 00129 G_GNUC_CONST 00130 const char * 00131 map_spl_path(void); 00132 00140 G_GNUC_PURE 00141 char * 00142 map_spl_utf8_to_fs(const char *name); 00143 00144 #endif