diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-17 17:30:50 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-17 17:30:50 +0000 |
commit | 9a7636f5bc50fdff56012a38076ec51d3b671711 (patch) | |
tree | 8d938207f03b1a575d70e535e039975d2bd916fa /src/ls.c | |
parent | b2b700a87d33eb536f33e59b286f8bd3e240486e (diff) | |
download | mpd-9a7636f5bc50fdff56012a38076ec51d3b671711.tar.gz mpd-9a7636f5bc50fdff56012a38076ec51d3b671711.tar.xz mpd-9a7636f5bc50fdff56012a38076ec51d3b671711.zip |
have AAC and MP4 types
git-svn-id: https://svn.musicpd.org/mpd/trunk@267 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/ls.c')
-rw-r--r-- | src/ls.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -127,6 +127,7 @@ int isMusic(char * utf8file, time_t * mtime) { #endif #ifdef HAVE_FAAD if((ret = isAac(utf8file,mtime))) return ret; + if((ret = isMp4(utf8file,mtime))) return ret; #endif return ret; @@ -249,6 +250,37 @@ int isOgg(char * utf8file, time_t * mtime) { return 0; } +int isMp4(char * utf8file, time_t * mtime) { + struct stat st; + char * file = utf8ToFsCharset(utf8file); + char * actualFile = file; + + if(actualFile[0]!='/') actualFile = rmp2amp(file); + + if(stat(actualFile,&st)==0) { + if(S_ISREG(st.st_mode)) { + char * dup; + char * cLast; + char * cNext; + int ret = 0; + dup = strdup(file); + cNext = cLast = strtok(dup,"."); + while((cNext = strtok(NULL,"."))) cLast = cNext; + if(cLast && (0==strcasecmp(cLast,"m4a") || + 0==strcasecmp(cLast,"mp4"))) + { + if(mtime) *mtime = st.st_mtime; + ret = 1; + } + free(dup); + return ret; + } + else return 0; + } + + return 0; +} + int isAac(char * utf8file, time_t * mtime) { struct stat st; char * file = utf8ToFsCharset(utf8file); |