diff options
-rw-r--r-- | src/ls.c | 30 | ||||
-rw-r--r-- | src/ls.h | 20 | ||||
-rw-r--r-- | src/player.c | 14 | ||||
-rw-r--r-- | src/song.c | 28 |
4 files changed, 32 insertions, 60 deletions
@@ -155,58 +155,28 @@ int hasWaveSuffix(char * utf8file) { return hasSuffix(utf8file,"wav"); } -int isWave(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasWaveSuffix(utf8file); - return 0; -} - int hasFlacSuffix(char * utf8file) { return hasSuffix(utf8file,"flac"); } -int isFlac(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasFlacSuffix(utf8file); - return 0; -} - int hasOggSuffix(char * utf8file) { return hasSuffix(utf8file,"ogg"); } -int isOgg(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasOggSuffix(utf8file); - return 0; -} - int hasAacSuffix(char * utf8file) { return hasSuffix(utf8file,"aac"); } -int isAac(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasAacSuffix(utf8file); - return 0; -} - int hasMp4Suffix(char * utf8file) { if(hasSuffix(utf8file,"mp4")) return 1; if(hasSuffix(utf8file,"m4a")) return 1; return 0; } -int isMp4(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasMp4Suffix(utf8file); - return 0; -} - int hasMp3Suffix(char * utf8file) { return hasSuffix(utf8file,"mp3"); } -int isMp3(char * utf8file, time_t * mtime) { - if(isFile(utf8file,mtime)) return hasMp3Suffix(utf8file); - return 0; -} - int isDir(char * utf8name, time_t * mtime) { struct stat st; @@ -26,23 +26,25 @@ int lsPlaylists(FILE * fp, char * utf8path); -int isMp3(char * utf8file, time_t * mtime); +int isFile(char * utf8file, time_t * mtime); -int isAac(char * utf8file, time_t * mtime); +int isDir(char * utf8name, time_t * mtime); -int isMp4(char * utf8file, time_t * mtime); +int isPlaylist(char * utf8file); -int isOgg(char * utf8file, time_t * mtime); +int isMusic(char * utf8file, time_t * mtime); -int isFlac(char * utf8file, time_t * mtime); +int hasWaveSuffix(char * utf8file); -int isWave(char * utf8file, time_t * mtime); +int hasMp3Suffix(char * utf8file); -int isMusic(char * utf8file, time_t * mtime); +int hasAacSuffix(char * utf8file); -int isDir(char * utf8name, time_t * mtime); +int hasMp4Suffix(char * utf8file); -int isPlaylist(char * utf8file); +int hasOggSuffix(char * utf8file); + +int hasFlacSuffix(char * utf8file); char * dupAndStripPlaylistSuffix(char * file); diff --git a/src/player.c b/src/player.c index 19693c2c3..138a54a49 100644 --- a/src/player.c +++ b/src/player.c @@ -150,22 +150,22 @@ int playerInit() { } int playerGetDecodeType(char * utf8file) { - if(0); + if(!isFile(utf8file,NULL)); #ifdef HAVE_MAD - if(isMp3(utf8file,NULL)) return DECODE_TYPE_MP3; + else if(hasMp3Suffix(utf8file)) return DECODE_TYPE_MP3; #endif #ifdef HAVE_OGG - if(isOgg(utf8file,NULL)) return DECODE_TYPE_OGG; + else if(hasOggSuffix(utf8file)) return DECODE_TYPE_OGG; #endif #ifdef HAVE_FLAC - if(isFlac(utf8file,NULL)) return DECODE_TYPE_FLAC; + else if(hasFlacSuffix(utf8file)) return DECODE_TYPE_FLAC; #endif #ifdef HAVE_AUDIOFILE - if(isWave(utf8file,NULL)) return DECODE_TYPE_AUDIOFILE; + else if(hasWaveSuffix(utf8file)) return DECODE_TYPE_AUDIOFILE; #endif #ifdef HAVE_FAAD - if(isAac(utf8file,NULL)) return DECODE_TYPE_AAC; - if(isMp4(utf8file,NULL)) return DECODE_TYPE_MP4; + else if(hasAacSuffix(utf8file)) return DECODE_TYPE_AAC; + else if(hasMp4Suffix(utf8file)) return DECODE_TYPE_MP4; #endif return -1; } diff --git a/src/song.c b/src/song.c index 377487cbd..c7186d1e0 100644 --- a/src/song.c +++ b/src/song.c @@ -57,32 +57,32 @@ Song * newSong(char * utf8file) { song->utf8file = strdup(utf8file); - if(0); + if(!isFile(utf8file,&(song->mtime))); #ifdef HAVE_OGG - else if(isOgg(utf8file,&(song->mtime))) { + else if(hasOggSuffix(utf8file)) { song->tag = oggTagDup(utf8file); } #endif #ifdef HAVE_FLAC - else if((isFlac(utf8file,&(song->mtime)))) { + else if((hasFlacSuffix(utf8file))) { song->tag = flacTagDup(utf8file); } #endif #ifdef HAVE_MAD - else if(isMp3(utf8file,&(song->mtime))) { + else if(hasMp3Suffix(utf8file)) { song->tag = mp3TagDup(utf8file); } #endif #ifdef HAVE_AUDIOFILE - else if(isWave(utf8file,&(song->mtime))) { + else if(hasWaveSuffix(utf8file)) { song->tag = audiofileTagDup(utf8file); } #endif #ifdef HAVE_FAAD - else if(isAac(utf8file,&(song->mtime))) { + else if(hasAacSuffix(utf8file)) { song->tag = aacTagDup(utf8file); } - else if(isMp4(utf8file,&(song->mtime))) { + else if(hasMp4Suffix(utf8file)) { song->tag = mp4TagDup(utf8file); } #endif @@ -227,32 +227,32 @@ int updateSongInfo(Song * song) { song->tag = NULL; - if(0); + if(!isFile(utf8file,&(song->mtime))); #ifdef HAVE_OGG - else if(isOgg(utf8file,&(song->mtime))) { + else if(hasOggSuffix(utf8file)) { song->tag = oggTagDup(utf8file); } #endif #ifdef HAVE_FLAC - else if((isFlac(utf8file,&(song->mtime)))) { + else if((hasFlacSuffix(utf8file))) { song->tag = flacTagDup(utf8file); } #endif #ifdef HAVE_MAD - else if(isMp3(utf8file,&(song->mtime))) { + else if(hasMp3Suffix(utf8file)) { song->tag = mp3TagDup(utf8file); } #endif #ifdef HAVE_AUDIOFILE - else if(isWave(utf8file,&(song->mtime))) { + else if(hasWaveSuffix(utf8file)) { song->tag = audiofileTagDup(utf8file); } #endif #ifdef HAVE_FAAD - else if(isAac(utf8file,&(song->mtime))) { + else if(hasAacSuffix(utf8file)) { song->tag = aacTagDup(utf8file); } - else if(isMp4(utf8file,&(song->mtime))) { + else if(hasMp4Suffix(utf8file)) { song->tag = mp4TagDup(utf8file); } #endif |