Patch for yaepg-0.0.2

Message ID 4216371D.7010900@aketzu.iki.fi
State New
Headers

Commit Message

Anssi Kolehmainen Feb. 18, 2005, 6:42 p.m. UTC
  Hi,

In YLE channels (in Finland) there are gaps between programs (in 
EPG-data) and yaepg draws only first program and then 'No Info' bar even 
when there are more programs.

Attached is a small patch for yaepg-0.0.2 which adds code to search for 
next program. It also changes granularity for text box drawing from 5 
minutes to 1 minute because YLE has some 4:30min programs (which are 
drawn as thin lines if granularity is 5min).
Finally it changes font from fontYaepg to fontSml which looks much 
better with my Nova-T and xine-lib.

Anssi Kolehmainen
  

Patch

diff -u yaepg-0.0.2-original/yaepg.c yaepg-0.0.2-nullspace/yaepg.c
--- yaepg-0.0.2-original/yaepg.c	2004-11-08 03:41:20.000000000 +0200
+++ yaepg-0.0.2-nullspace/yaepg.c	2005-02-18 20:28:55.000000000 +0200
@@ -16,12 +16,12 @@ 
 static const tColor highlight		= (tColor) 0xFF505050;
 static const tColor lightgrey		= (tColor) 0xFFAAAAAA;
 
-#define fontChanBox			fontYaepg
-#define fontTimeBox			fontYaepg
-#define fontEventBox			fontYaepg
-#define fontInfoBox			fontYaepg
-#define fontDateBox			fontYaepg
-#define fontTitleBox			fontYaepg
+#define fontChanBox			fontSml
+#define fontTimeBox			fontSml
+#define fontEventBox			fontSml
+#define fontInfoBox			fontSml
+#define fontDateBox			fontSml
+#define fontTitleBox			fontSml
 
 /*
  * Lots of hard-coding here based on the font size.  Should be made more dynamic
@@ -33,7 +33,7 @@ 
 #define TBOX_DEF_XALIGN			TBOX_TXT_CENTER
 #define TBOX_DEF_YSPACING		0
 
-#define TBOX_TXT_HEIGHT			20
+#define TBOX_TXT_HEIGHT			21
 #define TBOX_TXT_LEFT			0
 #define TBOX_TXT_CENTER			1
 #define TBOX_TXT_RIGHT			2
@@ -615,8 +615,8 @@ 
 	 * We use 5 minute granularity for an event's width.  We subtract two
 	 * pixels for the border.
 	 */
-	if (tLen >= 300) {
-		w = (tLen / 300) * 24 -2;
+	if (tLen >= 60) {
+		w = (tLen / 60) * 5 -2;
 	}
 	else {
 		w = 4;
@@ -627,7 +627,7 @@ 
 	 * over one for the left side of the border.  The right border is taken
 	 * care of above.
 	 */
-	xOff = (((e->StartTime() - t) + iOutputResH / 2) / 300) * 24;
+	xOff = (((e->StartTime() - t) + iOutputResH / 2) / 60) * 5;
 	if (xOff <= 0) {
 		xOff = 1;
 	}
@@ -1456,7 +1456,7 @@ 
 	cSchedulesLock SchedulesLock;
 	const cSchedules* Schedules = cSchedules::Schedules(SchedulesLock);
 	cy = 22;
-	time_t grTime, t0 = mktime(&timebox[0]->tmTime);
+	time_t grTime, t0 = mktime(&timebox[0]->tmTime), nextEvent;
 	const cSchedule *currSched;
 	const cEvent *currEvent;
 	for (i = 0; i < iChannelCount; i++) {
@@ -1482,6 +1482,13 @@ 
 			else {
 				currEvent = NULL;
 			}
+			
+			//Try to find next event since some channels have empty time between programs
+			nextEvent=grTime;
+			while (currSched && currEvent==NULL && (nextEvent-grTime) < 60*60*2) {
+				nextEvent +=60*5;
+				currEvent = currSched->GetEventAround(nextEvent);
+			}
 
 			if (currEvent == NULL) {
 				/*