shithub: cuefs

Download patch

ref: c402d678bf078f5aed978229c400a9f1362824b1
parent: ec39ae8f8b2184347768f308ea80b11cc4aabf1b
author: Tevo <estevan.cps@gmail.com>
date: Sat Feb 13 22:10:49 EST 2021

Handle PREGAP and POSTGAP  properly 

--- a/BUGS
+++ b/BUGS
@@ -13,3 +13,4 @@
 		REM GENRE "Progressive Rock"
 		REM DATE 2002
 	it probably wouldn't hurt to try parsing some of those; not a high priority at the moment
+• cuefs does not respect PREGAP and POSTGAP tags on cuesheets
--- a/cue.c
+++ b/cue.c
@@ -167,8 +167,24 @@
 setisrc(Cuesheet *c, char *isrc)
 {
 	if(c->curentry == nil)
-		parserfatal("flag outside of track");
+		parserfatal("isrc outside of track");
 	c->curentry->isrc = isrc;
+}
+
+void 
+setpregap(Cuesheet* c, Timestamp pre)
+{
+	if(c->curentry == nil)
+		parserfatal("pregap outside of track");
+	c->curentry->pregap = pre;
+}
+
+void 
+setpostgap(Cuesheet* c, Timestamp post)
+{
+	if(c->curentry == nil)
+		parserfatal("postgap outside of track");
+	c->curentry->postgap = post;
 }
 
 void
--- a/cue.y
+++ b/cue.y
@@ -42,6 +42,8 @@
 	| CATALOG MCN				{ setmcn(cursheet, $2); }
 	| FLAGS flags				{ setflags(cursheet, $2); }
 	| ISRC ISRCCODE			{ setisrc(cursheet, $2); }
+	| PREGAP timestamp			{ setpregap(cursheet, $2); }
+	| POSTGAP timestamp		{ setpostgap(cursheet, $2); }
 	;
 
 flags:						{ $$ = 0; }
--- a/cuefs.h
+++ b/cuefs.h
@@ -76,6 +76,7 @@
 	AFile *file;
 	int index, flags;
 	char *title, *performer, *isrc;
+	Timestamp pregap, postgap;
 	Entry *next;
 };
 
@@ -95,6 +96,8 @@
 Cuesheet* newsheet(void);
 void freesheet(Cuesheet*);
 
+void setpregap(Cuesheet*, Timestamp);
+void setpostgap(Cuesheet*, Timestamp);
 void setisrc(Cuesheet*, char*);
 void setflags(Cuesheet*, int);
 void setmcn(Cuesheet*, char*);