diff options
author | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2000-07-25 18:00:00 +0200 |
---|---|---|
committer | Klaus Schmidinger <kls (at) cadsoft (dot) de> | 2000-07-25 18:00:00 +0200 |
commit | 1d22145c423f2524c7766b4ae30ee2c26174113d (patch) | |
tree | 57d5ead142972730c932a7d94c375e99f9e743a9 /Tools/epg2timers/epg2timers.cxx | |
parent | 3b78ec8374aac8daa560fa0cd06260fca6eb1500 (diff) | |
download | vdr-patch-lnbsharing-1d22145c423f2524c7766b4ae30ee2c26174113d.tar.gz vdr-patch-lnbsharing-1d22145c423f2524c7766b4ae30ee2c26174113d.tar.bz2 |
Version 0.6vdr-0.6
- Added support for LIRC remote control (thanks to Carsten Koch!).
There are now three different remote control modes: KBD (PC-Keyboard), RCU
and LIRC. See the INSTALL file for information on how to enable either of
these modes. The default mode is now KBD, not RCU as before (to make it
work immediately even if there is no actual remote control).
- Fixed small bug in dvbapi.c that was causing some channels (many on hotbird)
not to be correctly tuned (thanks to Plamen Ganev!).
- Now clearing the replay buffer in search forward/back, which results in
faster reaction.
- The 'Recordings' menu is now listed alphabetically (thanks to Carsten Koch!).
- The new 'epg2timers' tool (thanks to Carsten Koch!) can be used to convert
an EPG "merkliste" page (http://www.tvtv.de) to vdr timer entries.
- The new 'xtvrc2vdr' tool (thanks to Plamen Ganev!) can be used to convert
'xtvrc' channel files into 'vdr' format.
- When more than one timer matches at the same time, the first one in the list
with the highest 'Priority' is selected.
- The MANUAL section on "Programming the Timer" has been filled in.
- The year in the "Recordings" menu as well as in the progress display during
replay has been reduced to 2 digits to allow more space for the recording's
title. In the internal file structure the year is still stored with 4 digits,
so there will be no problem at the next turn of the century ;-)
- Channel names and timer filenames can now contain blanks. To avoid problems
with file names that contain blanks, all blanks in recording file names are
converted to underscores.
- The polarization can now be given in uppercase or lowercase characters in
channels.conf.
- Fixed buffer initialization to work with DVB driver version 0.6.
- Implemented the "Simple Video Disk Recorder Protocol" (SVDRP) to control
the VDR over a network connection.
- Implemented command line option handling.
- The program can now run in full background mode by using the --daemon option.
- Added a "summary" field to the timers (thanks to Carsten Koch!).
This field can contain a descriptive text of the programme and will be
displayed when the "Blue" key is pressed on a recording that was created by
this timer. If the text contains the special character '|', a newline will
be inserted at that place. When pressing "Ok" on a timer that contains a
summary field, the summary will be displayed. To edit such a timer the "Red"
key must be pressed. Timers without a summary still go into Edit mode when
pressing "Ok". The summary field can only be filled in directly by editing
the 'timers.conf' file with a text editor, or by defining/modifying the timer
via the SVDRP interface.
Diffstat (limited to 'Tools/epg2timers/epg2timers.cxx')
-rw-r--r-- | Tools/epg2timers/epg2timers.cxx | 242 |
1 files changed, 242 insertions, 0 deletions
diff --git a/Tools/epg2timers/epg2timers.cxx b/Tools/epg2timers/epg2timers.cxx new file mode 100644 index 0000000..4a8f333 --- /dev/null +++ b/Tools/epg2timers/epg2timers.cxx @@ -0,0 +1,242 @@ +/* + * epg2timers.cxx: Convert an EPG "merkliste" page (http://www.tvtv.de) to a timers.conf + * file for Klaus Schmidinger's vdr (http://www.cadsoft.de/people/kls/vdr). + * + * Copyright (C) 2000 Carsten Koch + * + * 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. + * + * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Or, point your browser to http://www.gnu.org/copyleft/gpl.html + * + * The author can be reached at Carsten.Koch@icem.de + */ + + +#include <stdio.h> +#include <string.h> + + +static const char date_line[] = "\t<td align=center valign=middle colspan=3><span id=fb-b10>"; +static const char start_time_line[] = " \t\t<td bgcolor=\"#7f98bf\" align=center><span id=\"fb-w14\"><nobr> "; +static const char stop_time_line[] = "\t\t\t<tr><td bgcolor=\"#002b64\" align=center><span id=\"fn-w9\">bis "; +static const char channel_line[] = "\t\t\t<tr><td bgcolor=\"#002b64\" align=center><span id=\"fb-w9\">"; +static const char title_line[] = "\t\t\t\t<td bgcolor=\"#002b64\" align=left width=100%><span id=\"fb-w10\">"; +static const char summary_line[] = "\t\t\t<table border=0 cellpadding=10 cellspacing=0 bgcolor=\"white\" width=100%>"; +static const char * const channel_names[] = +{"RTL", "SAT1", "PRO7", "RTL2", "ARD", "BR3", "HR3", "NDR", "SWF", "WDR", "BR Alpha", "SWR BW", "Phoenix", + "ZDF", "3sat", "Kinderkanal", "ARTE", "phoenix", "ORF Sat", "ZDF.info", "CNN", "Super RTL", "VOX", "DW TV", + "Kabel1", "TM3", "DSF", "HOT", "BloombergTV", "Sky News", "KinderNet", "Alice", "n-tv", "Grand Tour.", "TW1", + "Eins Extra", "Eins Festival", "Eins MuXx", "MDR", "ORB", "B1", "ARD Online-Kanal", "Premiere World Promo", + "Premiere", "Star Kino", "Cine Action", "Cine Comedy", "Sci Fantasy", "Romantic Movies", "Studio Universal", + "TV Niepokalanow", "Mosaico", "Andalucia TV", "TVC Internacional", "Nasza TV", "WishLine test", "Pro 7 Austria", + "Kabel 1 Schweiz", "Kabel 1 Austria", "Pro 7 Schweiz", "Kiosque", "KTO", "TCM", "Cartoon Network France & Spain", + "TVBS Europe", "TVBS Europe", "Travel", "TCM Espania", "MTV Spain", "TCM France", "RTL2 CH", + "La Cinquieme", "ARTE", "Post Filial TV", "Canal Canaris", "Canal Canaris", "Canal Canaris", "Canal Canaris", + "AB Sat Passion promo", "AB Channel 1", "Taquilla 0", "CSAT", "Mosaique", "Mosaique 2", "Mosaique 3", "Le Sesame C+", + "FEED", "RTM 1", "ESC 1", "TV5 Europe", "TV7 Tunisia", "ARTE", "RAI Uno", "RTP International", + "Fashion TV", "VideoService", "Beta Research promo", "Canal Canarias", "TVC International", "Fitur", "Astra Info 1", + "Astra Info 2", "Astra Vision 1", "Astra Vision 1", "Astra Vision 1", "Astra Vision 1", "Astra Vision 1", + "Astra Vision 1", "Astra Vision 1", "RTL Tele Letzebuerg", "Astra Mosaic", "MHP test", "Bloomberg TV Spain", + "Video Italia", "AC 3 promo", "" +}; +static const int month_lengths[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + +static const int max_channel = sizeof(channel_names)/sizeof(char *); +static const int max_title = 50; // maximum length of title file name generated +static const int max_line = 1024; // line buffer (not used when parsing summary text) +static const int max_summary = 5000; // Summary can be up to 5000 bytes long +static const int stop_time_safety_margin = 10; // add 10 minutes to stop time in case start was delayed + + + +char map_special_char(const char * const word) + +{ + if (strcmp(word, "auml") == 0) + return 'ä'; + else if (strcmp(word, "ouml") == 0) + return 'ö'; + else if (strcmp(word, "uuml") == 0) + return 'ü'; + else if (strcmp(word, "Auml") == 0) + return 'Ä'; + else if (strcmp(word, "Ouml") == 0) + return 'Ö'; + else if (strcmp(word, "Uuml") == 0) + return 'Ü'; + else if (strcmp(word, "szlig") == 0) + return 'ß'; + return ' '; +} + + + + + +void read_file_name(const char * const line, char * const file_name) + +{ + int line_index = sizeof(title_line) - 1; + int title_index = 0; + char ch = line[line_index++]; + do + { + if (ch == '&') + { + char word[10]; + int i = 0; + while ((line[line_index + i] != ';') && (i < 9)) + word[i++] = line[line_index + i]; + word[i] = 0; + ch = map_special_char(word); + line_index += i; + } + switch (ch) + { + case 'ä': file_name[title_index++] = 'a'; file_name[title_index++] = 'e'; break; + case 'ö': file_name[title_index++] = 'o'; file_name[title_index++] = 'e'; break; + case 'ü': file_name[title_index++] = 'u'; file_name[title_index++] = 'e'; break; + case 'Ä': file_name[title_index++] = 'A'; file_name[title_index++] = 'e'; break; + case 'Ö': file_name[title_index++] = 'O'; file_name[title_index++] = 'e'; break; + case 'Ü': file_name[title_index++] = 'U'; file_name[title_index++] = 'e'; break; + case 'ß': file_name[title_index++] = 's'; file_name[title_index++] = 's'; break; + default: + if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9'))) + file_name[title_index++] = ch; + } + ch = int(line[line_index++]); + } while ((title_index < max_title-1) && (ch != '<') && (ch != 0) && (line_index < max_line-1)); + file_name[title_index] = 0; +} + + + +void read_summary(char * const summary) + +{ + int summary_index = 0; + int ch; + bool need_space = false; + bool done = false; + do + { + ch = getchar(); + switch (ch) + { + case '&': + { + char word[10]; + int i = 0; + ch = getchar(); + while ((ch != ';') && (ch != EOF) && (i < 9)) + { + word[i++] = ch; + ch = getchar(); + } + word[i] = 0; + if (need_space) {summary[summary_index++] = ' '; need_space = false;} + summary[summary_index++] = map_special_char(word); + } + break; + case '<': + { + char word[6]; + int word_index = 0; + do + { + ch = getchar(); + word[word_index++] = ch; + } while ((word_index < 6) && (ch != '>') && (ch != EOF)); + while ((ch != '>') && (ch != EOF)) ch = getchar(); + if (strncmp("/table", word, 6) == 0) + done = true; + } + break; + default: + { + if (ch <= ' ') + { + if (summary_index > 0) need_space = true; + } + else + { + if (need_space) {summary[summary_index++] = ' '; need_space = false;} + summary[summary_index++] = ch; + } + } + } + } while ((summary_index < max_summary - 2) && (!done) && (ch != EOF)); + summary[summary_index] = 0; +} + + + + +main() + +{ + int channel = 0; + int day = -1; + int next_day = -1; + int start_time = -1; + int stop_time = -1; + char summary[max_summary] = {0}; + char file_name[max_title] = {0}; + + while (!feof(stdin)) + { + char line[max_line]; + fgets(line, max_line-1, stdin); + if (strncmp(line, date_line, sizeof(date_line)-1) == 0) + { + const int month = (line[sizeof(date_line) + 6]- '0') * 10 + line[sizeof(date_line) + 7]-'0'; + day = (line[sizeof(date_line) + 3]- '0') * 10 + line[sizeof(date_line) + 4]-'0'; + next_day = day == month_lengths[month]? 1 : day + 1; + } + else if (strncmp(line, start_time_line, sizeof(start_time_line)-1) == 0) + { + start_time = (line[sizeof(start_time_line) - 1] - '0') * 1000 + + (line[sizeof(start_time_line) ] - '0') * 100 + + (line[sizeof(start_time_line) + 2] - '0') * 10 + + (line[sizeof(start_time_line) + 3] - '0'); + } + else if (strncmp(line, stop_time_line, sizeof(stop_time_line)-1) == 0) + { + stop_time = ((line[sizeof(stop_time_line) - 1] - '0') * 1000 + + (line[sizeof(stop_time_line) ] - '0') * 100 + + (line[sizeof(stop_time_line) + 2] - '0') * 10 + + (line[sizeof(stop_time_line) + 3] - '0') + stop_time_safety_margin) % 2400; + if ((day < 0) || (start_time < 0) || (file_name[0] == 0) || (channel == max_channel)) + fprintf(stderr, "Input data error.\n"); + else + printf("1:%03d:%02d:%04d:%04d:2:7:%s:%s\n", channel+1, start_time < 600? next_day : day, start_time, stop_time, file_name, summary); + start_time = -1; stop_time = -1; file_name[0] = 0; summary[0] = 0; channel = max_channel; + } + else if (strncmp(line, title_line, sizeof(title_line)-1) == 0) + read_file_name(line, file_name); + else if (strncmp(line, channel_line, sizeof(channel_line)-1) == 0) + { + int i = sizeof(channel_line); + while ((i < max_line-1) && (line[i] != '<')) i++; + line[i] = 0; // end of string + for (channel = 0; (channel < max_channel) && + (strcmp(line + sizeof(channel_line) - 1, channel_names[channel]) != 0); + channel++); + if (channel == max_channel) + fprintf(stderr, "Error - channel '%s' not recognized.\n", line + sizeof(channel_line) - 1); + } + else if (strncmp(line, summary_line, sizeof(summary_line)-1) == 0) + read_summary(summary); + } +} |