From a8075bc638e458a8523f0c1f1fb8834a55a13fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sun, 13 Feb 2011 22:11:25 +0200 Subject: Improve SVDRP connection error handling, logging, and messages. --- HISTORY | 1 + po/cs.po | 6 +++--- po/de.po | 6 +++--- po/es.po | 6 +++--- po/fi.po | 6 +++--- po/fr.po | 6 +++--- po/it.po | 6 +++--- po/nl.po | 6 +++--- po/ru.po | 6 +++--- po/vdradmin.pot | 6 +++--- vdradmind.pl | 33 ++++++++++++++++++++++++++++----- 11 files changed, 56 insertions(+), 32 deletions(-) diff --git a/HISTORY b/HISTORY index 7c93875..62c8256 100644 --- a/HISTORY +++ b/HISTORY @@ -8,6 +8,7 @@ VDR-Portal: amair - Updated: Dutch translation (Submitted by Roel Koelewijn). - Updated: Finnish translation (Ville Skyttä). - Improved: Access logging (Ville Skyttä). +- Improved: SVDRP connection error handling/logging/messages (Ville Skyttä). 2010-04-10: 3.6.7 - Updated: Italian translation (Submitted by Diego Pierotto). diff --git a/po/cs.po b/po/cs.po index 374c9d9..008fafd 100644 --- a/po/cs.po +++ b/po/cs.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: cs\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2006-09-23 13:14+0200\n" "Last-Translator: Karel Borkovec \n" "Language-Team: Czech \n" @@ -1528,8 +1528,8 @@ msgid "Can't open file \"%s\"!" msgstr "Nemohu otevøít soubor \"%s\"!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Nemohu se pøipojit k VDR v %s:%s

Prosím zkontrolujte, zda VDR bì¾í a pokud je soubor soubor svdrphosts.conf øádnì nastaven." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Nemohu se pøipojit k VDR v %s:%s: %s

Prosím zkontrolujte, zda VDR bì¾í a pokud je soubor soubor svdrphosts.conf øádnì nastaven." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/de.po b/po/de.po index ec12c4e..8a85b22 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.5+cvs\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2009-12-30 19:31+0200\n" "Last-Translator: Andreas Mair \n" "Language-Team: German \n" @@ -1430,8 +1430,8 @@ msgid "Can't open file \"%s\"!" msgstr "Kann Datei \"%s\" nicht öffnen!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Konnte Verbindung zu %s:%s nicht aufbauen!

Bitte überprüfen Sie, dass VDR läuft und dass seine svdrphosts.conf richtig konfiguriert ist." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Konnte Verbindung zu %s:%s nicht aufbauen: %s

Bitte überprüfen Sie, dass VDR läuft und dass seine svdrphosts.conf richtig konfiguriert ist." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/es.po b/po/es.po index 43520bd..f1a1f0d 100644 --- a/po/es.po +++ b/po/es.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.6\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2010-02-11 22:46+0100\n" "Last-Translator: Manuel Gomez \n" "Language-Team: Spanish \n" @@ -1542,8 +1542,8 @@ msgid "Can't open file \"%s\"!" msgstr "¡No se pudo abrir el archivo \"%s\" !" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "No se puede conectar a VDR a %s:%s

Compruebe si VDR está en marcha y su svdrhosts.conf bien configurado." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "No se puede conectar a VDR a %s:%s: %s

Compruebe si VDR está en marcha y su svdrhosts.conf bien configurado." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/fi.po b/po/fi.po index ee52863..08ff896 100644 --- a/po/fi.po +++ b/po/fi.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.2\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2011-02-13 19:50+0200\n" "Last-Translator: Ville Skyttä \n" "Language-Team: Finnish \n" @@ -1439,8 +1439,8 @@ msgid "Can't open file \"%s\"!" msgstr "Tiedoston \"%s\" avaus ei onnistu!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Yhteydenotto VDR:ään (%s:%s) epäonnistui!

Varmista että VDR on käynnissä ja svdrphosts.conf-tiedoston oikeellisuus." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Yhteydenotto VDR:ään (%s:%s) epäonnistui: %s

Varmista että VDR on käynnissä ja svdrphosts.conf-tiedoston oikeellisuus." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/fr.po b/po/fr.po index 9262f21..4c1c34c 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.0\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2007-08-23 10:45+0100\n" "Last-Translator: Trois Six \n" "Language-Team: French \n" @@ -1450,8 +1450,8 @@ msgid "Can't open file \"%s\"!" msgstr "Ne peut pas ouvrir le fichier \"%s\" !" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Connexion impossible vers VDR %s:%s

Merci de vérifier que VDR est lancé et que le fichier svdrphosts.conf est configuré correctement." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Connexion impossible vers VDR %s:%s: %s

Merci de vérifier que VDR est lancé et que le fichier svdrphosts.conf est configuré correctement." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/it.po b/po/it.po index 4d90558..7c8e0e9 100644 --- a/po/it.po +++ b/po/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.6\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2010-03-29 01:02+0100\n" "Last-Translator: Diego Pierotto \n" "Language-Team: Italian \n" @@ -1441,8 +1441,8 @@ msgid "Can't open file \"%s\"!" msgstr "Non posso aprire il file \"%s\"!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Impossibile collegarsi a VDR al %s:%s

