--- ../tv_grab_dvb-0.8.ori/tv_grab_dvb.c	2004-07-15 23:26:51.000000000 +0100
+++ tv_grab_dvb.c	2004-08-12 20:59:27.317105264 +0100
@@ -73,6 +73,7 @@
 bool ignore_updates = true;
 bool use_chanidents = false;
 bool silent = false;
+int subtitle_description_limit = 0;
 
 typedef struct chninfo 
 {
@@ -96,7 +97,7 @@
 
 void usage()
 {
-	errmsg ("tv_grab_dvb - Version 0.8\n\n usage: %s [-d] [-u] [-c] [-n|m|p] [-s] [-t timeout] [-o offset] > dump.xmltv\n\n"
+	errmsg ("tv_grab_dvb - Version 0.8\n\n usage: %s [-d] [-u] [-c] [-q limit] [-n|m|p] [-s] [-t timeout] [-o offset] > dump.xmltv\n\n"
 		"\t\t-t timeout - Stop after timeout seconds of no new data\n"
 		"\t\t-o offset  - time offset in hours from -12 to 12\n"
 		"\t\t-c - Use Channel Identifiers from file 'chanidents'\n"
@@ -106,6 +107,7 @@
 		"\t\t-m - current multiplex now_next only\n"
 		"\t\t-p - other multiplex now_next only\n"
 		"\t\t-s - silent - no status ouput\n"
+		"\t\t-q - try and create the sub title from the description\n"
 		"\t\t-u - output updated info - will result in repeated information\n\n", ProgName);
 	_exit(1);
 }
@@ -129,7 +131,7 @@
 	int Option_Index = 0;
 
 	while (1) {
-		c = getopt_long(arg_count, arg_strings, "udscmpnht:o:", Long_Options, &Option_Index);
+		c = getopt_long(arg_count, arg_strings, "udscmpnhq:t:o:", Long_Options, &Option_Index);
 		if (c == EOF)
 			break;
 		switch (c) {
@@ -171,6 +173,13 @@
 		case 's':
 			silent = true;
 			break;
+		case 'q':
+			subtitle_description_limit = atoi(optarg);
+			if (0 == subtitle_description_limit) {
+				errmsg("%s: invalid limit value\n", ProgName);
+				usage();
+			}
+			break;
 		case 'h':
 		case '?':
 			usage();
@@ -282,7 +291,20 @@
 
    printf("\t<title lang=\"%s\">%s</title>\n",lang,xmlify(evt));
    if (*dsc)
+   {
+     if (subtitle_description_limit)
+     {
+        char *sub = strchr(dsc,':');
+        if (sub && ((sub-dsc) < subtitle_description_limit))
+        {
+             //Hacky but cheap.
+             *sub=0;
+             printf("\t<sub-title lang=\"%s\">%s</sub-title>\n",lang,xmlify(dsc));
+             *sub=':';
+        }
+     }
      printf("\t<desc lang=\"%s\">%s</desc>\n",lang,xmlify(dsc));
+   }
    
 }
 
