diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 00:41:28 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-11-11 00:41:28 +0000 |
commit | 03f02badf02adba317f6358bc0e1ebf669b48204 (patch) | |
tree | 9ef4d938f7e8f9d9cef200bf74e7b0577c6fe09a /src/song.c | |
parent | 01b494a85245c589ae6369ef75608743b2f73149 (diff) | |
download | mpd-03f02badf02adba317f6358bc0e1ebf669b48204.tar.gz mpd-03f02badf02adba317f6358bc0e1ebf669b48204.tar.xz mpd-03f02badf02adba317f6358bc0e1ebf669b48204.zip |
this is broken
git-svn-id: https://svn.musicpd.org/mpd/trunk@2597 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/song.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/song.c b/src/song.c index 462a434cc..44afcbe4c 100644 --- a/src/song.c +++ b/src/song.c @@ -40,11 +40,12 @@ Song * newNullSong() { song->tag = NULL; song->utf8url = NULL; song->type = SONG_TYPE_FILE; + song->parentDir = NULL; return song; } -Song * newSong(char * utf8url, SONG_TYPE type) { +Song * newSong(char * url, int type, Directory * parentDir) { Song * song = NULL; if(strchr(utf8url, '\n')) return NULL; @@ -53,6 +54,9 @@ Song * newSong(char * utf8url, SONG_TYPE type) { song->utf8url = strdup(utf8url); song->type = type; + song->parentDir = parentDir; + + assert(type == SONG_TYPE_URL || parentDir); if(song->type == SONG_TYPE_FILE) { InputPlugin * plugin; @@ -86,25 +90,25 @@ SongList * newSongList() { return makeList((ListFreeDataFunc *)freeSong); } -Song * addSongToList(SongList * list, char * key, char * utf8url, - SONG_TYPE type) +Song * addSongToList(SongList * list, char * url, int songType, + Directory * parentDirectory) { Song * song = NULL; switch(type) { case SONG_TYPE_FILE: if(isMusic(utf8url,NULL)) { - song = newSong(utf8url,type); + song = newSong(url, type, parentDirectory); } break; case SONG_TYPE_URL: - song = newSong(utf8url,type); + song = newSong(utf8url, type, parentDirectory); break; } if(song==NULL) return NULL; - insertInList(list,key,(void *)song); + insertInList(list, url, (void *)song); return song; } @@ -113,8 +117,18 @@ void freeSongList(SongList * list) { freeList(list); } +void printSongUrl(FILE * fp, Song * song) { + if(song->parentDir) { + myfprintf(fp, "%s%s%s\n", SONG_FILE, song->parentDir->utf8name, + song->url); + } + else { + myfprintf(fp, "%s%s\n", SONG_FILE, song->url); + } +} + int printSongInfo(FILE * fp, Song * song) { - myfprintf(fp,"%s%s\n",SONG_FILE,song->utf8url); + printSongUrl(fp, song); if(song->tag) printMpdTag(fp,song->tag); |