Controlla che VDR sia in esecuzione e che il file svdrphosts.conf di VDR sia configurato correttamente." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Impossibile collegarsi a VDR al %s:%s: %s

Controlla che VDR sia in esecuzione e che il file svdrphosts.conf di VDR sia configurato correttamente." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/nl.po b/po/nl.po index e4c57f9..7736ba6 100644 --- a/po/nl.po +++ b/po/nl.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: VDRAdmin-AM-3.6.7\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2010-08-13 13:36+0200\n" "Last-Translator: Roel Koelewijn \n" "Language-Team: Dutch \n" @@ -1432,8 +1432,8 @@ msgid "Can't open file \"%s\"!" msgstr "Kan bestand \"%s\" niet openen!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "Kan geen verbinding maken met VDR at %s:%s

Controleer of VDR draait en of VDR's svdrphosts.conf op de juiste manier is geconfigureerd." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "Kan geen verbinding maken met VDR at %s:%s: %s

Controleer of VDR draait en of VDR's svdrphosts.conf op de juiste manier is geconfigureerd." #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/ru.po b/po/ru.po index dfeaad3..cf82b36 100644 --- a/po/ru.po +++ b/po/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: ru\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: 2006-10-27 15:42+0100\n" "Last-Translator: Oleg Roitburd \n" "Language-Team: Russian \n" @@ -1473,8 +1473,8 @@ msgid "Can't open file \"%s\"!" msgstr "½Õ ÜÞÖÕâ ÞâÚàëâì äÐÙÛ \"%s\"!" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." -msgstr "½Õ ÜÞÓã áÞÕÔØÝØâìáï á VDR %s:%s

¿àÞÚÞÝâàÞÛØàãÙâÕ VDR Ø svdrphosts.conf" +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgstr "½Õ ÜÞÓã áÞÕÔØÝØâìáï á VDR %s:%s: %s

¿àÞÚÞÝâàÞÛØàãÙâÕ VDR Ø svdrphosts.conf" #, perl-format msgid "Error while sending command to VDR at %s" diff --git a/po/vdradmin.pot b/po/vdradmin.pot index 20024e0..69693c4 100644 --- a/po/vdradmin.pot +++ b/po/vdradmin.pot @@ -19,9 +19,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: VDRAdmin-AM 3.6.5+cvs\n" +"Project-Id-Version: VDRAdmin-AM 3.6.7\n" "Report-Msgid-Bugs-To: Andreas Mair \n" -"POT-Creation-Date: 2010-03-07 14:04+0100\n" +"POT-Creation-Date: 2011-02-13 21:52+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1442,7 +1442,7 @@ msgid "Can't open file \"%s\"!" msgstr "" #, perl-format -msgid "Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." +msgid "Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly." msgstr "" #, perl-format diff --git a/vdradmind.pl b/vdradmind.pl index f59e558..08a8985 100755 --- a/vdradmind.pl +++ b/vdradmind.pl @@ -3469,7 +3469,7 @@ sub LoadTranslation { forbidden_long => gettext("You don't have permission to access this function!"), forbidden_file => gettext("Access to file \"%s\" denied!"), cant_open => gettext("Can't open file \"%s\"!"), - connect_failed => gettext("Can't connect to VDR at %s:%s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly."), + connect_failed => gettext("Can't connect to VDR at %s:%s: %s

Please check if VDR is running and if VDR's svdrphosts.conf is configured correctly."), send_command => gettext("Error while sending command to VDR at %s"), ); @@ -6914,16 +6914,39 @@ sub myconnect { my $this = shift; main::Log(LOG_DEBUG, "[SVDRP] Connecting to $CONFIG{VDR_HOST}:$CONFIG{VDR_PORT}"); + my $connect_error = undef; $SOCKET = $VdrSocketModule->new(PeerAddr => $CONFIG{VDR_HOST}, PeerPort => $CONFIG{VDR_PORT}, Proto => 'tcp' - ) - || main::HTMLError(sprintf($ERROR_MESSAGE{connect_failed}, $CONFIG{VDR_HOST}, $CONFIG{VDR_PORT})) && return; + ); + my $line; + if ($SOCKET) { + chomp($line = <$SOCKET>); + main::Log(LOG_DEBUG, sprintf("[SVDRP] Read \"%s\"", $line)); + if ($line =~ /access\s+denied/i) { + # Blocked by svdrphosts.conf - VDR will close the connection + $this->close(); + $connect_error = $line; + } + } + else { + $connect_error = "$@"; + } + + if (defined($connect_error)) { + main::Log(main::LOG_WARNING, sprintf("Connection to %s:%s failed: %s", + $CONFIG{VDR_HOST}, + $CONFIG{VDR_PORT}, + $connect_error)); + main::HTMLError(sprintf($ERROR_MESSAGE{connect_failed}, + $CONFIG{VDR_HOST}, $CONFIG{VDR_PORT}, + CGI::escapeHTML($connect_error))); + return; + } $connected = true; - my $line; - $line = <$SOCKET>; + if (!$FEATURES{VDRVERSION}) { $line =~ /^220.*VideoDiskRecorder (\d+)\.(\d+)\.(\d+)([^;]*);/; $FEATURES{VDRVERSION_HR} = "$1.$2.$3$4"; -- cgit v1.2.3