diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-10 02:38:31 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-10 02:38:31 +0000 |
commit | ec234e985563316d725c7a8b8873f2c34e4d4635 (patch) | |
tree | a91cc7765db20d0a5c1815d211246cad3abb438f /src/tag.c | |
parent | 1459ee22fe0aee6aa754d3bbb56e76840f4ee1c1 (diff) | |
download | mpd-ec234e985563316d725c7a8b8873f2c34e4d4635.tar.gz mpd-ec234e985563316d725c7a8b8873f2c34e4d4635.tar.xz mpd-ec234e985563316d725c7a8b8873f2c34e4d4635.zip |
move time from tag info to song info.
also, if we can't get the time, then don't add the song to the db!
git-svn-id: https://svn.musicpd.org/mpd/trunk@236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/tag.c')
-rw-r--r-- | src/tag.c | 33 |
1 files changed, 2 insertions, 31 deletions
@@ -20,8 +20,6 @@ #include "path.h" #include "myfprintf.h" #include "sig_handlers.h" -#include "mp3_decode.h" -#include "audiofile_decode.h" #include "utils.h" #include <sys/stat.h> @@ -50,7 +48,6 @@ void printMpdTag(FILE * fp, MpdTag * tag) { if(tag->album) myfprintf(fp,"Album: %s\n",tag->album); if(tag->track) myfprintf(fp,"Track: %s\n",tag->track); if(tag->title) myfprintf(fp,"Title: %s\n",tag->title); - if(tag->time>=0) myfprintf(fp,"Time: %i\n",tag->time); } #ifdef HAVE_ID3TAG @@ -138,13 +135,7 @@ MpdTag * id3Dup(char * utf8filename) { #ifdef HAVE_AUDIOFILE MpdTag * audiofileTagDup(char * utf8file) { MpdTag * ret = NULL; - int time = getAudiofileTotalTime(rmp2amp(utf8ToFsCharset(utf8file))); - if (time>=0) { - if(!ret) ret = newMpdTag(); - ret->time = time; - } - return ret; } #endif @@ -152,17 +143,9 @@ MpdTag * audiofileTagDup(char * utf8file) { #ifdef HAVE_MAD MpdTag * mp3TagDup(char * utf8file) { MpdTag * ret = NULL; - int time; ret = id3Dup(utf8file); - time = getMp3TotalTime(rmp2amp(utf8ToFsCharset(utf8file))); - - if(time>=0) { - if(!ret) ret = newMpdTag(); - ret->time = time; - } - return ret; } #endif @@ -188,7 +171,6 @@ MpdTag * oggTagDup(char * utf8file) { } ret = newMpdTag(); - ret->time = (int)(ov_time_total(&vf,-1)+0.5); comments = ov_comment(&vf,-1)->user_comments; @@ -315,10 +297,6 @@ MpdTag * flacMetadataDup(char * utf8file, int * vorbisCommentFound) { } else if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { if(!ret) ret = newMpdTag(); - ret->time = ((float)block->data.stream_info. - total_samples) / - block->data.stream_info.sample_rate + - 0.5; } FLAC__metadata_object_delete(block); } while(FLAC__metadata_simple_iterator_next(it)); @@ -333,14 +311,9 @@ MpdTag * flacTagDup(char * utf8file) { int foundVorbisComment = 0; ret = flacMetadataDup(utf8file,&foundVorbisComment); - if(!ret) return NULL; if(!foundVorbisComment) { - MpdTag * temp = id3Dup(utf8file); - if(temp) { - temp->time = ret->time; - freeMpdTag(ret); - ret = temp; - } + if(ret) freeMpdTag(ret); + ret = id3Dup(utf8file); } return ret; @@ -353,7 +326,6 @@ MpdTag * newMpdTag() { ret->artist = NULL; ret->title = NULL; ret->track = NULL; - ret->time = -1; return ret; } @@ -374,7 +346,6 @@ MpdTag * mpdTagDup(MpdTag * tag) { ret->album = strdup(tag->album); ret->title = strdup(tag->title); ret->track = strdup(tag->track); - ret->time = tag->time; } return ret; |