2008-05-21 11:19:58 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Dave Chapman
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-05-21 11:19:58 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
|
|
|
#include "system.h"
|
2008-10-15 06:38:51 +00:00
|
|
|
#include "metadata.h"
|
2008-05-21 11:19:58 +00:00
|
|
|
#include "metadata_common.h"
|
2008-05-28 17:10:49 +00:00
|
|
|
#include "metadata_parsers.h"
|
2008-05-21 11:19:58 +00:00
|
|
|
#include "rbunicode.h"
|
|
|
|
|
|
|
|
bool get_mod_metadata(int fd, struct mp3entry* id3)
|
|
|
|
{
|
|
|
|
/* Use the trackname part of the id3 structure as a temporary buffer */
|
|
|
|
unsigned char buf[1084];
|
|
|
|
int read_bytes;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
|
|
|
|
if ((lseek(fd, 0, SEEK_SET) < 0)
|
|
|
|
|| ((read_bytes = read(fd, buf, sizeof(buf))) < 1084))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We don't do file format checking here
|
|
|
|
* There can be .mod files without any signatures out there */
|
|
|
|
|
|
|
|
p = id3->id3v2buf;
|
|
|
|
|
2010-10-10 10:24:50 +00:00
|
|
|
/* Copy Title */
|
2008-05-21 11:19:58 +00:00
|
|
|
strcpy(p, &buf[0x00]);
|
2010-10-10 10:24:50 +00:00
|
|
|
id3->title = p;
|
2008-05-21 11:19:58 +00:00
|
|
|
p += strlen(p)+1;
|
|
|
|
|
|
|
|
id3->bitrate = filesize(fd)/1024; /* size in kb */
|
|
|
|
id3->frequency = 44100;
|
|
|
|
id3->length = 120*1000;
|
|
|
|
id3->vbr = false;
|
|
|
|
id3->filesize = filesize(fd);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|