From 7a5d3ffbfdbdabb6bf306b0c08687e88837196ba Mon Sep 17 00:00:00 2001 From: svntobi Date: Sun, 19 Aug 2007 09:13:05 +0000 Subject: renamed shell script, maded it explicitly use bash git-svn-id: file:///home/tobias/sandbox/vdr/--/vdr-pkg/vdr-pkg/submenu/trunk@5809 cd0d6b48-d4f9-0310-940f-ab8c4eb44d3f --- convert-submenu2menuorg.sh | 85 ---------------------------------------------- src/custommainmenuitem.cpp | 2 +- src/custommainmenuitem.h | 5 +++ src/i18n.h | 6 ++-- src/pluginmainmenuitem.cpp | 2 +- src/pluginmainmenuitem.h | 5 +++ src/xmlmenu.cpp | 27 ++++----------- src/xmlmenu.h | 2 +- submenu2menuorg | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 107 insertions(+), 112 deletions(-) delete mode 100755 convert-submenu2menuorg.sh create mode 100755 submenu2menuorg diff --git a/convert-submenu2menuorg.sh b/convert-submenu2menuorg.sh deleted file mode 100755 index 928ceab..0000000 --- a/convert-submenu2menuorg.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh -# -# vdr-menuorg - A plugin for the Linux Video Disk Recorder -# Copyright (C) 2007 Thomas Creutz, Tobias Grimm -# -# 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 -# -# $Id$ -# - -usage="convert-submenu2menuorg.sh submenu-file menuorg-file" - -if [ a"$1" == a"" ] || ! [ -f $1 ]; then echo $usage && exit 1; fi -if [ a"$2" == a"" ]; then echo $usage && exit 1; fi - -declare -a menu - -echo -n "read the input file... " -while read line -do - menuLevel=`echo $line|cut -d: -f1` - kindOfItem=`echo $line|cut -d: -f2` - name=`echo $line|cut -d: -f3` - - if [ a"$kindOfItem" != a"" ] && [ "$kindOfItem" != "0" ] - then - menu[$menuLevel]="${menu[$menuLevel]} 0;$name" - else - menu[$menuLevel]="${menu[$menuLevel]} $name" - fi -done < $1 -echo done - -echo -n "write the xml to the output file... " -echo "" > $2 -COUNT=0 -for item in `echo ${menu[$COUNT]}` -do - case $item - in - Schedule) echo " " >> $2;; - Channels) echo " " >> $2;; - Timers) echo " " >> $2;; - Recordings) echo " " >> $2;; - Setup) echo " " >> $2;; - Commands) echo " " >> $2;; - - 0*) - echo " " >> $2 - - COUNT=$(($COUNT+1)) - for Subitem in `echo ${menu[$COUNT]}` - do - case $Subitem - in - Schedule) echo " " >> $2;; - Channels) echo " " >> $2;; - Timers) echo " " >> $2;; - Recordings) echo " " >> $2;; - Setup) echo " " >> $2;; - Commands) echo " " >> $2;; - *) echo " " >> $2;; - esac - done - - echo " " >> $2 - ;; - - *) echo " " >> $2;; - esac -done -echo "" >> $2 -echo done diff --git a/src/custommainmenuitem.cpp b/src/custommainmenuitem.cpp index 2afded8..f2004ce 100644 --- a/src/custommainmenuitem.cpp +++ b/src/custommainmenuitem.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id$ + * $Id:$ * */ diff --git a/src/custommainmenuitem.h b/src/custommainmenuitem.h index 11316dd..1d18c1e 100644 --- a/src/custommainmenuitem.h +++ b/src/custommainmenuitem.h @@ -20,6 +20,9 @@ * */ +#ifndef ___CUSTOMMAINMENUITEM_H +#define ___CUSTOMMAINMENUITEM_H + #include class CustomMainMenuItem: public MenuOrgPatch::IMainMenuItem @@ -35,3 +38,5 @@ class CustomMainMenuItem: public MenuOrgPatch::IMainMenuItem virtual const char* PluginMenuEntry(); virtual int PluginIndex(); }; + +#endif diff --git a/src/i18n.h b/src/i18n.h index 1b4905b..739759c 100644 --- a/src/i18n.h +++ b/src/i18n.h @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id:$ + * $Id$ * */ -#ifndef _I18N__H -#define _I18N__H +#ifndef ___I18N__H +#define ___I18N__H #include diff --git a/src/pluginmainmenuitem.cpp b/src/pluginmainmenuitem.cpp index 6a47418..d617ee9 100644 --- a/src/pluginmainmenuitem.cpp +++ b/src/pluginmainmenuitem.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id$ + * $Id:$ * */ diff --git a/src/pluginmainmenuitem.h b/src/pluginmainmenuitem.h index ce54e3b..287ba0c 100644 --- a/src/pluginmainmenuitem.h +++ b/src/pluginmainmenuitem.h @@ -20,6 +20,9 @@ * */ +#ifndef ___PLUGINMAINMENUITEM_H +#define ___PLUGINMAINMENUITEM_H + #include class PluginMainMenuItem: public MenuOrgPatch::IMainMenuItem @@ -36,3 +39,5 @@ class PluginMainMenuItem: public MenuOrgPatch::IMainMenuItem virtual const char* PluginMenuEntry(); virtual int PluginIndex(); }; + +#endif diff --git a/src/xmlmenu.cpp b/src/xmlmenu.cpp index f4e36c4..4b09772 100644 --- a/src/xmlmenu.cpp +++ b/src/xmlmenu.cpp @@ -16,12 +16,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id$ + * $Id:$ * */ #include "xmlmenu.h" -#include #include #include #include @@ -38,10 +37,10 @@ MenuNode* XmlMenu::LoadXmlMenu(string menuFileName, string schemaFileName) try { - dsyslog("loading menuorg config file from %s and schema from %s",menuFileName.data(), schemaFileName.data()); + dsyslog("loading menuorg config file from %s and schema from %s", menuFileName.c_str(), schemaFileName.c_str()); DomParser parser; - parser.set_substitute_entities(); //We just want the text to be resolved/unescaped automatically. + parser.set_substitute_entities(); parser.parse_file(menuFileName); DtdValidator validator(schemaFileName); @@ -56,24 +55,9 @@ MenuNode* XmlMenu::LoadXmlMenu(string menuFileName, string schemaFileName) delete menuRoot; menuRoot = NULL; - //TODO: print output to syslog (isyslog or dsyslog?) - cout << "Exception caught: " << ex.what() << endl; - isyslog("Exception caught: %s", ex.what()); - //TODO: display message on osd + esyslog("Exception caught when parsing xml configuration: %s", ex.what()); } -/* - catch(const xmlpp::parse_error& ex) - { - // DTD or document is not well-formed - delete menuRoot; - menuRoot = NULL; - } - catch (const xmlpp::validation_error& ex) - { - // document is not valid - delete menuRoot; - menuRoot = NULL; - }*/ + return menuRoot; } @@ -179,5 +163,6 @@ bool XmlMenu::FindPluginByName(string name, const char** mainMenuEntry, int& plu } i++; } + return false; } diff --git a/src/xmlmenu.h b/src/xmlmenu.h index f8da182..55a595f 100644 --- a/src/xmlmenu.h +++ b/src/xmlmenu.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id$ + * $Id:$ * */ diff --git a/submenu2menuorg b/submenu2menuorg new file mode 100755 index 0000000..0a2888e --- /dev/null +++ b/submenu2menuorg @@ -0,0 +1,85 @@ +#!/bin/bash +# +# vdr-menuorg - A plugin for the Linux Video Disk Recorder +# Copyright (C) 2007 Thomas Creutz, Tobias Grimm +# +# 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 +# +# $Id$ +# + +usage="$0 submenu-file menuorg-file" + +if [ a"$1" == a"" ] || ! [ -f $1 ]; then echo $usage && exit 1; fi +if [ a"$2" == a"" ]; then echo $usage && exit 1; fi + +declare -a menu + +echo -n "read the input file... " +while read line +do + menuLevel=`echo $line|cut -d: -f1` + kindOfItem=`echo $line|cut -d: -f2` + name=`echo $line|cut -d: -f3` + + if [ a"$kindOfItem" != a"" ] && [ "$kindOfItem" != "0" ] + then + menu[$menuLevel]="${menu[$menuLevel]} 0;$name" + else + menu[$menuLevel]="${menu[$menuLevel]} $name" + fi +done < $1 +echo done + +echo -n "write the xml to the output file... " +echo "" > $2 +COUNT=0 +for item in `echo ${menu[$COUNT]}` +do + case $item + in + Schedule) echo " " >> $2;; + Channels) echo " " >> $2;; + Timers) echo " " >> $2;; + Recordings) echo " " >> $2;; + Setup) echo " " >> $2;; + Commands) echo " " >> $2;; + + 0*) + echo " " >> $2 + + COUNT=$(($COUNT+1)) + for Subitem in `echo ${menu[$COUNT]}` + do + case $Subitem + in + Schedule) echo " " >> $2;; + Channels) echo " " >> $2;; + Timers) echo " " >> $2;; + Recordings) echo " " >> $2;; + Setup) echo " " >> $2;; + Commands) echo " " >> $2;; + *) echo " " >> $2;; + esac + done + + echo " " >> $2 + ;; + + *) echo " " >> $2;; + esac +done +echo "" >> $2 +echo done -- cgit v1.2.3