diff options
author | Andreas Mair <andreas@vdr-developer.org> | 2010-05-29 16:49:55 +0200 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2010-05-29 16:49:55 +0200 |
commit | 1fda8cf45d61fac1d03a7381625f73e8e8909e4b (patch) | |
tree | 4911b0cb3844df49abdd4c3c9d13801a4a9ce717 | |
parent | 916da87bf4b739215aa921cda97a36b816e5ba41 (diff) | |
download | vdr-plugin-extrecmenu-1fda8cf45d61fac1d03a7381625f73e8e8909e4b.tar.gz vdr-plugin-extrecmenu-1fda8cf45d61fac1d03a7381625f73e8e8909e4b.tar.bz2 |
Version 1.2-test1-am3v1.2-test1-am3
- Support new reccmds.conf file as introduced in VDR v1.7.12.
- Edit lifetime and priority only for PES recordings.
- include Make.global.
-rw-r--r-- | CHANGES.AM | 5 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | extrecmenu.c | 4 | ||||
-rw-r--r-- | mymenucommands.c | 95 | ||||
-rw-r--r-- | mymenucommands.h | 14 | ||||
-rw-r--r-- | mymenurecordings.c | 12 | ||||
-rw-r--r-- | mymenusetup.c | 4 | ||||
-rw-r--r-- | mymenusetup.h | 4 |
8 files changed, 136 insertions, 6 deletions
@@ -1,5 +1,10 @@ Changes by Andreas Mair <andreas _AT_ vdr-developer.org> +* 1.2-test1-AM3 +- Support new reccmds.conf file as introduced in VDR v1.7.12. +- Edit lifetime and priority only for PES recordings. +- include Make.global. + * 1.2-test1-AM2b - fixed PES cutting using cutting queue (Reported by tomas @vdr-portal.de). - fixed some gcc warnings and errors (Based on suggestions by Zzam @vdr-portal.de). @@ -26,6 +26,10 @@ VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp +### Make sure that necessary options are included: + +-include $(VDRDIR)/Make.global + ### Allow user defined options to overwrite defaults: -include $(VDRDIR)/Make.config diff --git a/extrecmenu.c b/extrecmenu.c index 0aac138..29f7515 100644 --- a/extrecmenu.c +++ b/extrecmenu.c @@ -11,7 +11,7 @@ using namespace std; -static const char *VERSION = "1.2-test1-am2b"; +static const char *VERSION = "1.2-test1-am3"; static const char *DESCRIPTION = tr("Extended recordings menu"); static const char *MAINMENUENTRY = "ExtRecMenu"; @@ -74,7 +74,7 @@ bool cPluginExtrecmenu::Start(void) MoveCutterThread=new WorkerThread(); - RecordingDirCommands.Load(AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "dircmds.conf"), true); + RecordingDirCommands.Load(AddDirectory(cPlugin::ConfigDirectory(PLUGIN_NAME_I18N), "dircmds.conf")); return true; } diff --git a/mymenucommands.c b/mymenucommands.c index 237c1f9..ef81fc5 100644 --- a/mymenucommands.c +++ b/mymenucommands.c @@ -9,32 +9,117 @@ #include <vdr/interface.h> #include "mymenucommands.h" +#if VDRVERSNUM >= 10713 +myMenuCommands::myMenuCommands(const char *Title,cList<cNestedItem> *_Commands,const char *Parameters):cOsdMenu(Title) +#else myMenuCommands::myMenuCommands(const char *Title,cCommands *_Commands,const char *Parameters):cOsdMenu(Title) +#endif { SetHasHotkeys(); commands=_Commands; +#if VDRVERSNUM >= 10713 + result=NULL; + parameters=Parameters; + for(cNestedItem *Command=commands->First();Command;Command=commands->Next(Command)) { + const char *s=Command->Text(); + if(Command->SubItems()) + Add(new cOsdItem(hk(cString::sprintf("%s...", s)))); + else if(Parse(s)) + Add(new cOsdItem(hk(title))); + } +#else parameters=Parameters?strdup(Parameters):NULL; for(cCommand *command=commands->First();command;command=commands->Next(command)) Add(new cOsdItem(hk(command->Title()))); +#endif } myMenuCommands::~myMenuCommands() { +#if VDRVERSNUM >= 10713 + free(result); +#else free(parameters); +#endif +} + +#if VDRVERSNUM >= 10713 +bool myMenuCommands::Parse(const char *s) +{ + const char *p=strchr(s,':'); + if(p) { + int l=p-s; + if(l>0) { + char t[l+1]; + stripspace(strn0cpy(t,s,l+1)); + l=strlen(t); + if(l>1&&t[l-1]=='?') { + t[l-1]=0; + confirm=true; + } + else + confirm=false; + title=t; + command=skipspace(p+1); + return true; + } + } + return false; } eOSState myMenuCommands::Execute() { + cNestedItem *Command=commands->Get(Current()); + if(Command) { + if(Command->SubItems()) + return AddSubMenu(new myMenuCommands(Title(),Command->SubItems(),parameters)); + if(Parse(Command->Text())) { + if(!confirm||Interface->Confirm(cString::sprintf("%s?",*title))) { + Skins.Message(mtStatus,cString::sprintf("%s...",*title)); + free(result); + result=NULL; + cString cmdbuf; + if(!isempty(parameters)) + cmdbuf=cString::sprintf("%s %s",*command,*parameters); + const char *cmd=*cmdbuf?*cmdbuf:*command; + dsyslog("executing command '%s'",cmd); + cPipe p; + if(p.Open(cmd,"r")) { + int l=0; + int c; + while((c=fgetc(p))!=EOF) { + if(l%20==0) + result=(char *)realloc(result,l+21); + result[l++]=char(c); + } + if(result) + result[l]=0; + p.Close(); + } + else + esyslog("ERROR: can't open pipe for command '%s'",cmd); + Skins.Message(mtStatus,NULL); + if(result) + return AddSubMenu(new cMenuText(title,result,fontFix)); + return osEnd; + } + } + } + return osContinue; +} +#else //VDRVERSNUM < 10713 +eOSState myMenuCommands::Execute() +{ cCommand *command=commands->Get(Current()); if(command) { char *buffer=NULL; bool confirmed=true; #ifdef CMDSUBMENUVERSNUM - if (command->hasChilds()) { - AddSubMenu(new myMenuCommands(command->Title(), command->getChilds(), parameters)); - return osContinue; - } + if (command->hasChilds()) { + AddSubMenu(new myMenuCommands(command->Title(), command->getChilds(), parameters)); + return osContinue; + } #endif if(command->Confirm()) { asprintf(&buffer,"%s?",command->Title()); @@ -56,6 +141,8 @@ eOSState myMenuCommands::Execute() return osContinue; } +#endif + eOSState myMenuCommands::ProcessKey(eKeys Key) { eOSState state=cOsdMenu::ProcessKey(Key); diff --git a/mymenucommands.h b/mymenucommands.h index 3834c85..7ba3f01 100644 --- a/mymenucommands.h +++ b/mymenucommands.h @@ -1,11 +1,25 @@ class myMenuCommands:public cOsdMenu { private: +#if VDRVERSNUM >= 10713 + cList<cNestedItem> *commands; + cString parameters; + cString title; + cString command; + bool confirm; + char *result; + bool Parse(const char *s); +#else cCommands *commands; char *parameters; +#endif eOSState Execute(void); public: +#if VDRVERSNUM >= 10713 + myMenuCommands(const char *Title, cList<cNestedItem> *Commands, const char *Parameters = NULL); +#else myMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); +#endif virtual ~myMenuCommands(); virtual eOSState ProcessKey(eKeys Key); }; diff --git a/mymenurecordings.c b/mymenurecordings.c index 4286d25..c5bdfef 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -902,7 +902,11 @@ eOSState myMenuRecordings::Details() if(item && !item->IsDirectory()) { cRecording *recording=GetRecording(item); +#if VDRVERSNUM >= 10703 + if(recording && recording->IsPesRecording()) +#else if(recording) +#endif return AddSubMenu(new myMenuRecordingDetails(recording)); } return osContinue; @@ -1029,7 +1033,11 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) case kRed: return Rename(); case kGreen: return MoveRec(); case kYellow: return Delete(); +#if VDRVERSNUM >= 10703 + case kBlue: if(item&&!item->IsDVD()&&item->IsPesRecording()) +#else case kBlue: if(item&&!item->IsDVD()) +#endif return Details(); else break; @@ -1113,7 +1121,11 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) else { edit=true; +#if VDRVERSNUM >= 10703 + SetHelp(tr("Button$Rename"),tr("Button$Move"),tr("Button$Delete"),(item->IsPesRecording()&&!item->IsDVD())?tr("Details"):NULL); +#else SetHelp(tr("Button$Rename"),tr("Button$Move"),tr("Button$Delete"),(!item->IsDVD())?tr("Details"):NULL); +#endif } } } diff --git a/mymenusetup.c b/mymenusetup.c index 03f15b6..1dd1762 100644 --- a/mymenusetup.c +++ b/mymenusetup.c @@ -5,7 +5,11 @@ #include <vdr/menu.h> #include "mymenusetup.h" +#if VDRVERSNUM >= 10713 +cNestedItemList RecordingDirCommands; +#else cCommands RecordingDirCommands; +#endif mySetup::mySetup() { diff --git a/mymenusetup.h b/mymenusetup.h index e263e7f..325eb5e 100644 --- a/mymenusetup.h +++ b/mymenusetup.h @@ -1,6 +1,10 @@ #include <vdr/menu.h> +#if VDRVERSNUM >= 10713 +extern cNestedItemList RecordingDirCommands; +#else extern cCommands RecordingDirCommands; +#endif class mySetup { |