if(strcmp(id, "ptab")) return -1;
read(fd, &hdr->version, 2);
-
- /* FIXME: 0000 / 0003 */
- read(fd, unknown, 2);
-// fprintf(stderr, "%s: %02x %02x : %lx\n", debug_filename, unknown[0], unknown[1], *((guint16 *)unknown));
- ptb_read_string(fd, &hdr->title);
- ptb_read_string(fd, &hdr->artist);
-
- /* FIXME: REcord type ? */
- read(fd, unknown, 2);
-// fprintf(stderr, "%s: %02x %02x : %lx\n", debug_filename, unknown[0], unknown[1], *((guint16 *)unknown));
- ptb_read_string(fd, &hdr->album);
-
- /* d4 0700 00 */
- read(fd, unknown, 4);
- ptb_read_string(fd, &hdr->music_by);
- ptb_read_string(fd, &hdr->words_by);
- ptb_read_string(fd, &hdr->arranged_by);
- ptb_read_string(fd, &hdr->guitar_transcribed_by);
- ptb_read_string(fd, &hdr->bass_transcribed_by);
- ptb_read_string(fd, &hdr->lyrics);
- ptb_read_string(fd, &hdr->copyright);
+
+ read(fd, &hdr->classification, 1);
+
+ switch(hdr->classification) {
+ case CLASSIFICATION_SONG:
+ read(fd, unknown, 1); /* FIXME */
+ ptb_read_string(fd, &hdr->class_info.song.title);
+ ptb_read_string(fd, &hdr->class_info.song.artist);
+
+ read(fd, &hdr->class_info.song.release_type, 1);
+
+ switch(hdr->class_info.song.release_type) {
+ case RELEASE_TYPE_PR_AUDIO:
+ read(fd, &hdr->class_info.song.release_info.pr_audio.type, 1);
+ ptb_read_string(fd, &hdr->class_info.song.release_info.pr_audio.album_title);
+ read(fd, &hdr->class_info.song.release_info.pr_audio.year, 2);
+ read(fd, &hdr->class_info.song.release_info.pr_audio.is_live_recording, 1);
+ break;
+ case RELEASE_TYPE_PR_VIDEO:
+ ptb_read_string(fd, &hdr->class_info.song.release_info.pr_video.video_title);
+ read(fd, &hdr->class_info.song.release_info.pr_video.is_live_recording, 1);
+ break;
+ case RELEASE_TYPE_BOOTLEG:
+ ptb_read_string(fd, &hdr->class_info.song.release_info.bootleg.title);
+ read(fd, &hdr->class_info.song.release_info.bootleg.day, 2);
+ read(fd, &hdr->class_info.song.release_info.bootleg.month, 2);
+ read(fd, &hdr->class_info.song.release_info.bootleg.year, 2);
+ break;
+ case RELEASE_TYPE_UNRELEASED:
+ break;
+
+ default:
+ fprintf(stderr, "Unknown release type: %d\n", hdr->class_info.song.release_type);
+ break;
+ }
+
+ read(fd, &hdr->class_info.song.is_original_author_unknown, 1);
+ ptb_read_string(fd, &hdr->class_info.song.music_by);
+ ptb_read_string(fd, &hdr->class_info.song.words_by);
+ ptb_read_string(fd, &hdr->class_info.song.arranged_by);
+ ptb_read_string(fd, &hdr->class_info.song.guitar_transcribed_by);
+ ptb_read_string(fd, &hdr->class_info.song.bass_transcribed_by);
+ ptb_read_string(fd, &hdr->class_info.song.lyrics);
+ ptb_read_string(fd, &hdr->class_info.song.copyright);
ptb_read_string(fd, &hdr->guitar_notes);
ptb_read_string(fd, &hdr->bass_notes);
+ ptb_read_string(fd, &hdr->drum_notes);
+ break;
+ case CLASSIFICATION_LESSON:
+ ptb_read_string(fd, &hdr->class_info.lesson.title);
+ ptb_read_string(fd, &hdr->class_info.lesson.artist);
+ read(fd, &hdr->class_info.lesson.style, 2);
+ read(fd, &hdr->class_info.lesson.level, 1);
+ ptb_read_string(fd, &hdr->class_info.lesson.author);
+ ptb_read_string(fd, &hdr->guitar_notes);
+ ptb_read_string(fd, &hdr->class_info.lesson.copyright);
+ read(fd, unknown, 2); /* FIXME */
+ break;
+
+ default:
+ fprintf(stderr, "Unknown classification: %d\n", hdr->classification);
+ break;
- /* FIXME Integer indicating something ? */
- read(fd, unknown, 2);
-// fprintf(stderr, "%s: %02x %02x : %lx\n", debug_filename, unknown[0], unknown[1], *((guint16 *)unknown));
+ }
/* This should be 0xffff, ending the header */
read(fd, &header_end, 2);
return NULL;
}
- debugging = 1;
-
while(lseek(bf->fd, 0, SEEK_CUR) < bf->st_buf.st_size) {
guint16 unknownval;
guint16 l;
/*
- (c) 2004 Jelmer Vernooij <jelmer@samba.org>
+ (c) 2004 Jelmer Vernooij <jelmer@samba.org>
- 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.
+ 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.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
#ifndef __PTB_H__
#define __PTB_H__
#include <glib.h>
struct ptb_hdr {
- char *title;
- char *artist;
- char *album;
- char *words_by;
- char *music_by;
- char *arranged_by;
- char *guitar_transcribed_by;
- char *bass_transcribed_by;
- char *lyrics;
+ enum { CLASSIFICATION_SONG = 0, CLASSIFICATION_LESSON} classification;
+
+ union {
+ struct {
+ enum { RELEASE_TYPE_PR_AUDIO = 0, RELEASE_TYPE_PR_VIDEO, RELEASE_TYPE_BOOTLEG, RELEASE_TYPE_UNRELEASED } release_type;
+
+ union {
+ struct {
+ enum { AUDIO_TYPE_SINGLE = 0, AUDIO_TYPE_EP, AUDIO_TYPE_ALBUM, AUDIO_TYPE_DOUBLE_ALBUM, AUDIO_TYPE_TRIPLE_ALBUM, AUDIO_TYPE_BOXSET } type;
+ char *album_title;
+ guint16 year;
+ guint8 is_live_recording;
+ } pr_audio;
+ struct {
+ char *video_title;
+ guint16 year;
+ guint8 is_live_recording;
+ } pr_video;
+ struct {
+ char *title;
+ guint16 day;
+ guint16 month;
+ guint16 year;
+ } bootleg;
+ struct {
+ } unreleased;
+ } release_info;
+ guint8 is_original_author_unknown;
+ char *title;
+ char *artist;
+ char *words_by;
+ char *music_by;
+ char *arranged_by;
+ char *guitar_transcribed_by;
+ char *bass_transcribed_by;
+ char *lyrics;
+ char *copyright;
+ } song;
+
+ struct {
+ char *title;
+ char *artist;
+ guint16 style;
+ enum { LEVEL_BEGINNER = 0, LEVEL_INTERMEDIATE, LEVEL_ADVANCED} level;
+ char *author;
+ char *copyright;
+ } lesson;
+ } class_info;
+
char *guitar_notes;
char *bass_notes;
- char *copyright;
+ char *drum_notes;
guint16 version;
};
struct ptb_chord {
-
+
struct ptb_chord *next;
};
};
struct ptb_section {
- char *name;
- int (*handler) (struct ptbf *, const char *section);
+ char *name;
+ int (*handler) (struct ptbf *, const char *section);
};
extern struct ptb_section default_sections[];