From a6138160501bf5c1bf42c5f16c6d0333d7b31e9d Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 4 Dec 2011 14:36:37 +0100 Subject: Removed the '.pl' suffix from all scripts --- CONTRIBUTORS | 1 + HISTORY | 1 + Makefile | 4 +- epg2html | 97 +++++++++++++++ epg2html.pl | 97 --------------- i18n-to-gettext | 347 +++++++++++++++++++++++++++++++++++++++++++++++++++++ i18n-to-gettext.pl | 347 ----------------------------------------------------- libsi/Makefile | 4 +- libsi/gendescr | 83 +++++++++++++ libsi/gendescr.pl | 83 ------------- summary2info | 56 +++++++++ summary2info.pl | 56 --------- 12 files changed, 589 insertions(+), 587 deletions(-) create mode 100755 epg2html delete mode 100755 epg2html.pl create mode 100755 i18n-to-gettext delete mode 100755 i18n-to-gettext.pl create mode 100755 libsi/gendescr delete mode 100755 libsi/gendescr.pl create mode 100755 summary2info delete mode 100755 summary2info.pl diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 257ff954..416e9d3e 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -1925,6 +1925,7 @@ Ville Skytt for fixing a crash when deleting a recording while cutting it for fixing several spelling errors for adding generating a pkg-config file to the Makefile + for removing the '.pl' suffix from all scripts (thanks to Ville Skyttä). Steffen Beyer for fixing setting the colored button help after deleting a recording in case the next diff --git a/HISTORY b/HISTORY index 65abb3e2..d342dc94 100644 --- a/HISTORY +++ b/HISTORY @@ -6774,3 +6774,4 @@ Video Disk Recorder Revision History - The new SVDRP command UPDR can be used to trigger an update of the list of recordings (thanks to Lars Hanisch). - Added generating a pkg-config file to the Makefile (thanks to Ville Skyttä). +- Removed the '.pl' suffix from all scripts (thanks to Ville Skyttä). diff --git a/Makefile b/Makefile index f1514cf2..c6b8fe2f 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # See the main source file 'vdr.c' for copyright information and # how to reach the author. # -# $Id: Makefile 2.20 2011/12/04 14:12:49 kls Exp $ +# $Id: Makefile 2.21 2011/12/04 14:17:35 kls Exp $ .DELETE_ON_ERROR: @@ -190,7 +190,7 @@ install: install-bin install-conf install-doc install-plugins install-i18n insta install-bin: vdr @mkdir -p $(DESTDIR)$(BINDIR) - @cp --remove-destination vdr svdrpsend.pl $(DESTDIR)$(BINDIR) + @cp --remove-destination vdr svdrpsend $(DESTDIR)$(BINDIR) # Configuration files: diff --git a/epg2html b/epg2html new file mode 100755 index 00000000..8b9e7b1f --- /dev/null +++ b/epg2html @@ -0,0 +1,97 @@ +#!/usr/bin/perl + +# A simple EPG to HTML converter +# +# Converts the EPG data written by 'vdr' into the file /video/epg.data +# into a simple HTML programme listing, consisting of one file per channel +# plus an 'index.htm' file. All output files are written into the current +# directory. +# +# Usage: epg2html < /video/epg.data +# +# See the main source file 'vdr.c' for copyright information and +# how to reach the author. +# +# $Id: epg2html 2.1 2011/12/04 14:17:35 kls Exp $ + +@Index = (); + +sub GetDay +{ + return substr(localtime(shift), 0, 10); +} + +sub GetTime +{ + return substr(localtime(shift), 11, 5); +} + +sub Tags +{ + my $s = shift; + $s =~ s/\&/&/g; + $s =~ s//>/g; + return $s; +} + +while (<>) { + chomp; + if (/^C ([^ ]+) *(.*)/) { + my $Channel = $2; + (my $Page = $Channel) =~ y/\/ /-_/; + $Page .= ".htm"; + $Channel = Tags($Channel); + push(@Index, qq{$Channel
\n}); + my %Events = (); + while (<>) { + if (/^E (.*?) (.*?) ([^ ]*)/) { + (my $Time, $Duration) = ($2, $3); + my $Title = "", $Subtitle = "", $Description = "", $Vps = 0; + while (<>) { + if (/^T (.*)/) { $Title = Tags($1); } + elsif (/^S (.*)/) { $Subtitle = Tags($1); } + elsif (/^D (.*)/) { $Description = Tags($1); $Description =~ s/\|/
/g; } + elsif (/^V (.*)/) { $Vps = $1; } + elsif (/^e/) { + $Events{$Time} = [($Duration, $Title, $Subtitle, $Description, $Vps)]; + last; + } + } + } + elsif (/^c/) { + my @Schedule = (); + my $Day = ""; + for $t (sort keys %Events) { + (my $Duration, $Title, $Subtitle, $Description, $Vps) = @{$Events{$t}}; + my $d = GetDay($t); + if ($d ne $Day) { + push(@Schedule, "\n") if ($Day && @Schedule); + push(@Schedule, "

$d

\n"); + push(@Schedule, "\n"); + $Day = $d; + } + my $Entry = $Title; + $Entry .= "
$Subtitle" if $Subtitle; + $Entry .= "
$Description" if $Description; + $Entry .= "
(VPS = " . scalar localtime($Vps) . ")" if $Vps && $Vps != $t; + push(@Schedule, "\n"); + } + push(@Schedule, "
" . GetTime($t) . "$Entry
\n") if (@Schedule); + open(PAGE, ">$Page") or die "$Page: $!\n"; + print PAGE "\n$Channel\n\n"; + print PAGE "

$Channel

\n"; + print PAGE @Schedule; + print PAGE "\n\n"; + close(PAGE); + last; + } + } + } + } + +open(INDEX, ">index.htm") or die "index.htm: $!\n"; +print INDEX "\nEPG Index\n\n"; +print INDEX sort { lc($a) cmp lc($b) } @Index; +print INDEX "\n\n"; +close(INDEX); diff --git a/epg2html.pl b/epg2html.pl deleted file mode 100755 index a18ec08b..00000000 --- a/epg2html.pl +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/perl - -# A simple EPG to HTML converter -# -# Converts the EPG data written by 'vdr' into the file /video/epg.data -# into a simple HTML programme listing, consisting of one file per channel -# plus an 'index.htm' file. All output files are written into the current -# directory. -# -# Usage: epg2html.pl < /video/epg.data -# -# See the main source file 'vdr.c' for copyright information and -# how to reach the author. -# -# $Id: epg2html.pl 1.7 2006/04/17 12:19:08 kls Exp $ - -@Index = (); - -sub GetDay -{ - return substr(localtime(shift), 0, 10); -} - -sub GetTime -{ - return substr(localtime(shift), 11, 5); -} - -sub Tags -{ - my $s = shift; - $s =~ s/\&/&/g; - $s =~ s//>/g; - return $s; -} - -while (<>) { - chomp; - if (/^C ([^ ]+) *(.*)/) { - my $Channel = $2; - (my $Page = $Channel) =~ y/\/ /-_/; - $Page .= ".htm"; - $Channel = Tags($Channel); - push(@Index, qq{$Channel
\n}); - my %Events = (); - while (<>) { - if (/^E (.*?) (.*?) ([^ ]*)/) { - (my $Time, $Duration) = ($2, $3); - my $Title = "", $Subtitle = "", $Description = "", $Vps = 0; - while (<>) { - if (/^T (.*)/) { $Title = Tags($1); } - elsif (/^S (.*)/) { $Subtitle = Tags($1); } - elsif (/^D (.*)/) { $Description = Tags($1); $Description =~ s/\|/
/g; } - elsif (/^V (.*)/) { $Vps = $1; } - elsif (/^e/) { - $Events{$Time} = [($Duration, $Title, $Subtitle, $Description, $Vps)]; - last; - } - } - } - elsif (/^c/) { - my @Schedule = (); - my $Day = ""; - for $t (sort keys %Events) { - (my $Duration, $Title, $Subtitle, $Description, $Vps) = @{$Events{$t}}; - my $d = GetDay($t); - if ($d ne $Day) { - push(@Schedule, "\n") if ($Day && @Schedule); - push(@Schedule, "

$d

\n"); - push(@Schedule, "\n"); - $Day = $d; - } - my $Entry = $Title; - $Entry .= "
$Subtitle" if $Subtitle; - $Entry .= "
$Description" if $Description; - $Entry .= "
(VPS = " . scalar localtime($Vps) . ")" if $Vps && $Vps != $t; - push(@Schedule, "\n"); - } - push(@Schedule, "
" . GetTime($t) . "$Entry
\n") if (@Schedule); - open(PAGE, ">$Page") or die "$Page: $!\n"; - print PAGE "\n$Channel\n\n"; - print PAGE "

$Channel

\n"; - print PAGE @Schedule; - print PAGE "\n\n"; - close(PAGE); - last; - } - } - } - } - -open(INDEX, ">index.htm") or die "index.htm: $!\n"; -print INDEX "\nEPG Index\n\n"; -print INDEX sort { lc($a) cmp lc($b) } @Index; -print INDEX "\n\n"; -close(INDEX); diff --git a/i18n-to-gettext b/i18n-to-gettext new file mode 100755 index 00000000..6932fd27 --- /dev/null +++ b/i18n-to-gettext @@ -0,0 +1,347 @@ +#!/usr/bin/perl -w + +# Convert i18n texts to gettext +# +# Extracts all texts from the file i18n.c and creates language +# specific *.po files. +# +# Usage: i18n-to-gettext +# +# See the main source file 'vdr.c' for copyright information and +# how to reach the author. +# +# $Id: i18n-to-gettext 2.2 2011/12/04 14:17:35 kls Exp $ + +# How to convert an actual plugin: +# +# - If your code contains something like +# +# const char *Text = "Some text"; +# ... +# Function(tr(Text)); +# +# you need to enclose the text constant in trNOOP(...), as in +# +# const char *Text = trNOOP("Some text"); +# +# The actual usage of the tr() macro remains unchanged. +# +# - If you have comments following the texts in your i18n.c file +# that should be seen by the translators, move them from the +# i18n.c file into the file where the text is actually used, +# and mark them with the TRANSLATORS keyword, as in +# +# // TRANSLATORS: note the plural! +# Add(new cMenuEditIntItem( tr("Setup.EPG$Preferred languages"), ... +# +# - Fill in your email address in the line +# $MSGIDBUGS = "" ... +# below, so that users can reach you in case there is a problem +# with a message id. +# +# - Run this Perl script from within your plugin's source directory. +# This script will run 'xgettext' to extract all of your texts +# into a file named .pot. After that it will extract +# your existing i18n texts from the file i18n.c (or wherever you +# have defined them) and generate *.po files for all languages +# currently known by VDR. +# +# - Your Makefile will be automatically adjusted to allow for +# building the *.mo files necessary for supporting gettext(). +# Please check carefully whether the automatic adjustments have +# succeeded, though. The modified Makefile will be written to +# Makefile.new, so you can call this script any numer of times +# in case you need to do some fine tuning of your texts (especially +# adding some trNOOP() in case the script reports "missing phrases". +# Once you're done converting your plugin source to using gettext, +# rename Makefile.new to Makefile. +# +# - You may want to remove the old internationalized texts from your +# source. Usually this means removing the files i18n.[hc], stripping +# i18n.o from the OBJS variable in the Makefile and removing all +# '#include "i18n.h"' lines from the rest of your source files. +# These steps are not done automatically. + +# Check for the existence of a Makefile: + +die "Makefile not found!" unless (-f "Makefile"); + +# Determine the plugin name: + +$PLUGIN = `grep '^PLUGIN *=' Makefile | head -1` || die "can't find plugin name!"; +$PLUGIN =~ s/.*= *(.*)\n/$1/; +die "can't find plugin name!" unless ($PLUGIN); + +# Locate the file containing the texts: + +$I18NFILE = ""; +for ("i18n.c", "i18n.h", `ls *.c`) { # try i18n.[ch] explicitly first + chomp($f = $_); + if (-f $f && `grep tI18nPhrase $f`) { + $I18NFILE = $f; + last; + } + } +die "can't find internationalized texts!" unless ($I18NFILE); + +# Plugin specific information: + +$TITLE = "VDR plugin language source file"; +$COPYRIGHT = "2007 Klaus Schmidinger "; +$PACKAGE = "VDR"; +$VERSION = "1.5.7"; +$MSGIDBUGS = "" || die "enter your email address here"; # escape the '@', as in "user\@domain.tld" +$LANGUAGETEAM = ""; + +# Gettext environment: + +$XGETTEXT = "xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='$MSGIDBUGS'"; +$PODIR = "po"; +$POTFILE = "$PODIR/$PLUGIN.pot"; + +# Languages as known by VDR 1.5.6: + +@LANGS = ( + "en_US", + "de_DE", + "sl_SI", + "it_IT", + "nl_NL", + "pt_PT", + "fr_FR", + "nn_NO", + "fi_FI", + "pl_PL", + "es_ES", + "el_GR", + "sv_SE", + "ro_RO", + "hu_HU", + "ca_ES", + "ru_RU", + "hr_HR", + "et_EE", + "da_DK", + "cs_CZ", + "tr_TR" + ); + +@CHARSETS = ( + "ISO-8859-15", + "ISO-8859-15", + "ISO-8859-2", + "ISO-8859-15", + "ISO-8859-15", + "ISO-8859-1", + "ISO-8859-1", + "ISO-8859-1", + "ISO-8859-15", + "ISO-8859-2", + "ISO-8859-15", + "ISO-8859-7", + "ISO-8859-1", + "ISO-8859-2", + "ISO-8859-2", + "ISO-8859-1", + "ISO-8859-5", + "ISO-8859-2", + "ISO-8859-13", + "ISO-8859-15", + "ISO-8859-2", + "ISO-8859-9", + ); + +@TRANSLATORS = ( + "Klaus Schmidinger , 2000", + "Klaus Schmidinger , 2000", + "Miha Setina , 2000; Matjaz Thaler , 2003", + "Alberto Carraro , 2001; Antonio Ospite , 2003; Sean Carlos , 2005", + "Arnold Niessen , 2001; Hans Dingemans , 2003; Maarten Wisse , 2005", + "Paulo Lopes , 2001", + "Jean-Claude Repetto , 2001; Olivier Jacques , 2003; Gregoire Favre , 2003; Nicolas Huillard , 2005", + "Jřrgen Tvedt , 2001; Truls Slevigen , 2002", + "Hannu Savolainen , 2002; Jaakko Hyvätti , 2002; Niko Tarnanen , 2003; Rolf Ahrenberg , 2003", + "Michael Rakowski , 2002", + "Ruben Nunez Francisco , 2002", + "Dimitrios Dimitrakos , 2002", + "Tomas Prybil , 2002; Jan Ekholm , 2003", + "Paul Lacatus , 2002; Lucian Muresan , 2004", + "Istvan Koenigsberger , 2002; Guido Josten , 2002", + "Marc Rovira Vall , 2003; Ramon Roca , 2003; Jordi Vilŕ , 2003", + "Vyacheslav Dikonov , 2004", + "Drazen Dupor , 2004; Dino Ravnic , 2004", + "Arthur Konovalov , 2004", + "Mogens Elneff , 2004", + "Vladimír Bárta , 2006", + "Oktay Yolgeçen , 2007" + ); + +@LASTTRANSLATOR = ( + "Klaus Schmidinger ", + "Klaus Schmidinger ", + "Matjaz Thaler ", + "Sean Carlos ", + "Maarten Wisse ", + "Paulo Lopes ", + "Nicolas Huillard ", + "Truls Slevigen ", + "Rolf Ahrenberg ", + "Michael Rakowski ", + "Ruben Nunez Francisco ", + "Dimitrios Dimitrakos ", + "Tomas Prybil ", + "Lucian Muresan ", + "Istvan Koenigsberger , Guido Josten ", + "Jordi Vilŕ ", + "Vyacheslav Dikonov ", + "Drazen Dupor ", + "Arthur Konovalov ", + "Mogens Elneff ", + "Vladimír Bárta ", + "Oktay Yolgeçen " + ); + +# Collect all translated texts: + +open(F, $I18NFILE) || die "$I18NFILE: $!\n"; +$InComment = 0; +while () { + chomp; + s/\t/ /g; # get rid of tabs + s/ *$//; # get rid of trailing blanks + s/^ *\/\/.*//; # remove comment lines + s/ *\/\/.*//; # strip trailing comments + s/\/\*.*\*\///g; # strip c comments + if (/\/\*/) { + $InComment = 1; + s/\/\*.*$//; # remove start of comment + } + elsif (/\*\//) { + $InComment = 0; + s/^.*\*\///; # remove end of comment + } + elsif ($InComment) { + next; + } + next if (/^ *$/); # skip empty lines + next if (/#if/); + next if (/#endif/); + next unless ($found or $found = /const *tI18nPhrase .*{/); # sync on phrases + next if (/const *tI18nPhrase .*{/); # skip sync line + last if (/{ *NULL *}/); # stop after last phrase + if (/{ *(.*),/) { + $Original = $1; + $Index = 0; + } + elsif (/}/) { + } + else { + $Translated = $_; + $Translated =~ s/ *(.*),/$1/; + $Index++; + $Map{$Original}[$Index] = $Translated; + } + } +close(F); + +# Generate the .pot file: + +(mkdir($PODIR) || die "$PODIR: $!\n") unless -d $PODIR; + +system("$XGETTEXT -o $POTFILE *.c"); + +# Generate .po files for all languages: + +open(POT, $POTFILE) || die "$POTFILE: $!\n"; +@POT = ; +close(POT); + +for ($Index = 1; $LANGS[$Index]; $Index++) { + + $Authors = "# " . join("\n# ", split(/; */, $TRANSLATORS[$Index])) . "\n"; + + $POFILE = "$PODIR/$LANGS[$Index].po"; + open(PO, ">$POFILE") || die "$POFILE: $!\n"; + $msgid = ""; + for (@POT) { + next if (/^#, fuzzy$/); # skip the 'fuzzy' keyword + $msgid = $1 if (/^msgid (".+")/); + $date = $1 if (/POT-Creation-Date: (.*)\\n/); + $s = $_; + if (!$msgid) { + $s =~ s/SOME DESCRIPTIVE TITLE/$TITLE/; + $s =~ s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/$COPYRIGHT/; + $s =~ s/PACKAGE/$PACKAGE/; + $s =~ s/VERSION/$VERSION/; + $s = $Authors if (/FIRST AUTHOR/); + $s =~ s/YEAR-MO-DA HO:MI\+ZONE/$date/; + $s =~ s/FULL NAME /$LASTTRANSLATOR[$Index]/; + $s =~ s/LANGUAGE /$LANGUAGETEAM/; + $s =~ s/CHARSET/$CHARSETS[$Index]/; + } + else { + $s =~ s/""/$Map{$msgid}[$Index]/ if ($msgid && /^msgstr ""/ && defined $Map{$msgid}[$Index]); + $Used{$msgid} = 1; + } + print PO $s; + } + close(PO); + } + +# Report missing phrases: + +for (keys %Map) { + push(@Missing, "$_\n") unless $Used{$_}; + } + +if (@Missing) { + print "Missing phrases (may need to use trNOOP):\n\n"; + print sort(@Missing); + } + +# Adjust the Makefile: + +$MAKEI18N = q{### Internationalization (I18N): + +PODIR = po +LOCALEDIR = $(VDRDIR)/locale +I18Npo = $(wildcard $(PODIR)/*.po) +I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) +I18Npot = $(PODIR)/$(PLUGIN).pot + +%.mo: %.po + msgfmt -c -o $@ $< + +$(I18Npot): $(wildcard *.c) + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<} . $MSGIDBUGS . q{>' -o $@ $^ + +%.po: $(I18Npot) + msgmerge -U --no-wrap --no-location --backup=none -q $@ $< + @touch $@ + +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo + @mkdir -p $(dir $@) + cp $< $@ + +.PHONY: i18n +i18n: $(I18Nmsgs) + +}; + +open(OLD, "Makefile") || die "Makefile: $!"; +open(NEW, ">Makefile.new") || die "Makefile.new: $!"; +while () { + chomp; + if (/Targets:/) { + print NEW $MAKEI18N; + } + elsif (/^all:/) { + $_ .= " i18n"; + } + elsif (/^clean:/) { + $_ .= "\n\t\@-rm -f \$(PODIR)/*.mo \$(PODIR)/*.pot"; + } + print NEW "$_\n"; + } +close(NEW); +close(OLD); diff --git a/i18n-to-gettext.pl b/i18n-to-gettext.pl deleted file mode 100755 index 29d9345d..00000000 --- a/i18n-to-gettext.pl +++ /dev/null @@ -1,347 +0,0 @@ -#!/usr/bin/perl -w - -# Convert i18n texts to gettext -# -# Extracts all texts from the file i18n.c and creates language -# specific *.po files. -# -# Usage: i18n-to-gettext.pl -# -# See the main source file 'vdr.c' for copyright information and -# how to reach the author. -# -# $Id: i18n-to-gettext.pl 2.1 2009/10/18 14:07:49 kls Exp $ - -# How to convert an actual plugin: -# -# - If your code contains something like -# -# const char *Text = "Some text"; -# ... -# Function(tr(Text)); -# -# you need to enclose the text constant in trNOOP(...), as in -# -# const char *Text = trNOOP("Some text"); -# -# The actual usage of the tr() macro remains unchanged. -# -# - If you have comments following the texts in your i18n.c file -# that should be seen by the translators, move them from the -# i18n.c file into the file where the text is actually used, -# and mark them with the TRANSLATORS keyword, as in -# -# // TRANSLATORS: note the plural! -# Add(new cMenuEditIntItem( tr("Setup.EPG$Preferred languages"), ... -# -# - Fill in your email address in the line -# $MSGIDBUGS = "" ... -# below, so that users can reach you in case there is a problem -# with a message id. -# -# - Run this Perl script from within your plugin's source directory. -# This script will run 'xgettext' to extract all of your texts -# into a file named .pot. After that it will extract -# your existing i18n texts from the file i18n.c (or wherever you -# have defined them) and generate *.po files for all languages -# currently known by VDR. -# -# - Your Makefile will be automatically adjusted to allow for -# building the *.mo files necessary for supporting gettext(). -# Please check carefully whether the automatic adjustments have -# succeeded, though. The modified Makefile will be written to -# Makefile.new, so you can call this script any numer of times -# in case you need to do some fine tuning of your texts (especially -# adding some trNOOP() in case the script reports "missing phrases". -# Once you're done converting your plugin source to using gettext, -# rename Makefile.new to Makefile. -# -# - You may want to remove the old internationalized texts from your -# source. Usually this means removing the files i18n.[hc], stripping -# i18n.o from the OBJS variable in the Makefile and removing all -# '#include "i18n.h"' lines from the rest of your source files. -# These steps are not done automatically. - -# Check for the existence of a Makefile: - -die "Makefile not found!" unless (-f "Makefile"); - -# Determine the plugin name: - -$PLUGIN = `grep '^PLUGIN *=' Makefile | head -1` || die "can't find plugin name!"; -$PLUGIN =~ s/.*= *(.*)\n/$1/; -die "can't find plugin name!" unless ($PLUGIN); - -# Locate the file containing the texts: - -$I18NFILE = ""; -for ("i18n.c", "i18n.h", `ls *.c`) { # try i18n.[ch] explicitly first - chomp($f = $_); - if (-f $f && `grep tI18nPhrase $f`) { - $I18NFILE = $f; - last; - } - } -die "can't find internationalized texts!" unless ($I18NFILE); - -# Plugin specific information: - -$TITLE = "VDR plugin language source file"; -$COPYRIGHT = "2007 Klaus Schmidinger "; -$PACKAGE = "VDR"; -$VERSION = "1.5.7"; -$MSGIDBUGS = "" || die "enter your email address here"; # escape the '@', as in "user\@domain.tld" -$LANGUAGETEAM = ""; - -# Gettext environment: - -$XGETTEXT = "xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='$MSGIDBUGS'"; -$PODIR = "po"; -$POTFILE = "$PODIR/$PLUGIN.pot"; - -# Languages as known by VDR 1.5.6: - -@LANGS = ( - "en_US", - "de_DE", - "sl_SI", - "it_IT", - "nl_NL", - "pt_PT", - "fr_FR", - "nn_NO", - "fi_FI", - "pl_PL", - "es_ES", - "el_GR", - "sv_SE", - "ro_RO", - "hu_HU", - "ca_ES", - "ru_RU", - "hr_HR", - "et_EE", - "da_DK", - "cs_CZ", - "tr_TR" - ); - -@CHARSETS = ( - "ISO-8859-15", - "ISO-8859-15", - "ISO-8859-2", - "ISO-8859-15", - "ISO-8859-15", - "ISO-8859-1", - "ISO-8859-1", - "ISO-8859-1", - "ISO-8859-15", - "ISO-8859-2", - "ISO-8859-15", - "ISO-8859-7", - "ISO-8859-1", - "ISO-8859-2", - "ISO-8859-2", - "ISO-8859-1", - "ISO-8859-5", - "ISO-8859-2", - "ISO-8859-13", - "ISO-8859-15", - "ISO-8859-2", - "ISO-8859-9", - ); - -@TRANSLATORS = ( - "Klaus Schmidinger , 2000", - "Klaus Schmidinger , 2000", - "Miha Setina , 2000; Matjaz Thaler , 2003", - "Alberto Carraro , 2001; Antonio Ospite , 2003; Sean Carlos , 2005", - "Arnold Niessen , 2001; Hans Dingemans , 2003; Maarten Wisse , 2005", - "Paulo Lopes , 2001", - "Jean-Claude Repetto , 2001; Olivier Jacques , 2003; Gregoire Favre , 2003; Nicolas Huillard , 2005", - "Jřrgen Tvedt , 2001; Truls Slevigen , 2002", - "Hannu Savolainen , 2002; Jaakko Hyvätti , 2002; Niko Tarnanen , 2003; Rolf Ahrenberg , 2003", - "Michael Rakowski , 2002", - "Ruben Nunez Francisco , 2002", - "Dimitrios Dimitrakos , 2002", - "Tomas Prybil , 2002; Jan Ekholm , 2003", - "Paul Lacatus , 2002; Lucian Muresan , 2004", - "Istvan Koenigsberger , 2002; Guido Josten , 2002", - "Marc Rovira Vall , 2003; Ramon Roca , 2003; Jordi Vilŕ , 2003", - "Vyacheslav Dikonov , 2004", - "Drazen Dupor , 2004; Dino Ravnic , 2004", - "Arthur Konovalov , 2004", - "Mogens Elneff , 2004", - "Vladimír Bárta , 2006", - "Oktay Yolgeçen , 2007" - ); - -@LASTTRANSLATOR = ( - "Klaus Schmidinger ", - "Klaus Schmidinger ", - "Matjaz Thaler ", - "Sean Carlos ", - "Maarten Wisse ", - "Paulo Lopes ", - "Nicolas Huillard ", - "Truls Slevigen ", - "Rolf Ahrenberg ", - "Michael Rakowski ", - "Ruben Nunez Francisco ", - "Dimitrios Dimitrakos ", - "Tomas Prybil ", - "Lucian Muresan ", - "Istvan Koenigsberger , Guido Josten ", - "Jordi Vilŕ ", - "Vyacheslav Dikonov ", - "Drazen Dupor ", - "Arthur Konovalov ", - "Mogens Elneff ", - "Vladimír Bárta ", - "Oktay Yolgeçen " - ); - -# Collect all translated texts: - -open(F, $I18NFILE) || die "$I18NFILE: $!\n"; -$InComment = 0; -while () { - chomp; - s/\t/ /g; # get rid of tabs - s/ *$//; # get rid of trailing blanks - s/^ *\/\/.*//; # remove comment lines - s/ *\/\/.*//; # strip trailing comments - s/\/\*.*\*\///g; # strip c comments - if (/\/\*/) { - $InComment = 1; - s/\/\*.*$//; # remove start of comment - } - elsif (/\*\//) { - $InComment = 0; - s/^.*\*\///; # remove end of comment - } - elsif ($InComment) { - next; - } - next if (/^ *$/); # skip empty lines - next if (/#if/); - next if (/#endif/); - next unless ($found or $found = /const *tI18nPhrase .*{/); # sync on phrases - next if (/const *tI18nPhrase .*{/); # skip sync line - last if (/{ *NULL *}/); # stop after last phrase - if (/{ *(.*),/) { - $Original = $1; - $Index = 0; - } - elsif (/}/) { - } - else { - $Translated = $_; - $Translated =~ s/ *(.*),/$1/; - $Index++; - $Map{$Original}[$Index] = $Translated; - } - } -close(F); - -# Generate the .pot file: - -(mkdir($PODIR) || die "$PODIR: $!\n") unless -d $PODIR; - -system("$XGETTEXT -o $POTFILE *.c"); - -# Generate .po files for all languages: - -open(POT, $POTFILE) || die "$POTFILE: $!\n"; -@POT = ; -close(POT); - -for ($Index = 1; $LANGS[$Index]; $Index++) { - - $Authors = "# " . join("\n# ", split(/; */, $TRANSLATORS[$Index])) . "\n"; - - $POFILE = "$PODIR/$LANGS[$Index].po"; - open(PO, ">$POFILE") || die "$POFILE: $!\n"; - $msgid = ""; - for (@POT) { - next if (/^#, fuzzy$/); # skip the 'fuzzy' keyword - $msgid = $1 if (/^msgid (".+")/); - $date = $1 if (/POT-Creation-Date: (.*)\\n/); - $s = $_; - if (!$msgid) { - $s =~ s/SOME DESCRIPTIVE TITLE/$TITLE/; - $s =~ s/YEAR THE PACKAGE'S COPYRIGHT HOLDER/$COPYRIGHT/; - $s =~ s/PACKAGE/$PACKAGE/; - $s =~ s/VERSION/$VERSION/; - $s = $Authors if (/FIRST AUTHOR/); - $s =~ s/YEAR-MO-DA HO:MI\+ZONE/$date/; - $s =~ s/FULL NAME /$LASTTRANSLATOR[$Index]/; - $s =~ s/LANGUAGE /$LANGUAGETEAM/; - $s =~ s/CHARSET/$CHARSETS[$Index]/; - } - else { - $s =~ s/""/$Map{$msgid}[$Index]/ if ($msgid && /^msgstr ""/ && defined $Map{$msgid}[$Index]); - $Used{$msgid} = 1; - } - print PO $s; - } - close(PO); - } - -# Report missing phrases: - -for (keys %Map) { - push(@Missing, "$_\n") unless $Used{$_}; - } - -if (@Missing) { - print "Missing phrases (may need to use trNOOP):\n\n"; - print sort(@Missing); - } - -# Adjust the Makefile: - -$MAKEI18N = q{### Internationalization (I18N): - -PODIR = po -LOCALEDIR = $(VDRDIR)/locale -I18Npo = $(wildcard $(PODIR)/*.po) -I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) -I18Npot = $(PODIR)/$(PLUGIN).pot - -%.mo: %.po - msgfmt -c -o $@ $< - -$(I18Npot): $(wildcard *.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<} . $MSGIDBUGS . q{>' -o $@ $^ - -%.po: $(I18Npot) - msgmerge -U --no-wrap --no-location --backup=none -q $@ $< - @touch $@ - -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo - @mkdir -p $(dir $@) - cp $< $@ - -.PHONY: i18n -i18n: $(I18Nmsgs) - -}; - -open(OLD, "Makefile") || die "Makefile: $!"; -open(NEW, ">Makefile.new") || die "Makefile.new: $!"; -while () { - chomp; - if (/Targets:/) { - print NEW $MAKEI18N; - } - elsif (/^all:/) { - $_ .= " i18n"; - } - elsif (/^clean:/) { - $_ .= "\n\t\@-rm -f \$(PODIR)/*.mo \$(PODIR)/*.pot"; - } - print NEW "$_\n"; - } -close(NEW); -close(OLD); diff --git a/libsi/Makefile b/libsi/Makefile index 37be2f60..b24eb31d 100644 --- a/libsi/Makefile +++ b/libsi/Makefile @@ -1,7 +1,7 @@ # # Makefile for a libsi # -# $Id: Makefile 2.1 2010/11/07 13:31:05 kls Exp $ +# $Id: Makefile 2.2 2011/12/04 14:18:38 kls Exp $ ### The C++ compiler and options: @@ -52,4 +52,4 @@ clean: dist: tar cvzf libsi.tar.gz -C .. libsi/util.c libsi/si.c libsi/section.c libsi/descriptor.c \ - libsi/util.h libsi/si.h libsi/section.h libsi/descriptor.h libsi/headers.h libsi/Makefile libsi/gendescr.pl + libsi/util.h libsi/si.h libsi/section.h libsi/descriptor.h libsi/headers.h libsi/Makefile libsi/gendescr diff --git a/libsi/gendescr b/libsi/gendescr new file mode 100755 index 00000000..781340a7 --- /dev/null +++ b/libsi/gendescr @@ -0,0 +1,83 @@ +#!/usr/bin/perl + +# $Id: gendescr 1.2 2003/12/13 10:42:05 kls Exp $ + +print "Name (ohne ...Descriptor):"; +$name=; +$name =~ s/\n$//; +$inner = ($name =~ s/ä$//); +$name .= "Descriptor" unless ($inner); + +print "Struct:"; +$struct=; +$struct =~ s/\n$//; + +mm: +$index=0; +$which=1; +print "Variablen:"; +while ( ) { + if (/ä/) { + goto vv; + } elsif (/ü/) { + $which=1; + next; + } + $eingabe=$_; + $eingabe =~ s/(.{75,120} )/\1\n/g; + $eingabe =~ s/\n$//; + if ($which) { + $members[$index]=$eingabe; + } else { + $members_comments[$index]=$eingabe; + $index++; + print "Jep!\n"; + } + $which= (! $which); +} + +vv: +$filename_h="tempdescr.h"; +$filename_c="tempdescr.c"; +schreib(); + +sub schreib { + print "Danke.\n"; + open(OUTPUT_H, ">>".$filename_h) or die "Could not open file!!"; + open(OUTPUT_C, ">>".$filename_c) or die "Could not open file!!"; + + if ($inner) { + $offset=" "; + } else { + $offset=""; + } + print(OUTPUT_H $offset."class ".$name); + if ($inner) { + print(OUTPUT_H " : public LoopElement {\n".$offset."public:"); + } else { + print(OUTPUT_H " : public Descriptor {\n".$offset."public:"); + } + #for ($i=0; $i<=$#vars;$i++) { + # print (OUTPUT "/*\n".$vars_comments[$i]." */\n".$vars[$i].";\n\n\n"); + #} + for ($i=0; $i<=$#members;$i++) { + print (OUTPUT_H "\n".$offset." int get".$members[$i]."() const;"); + } + print(OUTPUT_H "\n".$offset."virtual int getLength() { return sizeof(".$struct."); }") if ($inner); + + print(OUTPUT_H "\n".$offset."protected:\n".$offset." virtual void Parse();"); + print(OUTPUT_H "\n".$offset."private:\n".$offset." const ".$struct." *s;") if ($struct ne ""); + print(OUTPUT_H "\n".$offset."};\n\n"); + for ($i=0; $i<=$#members_comments;$i++) { + print (OUTPUT_C "int ".$name."::get".$members[$i]."() const {\n"); + if ($members_comments[$i] =~ /^(.+)_hi$/) { + $varbase=$1; + print (OUTPUT_C " return HILO(s->".$varbase.");\n}\n\n"); + } else { + print (OUTPUT_C " return s->".$members_comments[$i].";\n}\n\n"); + } + } + print (OUTPUT_C "void ".$name."::Parse() {\n}\n\n"); + print (OUTPUT_C "\n\n\n"); + exit; +} diff --git a/libsi/gendescr.pl b/libsi/gendescr.pl deleted file mode 100755 index 8273f640..00000000 --- a/libsi/gendescr.pl +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -# $Id: gendescr.pl 1.2 2003/12/13 10:42:05 kls Exp $ - -print "Name (ohne ...Descriptor):"; -$name=; -$name =~ s/\n$//; -$inner = ($name =~ s/ä$//); -$name .= "Descriptor" unless ($inner); - -print "Struct:"; -$struct=; -$struct =~ s/\n$//; - -mm: -$index=0; -$which=1; -print "Variablen:"; -while ( ) { - if (/ä/) { - goto vv; - } elsif (/ü/) { - $which=1; - next; - } - $eingabe=$_; - $eingabe =~ s/(.{75,120} )/\1\n/g; - $eingabe =~ s/\n$//; - if ($which) { - $members[$index]=$eingabe; - } else { - $members_comments[$index]=$eingabe; - $index++; - print "Jep!\n"; - } - $which= (! $which); -} - -vv: -$filename_h="tempdescr.h"; -$filename_c="tempdescr.c"; -schreib(); - -sub schreib { - print "Danke.\n"; - open(OUTPUT_H, ">>".$filename_h) or die "Could not open file!!"; - open(OUTPUT_C, ">>".$filename_c) or die "Could not open file!!"; - - if ($inner) { - $offset=" "; - } else { - $offset=""; - } - print(OUTPUT_H $offset."class ".$name); - if ($inner) { - print(OUTPUT_H " : public LoopElement {\n".$offset."public:"); - } else { - print(OUTPUT_H " : public Descriptor {\n".$offset."public:"); - } - #for ($i=0; $i<=$#vars;$i++) { - # print (OUTPUT "/*\n".$vars_comments[$i]." */\n".$vars[$i].";\n\n\n"); - #} - for ($i=0; $i<=$#members;$i++) { - print (OUTPUT_H "\n".$offset." int get".$members[$i]."() const;"); - } - print(OUTPUT_H "\n".$offset."virtual int getLength() { return sizeof(".$struct."); }") if ($inner); - - print(OUTPUT_H "\n".$offset."protected:\n".$offset." virtual void Parse();"); - print(OUTPUT_H "\n".$offset."private:\n".$offset." const ".$struct." *s;") if ($struct ne ""); - print(OUTPUT_H "\n".$offset."};\n\n"); - for ($i=0; $i<=$#members_comments;$i++) { - print (OUTPUT_C "int ".$name."::get".$members[$i]."() const {\n"); - if ($members_comments[$i] =~ /^(.+)_hi$/) { - $varbase=$1; - print (OUTPUT_C " return HILO(s->".$varbase.");\n}\n\n"); - } else { - print (OUTPUT_C " return s->".$members_comments[$i].";\n}\n\n"); - } - } - print (OUTPUT_C "void ".$name."::Parse() {\n}\n\n"); - print (OUTPUT_C "\n\n\n"); - exit; -} diff --git a/summary2info b/summary2info new file mode 100755 index 00000000..fc633f92 --- /dev/null +++ b/summary2info @@ -0,0 +1,56 @@ +#!/usr/bin/perl + +# Convert 'summary.vdr' files to 'info.vdr' +# +# Converts all 'summary.vdr' files in the video directory to the +# 'info.vdr' format as used from VDR version 1.3.25 upward. +# +# Usage: summary2info /video +# +# See the main source file 'vdr.c' for copyright information and +# how to reach the author. +# +# $Id: summary2info 2.1 2011/12/04 14:17:35 kls Exp $ + +$VideoDir = $ARGV[0] || die "please provide the name of the video directory\n"; + +@SummaryFiles = `find "$VideoDir" -name summary.vdr`; + +for $SummaryFile (@SummaryFiles) { + chomp($SummaryFile); + print STDERR "converting $SummaryFile..."; + open(F, $SummaryFile) || die "$SummaryFile: $!\n"; + $line = 0; + @data = (); + while () { + chomp; + if ($_ || $line > 1) { + $data[$line] .= '|' if ($data[$line]); + $data[$line] .= $_; + } + else { + $line++; + } + } + close(F); + if (!$data[2]) { + $data[2] = $data[1]; + $data[1] = ""; + } + elsif ($data[1] && $data[2]) { + # if line 1 is too long, it can't be the short text, + # so assume the short text is missing and concatenate + # line 1 and line 2 to be the long text: + if (length($data[1]) > 80) { + $data[2] = $data[1] . "|" . $data[2]; + $data[1] = ""; + } + } + ($InfoFile = $SummaryFile) =~ s/summary\.vdr$/info.vdr/; + open(F, ">$InfoFile") || die "$InfoFile: $!\n"; + print F "T $data[0]\n" if ($data[0]); + print F "S $data[1]\n" if ($data[1]); + print F "D $data[2]\n" if ($data[2]); + close(F); + print STDERR "done.\n"; + } diff --git a/summary2info.pl b/summary2info.pl deleted file mode 100755 index 15300e5d..00000000 --- a/summary2info.pl +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/perl - -# Convert 'summary.vdr' files to 'info.vdr' -# -# Converts all 'summary.vdr' files in the video directory to the -# 'info.vdr' format as used from VDR version 1.3.25 upward. -# -# Usage: summary2info.pl /video -# -# See the main source file 'vdr.c' for copyright information and -# how to reach the author. -# -# $Id: summary2info.pl 1.6 2006/04/17 12:19:24 kls Exp $ - -$VideoDir = $ARGV[0] || die "please provide the name of the video directory\n"; - -@SummaryFiles = `find "$VideoDir" -name summary.vdr`; - -for $SummaryFile (@SummaryFiles) { - chomp($SummaryFile); - print STDERR "converting $SummaryFile..."; - open(F, $SummaryFile) || die "$SummaryFile: $!\n"; - $line = 0; - @data = (); - while () { - chomp; - if ($_ || $line > 1) { - $data[$line] .= '|' if ($data[$line]); - $data[$line] .= $_; - } - else { - $line++; - } - } - close(F); - if (!$data[2]) { - $data[2] = $data[1]; - $data[1] = ""; - } - elsif ($data[1] && $data[2]) { - # if line 1 is too long, it can't be the short text, - # so assume the short text is missing and concatenate - # line 1 and line 2 to be the long text: - if (length($data[1]) > 80) { - $data[2] = $data[1] . "|" . $data[2]; - $data[1] = ""; - } - } - ($InfoFile = $SummaryFile) =~ s/summary\.vdr$/info.vdr/; - open(F, ">$InfoFile") || die "$InfoFile: $!\n"; - print F "T $data[0]\n" if ($data[0]); - print F "S $data[1]\n" if ($data[1]); - print F "D $data[2]\n" if ($data[2]); - close(F); - print STDERR "done.\n"; - } -- cgit v1.2.3