Fix Pacbox controls for D2 touchscreen
[Rockbox.git] / apps / metadata / mod.c
blob0205fd04bff274ce48969a61aa51cb33a6abb8fa
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 Dave Chapman
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include <stdio.h>
20 #include <string.h>
21 #include <stdlib.h>
22 #include <ctype.h>
23 #include <inttypes.h>
25 #include "system.h"
26 #include "id3.h"
27 #include "metadata_common.h"
28 #include "rbunicode.h"
30 bool get_mod_metadata(int fd, struct mp3entry* id3)
32 /* Use the trackname part of the id3 structure as a temporary buffer */
33 unsigned char buf[1084];
34 int read_bytes;
35 char *p;
38 if ((lseek(fd, 0, SEEK_SET) < 0)
39 || ((read_bytes = read(fd, buf, sizeof(buf))) < 1084))
41 return false;
44 /* We don't do file format checking here
45 * There can be .mod files without any signatures out there */
47 p = id3->id3v2buf;
49 /* Copy Title as artist */
50 strcpy(p, &buf[0x00]);
51 id3->artist = p;
52 p += strlen(p)+1;
54 id3->bitrate = filesize(fd)/1024; /* size in kb */
55 id3->frequency = 44100;
56 id3->length = 120*1000;
57 id3->vbr = false;
58 id3->filesize = filesize(fd);
60 return true;