diff options
author | Christian Wieninger <winni@debian.(none)> | 2007-11-11 15:40:28 +0100 |
---|---|---|
committer | Christian Wieninger <winni@debian.(none)> | 2007-11-11 15:40:28 +0100 |
commit | 8d4f8607dc1558ce73eb4c376bdbf78ddb65da83 (patch) | |
tree | d0c5dde81a36ab2e8a2edc7c1e6922556518b312 /patches | |
download | vdr-plugin-epgsearch-8d4f8607dc1558ce73eb4c376bdbf78ddb65da83.tar.gz vdr-plugin-epgsearch-8d4f8607dc1558ce73eb4c376bdbf78ddb65da83.tar.bz2 |
Initial commit
Diffstat (limited to 'patches')
-rw-r--r-- | patches/MainMenuHooks-v1_0.patch | 155 | ||||
-rw-r--r-- | patches/timercmd-0.1_1.3.23.diff | 178 | ||||
-rw-r--r-- | patches/timercmd-0.1_1.3.25.diff | 142 | ||||
-rw-r--r-- | patches/vdr-replace-schedulemenu.diff | 33 |
4 files changed, 508 insertions, 0 deletions
diff --git a/patches/MainMenuHooks-v1_0.patch b/patches/MainMenuHooks-v1_0.patch new file mode 100644 index 0000000..ee168e1 --- /dev/null +++ b/patches/MainMenuHooks-v1_0.patch @@ -0,0 +1,155 @@ +This is a "patch" for the Video Disk Recorder (VDR). + +* Authors: +Tobias Grimm <vdr at e-tobi dot net> +Martin Prochnow <nordlicht at martins-kabuff dot de> +Frank Schmirler <vdrdev at schmirler dot de> +Christian Wieninger <cwieninger at gmx dot de> + +* Description: +This patch allows plugins to replace the VDR mainmenus "Schedule", +"Channels", "Timers" and "Recordings" by a different implementation. + +The patch is based on a suggestion of Christian Wieninger back in 2006. +(http://www.linuxtv.org/pipermail/vdr/2006-March/008234.html). It is +meant to be an interim solution for VDR 1.4 until (maybe) VDR 1.5 +introduces an official API for this purpose. + +* Installation +Change into the VDR source directory, then issue + patch -p1 < path/to/MainMenuHooks-v1_0.patch +and recompile. + +* Notes for plugin authors +The following code sample shows the required plugin code for replacing +the original Schedule menu: + +bool cMyPlugin::Service(const char *Id, void *Data) +{ + cOsdMenu **menu = (cOsdMenu**) Data; + if (MySetup.replaceSchedule && + strcmp(Id, "MainMenuHooksPatch-v1.0::osSchedule") == 0) { + if (menu) + *menu = (cOsdMenu*) MainMenuAction(); + return true; + } + return false; +} + +A plugin can replace more than one menu at a time. Simply replace the +call to MainMenuAction() in the sample above by appropriate code). + +Note that a plugin *should* offer a setup option which allows the user +to enable or disable the replacement. "Disabled" would be a reasonable +default setting. By testing for define MAINMENUHOOKSVERSNUM, a plugin +can leave the setup option out at compiletime. + +In case there is an internal problem when trying to open the replacement +menu, it is safe to return true even though Data is NULL. However an +OSD message should indicate the problem to the user. + +Feel free to ship this patch along with your plugin. However if you +think you need to modify the patch, we'd encourage you to contact the +authors first or at least use a service id which differs in more than +just the version number. + +--- vdr-1.4.5/menu.c.orig 2007-02-07 08:23:49.000000000 +0100 ++++ vdr-1.4.5/menu.c 2007-02-20 11:05:34.000000000 +0100 +@@ -2792,15 +2792,30 @@ + + // Initial submenus: + ++ cOsdMenu *menu = NULL; + switch (State) { +- case osSchedule: AddSubMenu(new cMenuSchedule); break; +- case osChannels: AddSubMenu(new cMenuChannels); break; +- case osTimers: AddSubMenu(new cMenuTimers); break; +- case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break; +- case osSetup: AddSubMenu(new cMenuSetup); break; +- case osCommands: AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); break; ++ case osSchedule: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu)) ++ menu = new cMenuSchedule; ++ break; ++ case osChannels: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu)) ++ menu = new cMenuChannels; ++ break; ++ case osTimers: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu)) ++ menu = new cMenuTimers; ++ break; ++ case osRecordings: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu)) ++ menu = new cMenuRecordings(NULL, 0, true); ++ break; ++ case osSetup: menu = new cMenuSetup; break; ++ case osCommands: menu = new cMenuCommands(tr("Commands"), &Commands); break; + default: break; + } ++ if (menu) ++ AddSubMenu(menu); + } + + cOsdObject *cMenuMain::PluginOsdObject(void) +@@ -2927,13 +2942,34 @@ + eOSState state = cOsdMenu::ProcessKey(Key); + HadSubMenu |= HasSubMenu(); + ++ cOsdMenu *menu = NULL; + switch (state) { +- case osSchedule: return AddSubMenu(new cMenuSchedule); +- case osChannels: return AddSubMenu(new cMenuChannels); +- case osTimers: return AddSubMenu(new cMenuTimers); +- case osRecordings: return AddSubMenu(new cMenuRecordings); +- case osSetup: return AddSubMenu(new cMenuSetup); +- case osCommands: return AddSubMenu(new cMenuCommands(tr("Commands"), &Commands)); ++ case osSchedule: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osSchedule", &menu)) ++ menu = new cMenuSchedule; ++ else ++ state = osContinue; ++ break; ++ case osChannels: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osChannels", &menu)) ++ menu = new cMenuChannels; ++ else ++ state = osContinue; ++ break; ++ case osTimers: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osTimers", &menu)) ++ menu = new cMenuTimers; ++ else ++ state = osContinue; ++ break; ++ case osRecordings: ++ if (!cPluginManager::CallFirstService("MainMenuHooksPatch-v1.0::osRecordings", &menu)) ++ menu = new cMenuRecordings; ++ else ++ state = osContinue; ++ break; ++ case osSetup: menu = new cMenuSetup; break; ++ case osCommands: menu = new cMenuCommands(tr("Commands"), &Commands); break; + case osStopRecord: if (Interface->Confirm(tr("Stop recording?"))) { + cOsdItem *item = Get(Current()); + if (item) { +@@ -2985,6 +3021,8 @@ + default: break; + } + } ++ if (menu) ++ return AddSubMenu(menu); + if (!HasSubMenu() && Update(HadSubMenu)) + Display(); + if (Key != kNone) { +--- vdr-1.4.5/config.h.orig 2007-02-20 11:55:40.000000000 +0100 ++++ vdr-1.4.5/config.h 2007-02-20 11:56:43.000000000 +0100 +@@ -35,6 +35,8 @@ + // plugins to work with newer versions of the core VDR as long as no + // VDR header files have changed. + ++#define MAINMENUHOOKSVERSNUM 1.0 ++ + #define MAXPRIORITY 99 + #define MAXLIFETIME 99 + diff --git a/patches/timercmd-0.1_1.3.23.diff b/patches/timercmd-0.1_1.3.23.diff new file mode 100644 index 0000000..e5d2f3f --- /dev/null +++ b/patches/timercmd-0.1_1.3.23.diff @@ -0,0 +1,178 @@ +diff -Nru vdr-1.3.23-orig/config.c vdr-1.3.23-timercmd/config.c +--- vdr-1.3.23-orig/config.c 2005-02-20 13:52:59.000000000 +0100 ++++ vdr-1.3.23-timercmd/config.c 2005-03-29 20:08:21.000000000 +0200 +@@ -141,6 +141,7 @@ + + cCommands Commands; + cCommands RecordingCommands; ++cCommands TimerCommands; + + // -- cSVDRPhosts ------------------------------------------------------------ + +diff -Nru vdr-1.3.23-orig/config.h vdr-1.3.23-timercmd/config.h +--- vdr-1.3.23-orig/config.h 2005-03-05 16:44:35.000000000 +0100 ++++ vdr-1.3.23-timercmd/config.h 2005-03-29 20:08:46.000000000 +0200 +@@ -173,6 +173,7 @@ + + extern cCommands Commands; + extern cCommands RecordingCommands; ++extern cCommands TimerCommands; + extern cSVDRPhosts SVDRPhosts; + extern cCaDefinitions CaDefinitions; + +diff -Nru vdr-1.3.23-orig/i18n.c vdr-1.3.23-timercmd/i18n.c +--- vdr-1.3.23-orig/i18n.c 2005-03-12 11:43:16.000000000 +0100 ++++ vdr-1.3.23-timercmd/i18n.c 2005-04-14 19:20:22.000000000 +0200 +@@ -315,6 +315,27 @@ + "Salvestuse käsud", + "Optage kommandoer", + }, ++ { "Timer commands", ++ "Befehle für Timer", ++ "Ukazi za termine", ++ "Timer comandi", ++ "",// "Nederlands" ++ "",// "Português" ++ "Commandes de programmation", ++ "Timer kommandoer", ++ "Ajastinkomennot", ++ "",// "Polski" ++ "Comandos de programacion", ++ "",// "ÅëëçíéêÜ", // Greek ++ "Timer kommandon", ++ "Comenzi timer", ++ "",// "Magyar" ++ "Ordres de programació", ++ "",// "ÀãááÚØÙ", // Russian ++ "Naredbe za termine", ++ "",// "Eesti" ++ "",// "Dansk" ++ }, + { "Edit channel", + "Kanal editieren", + "Uredi kanal", +diff -Nru vdr-1.3.23-orig/menu.c vdr-1.3.23-timercmd/menu.c +--- vdr-1.3.23-orig/menu.c 2005-03-20 16:14:51.000000000 +0100 ++++ vdr-1.3.23-timercmd/menu.c 2005-04-28 14:28:33.000000000 +0200 +@@ -707,8 +707,20 @@ + return state; + } + +-// --- cMenuTimerItem -------------------------------------------------------- ++// --- cMenuCommands --------------------------------------------------------- ++// declaration shifted so it can be used in cMenuTimers ++class cMenuCommands : public cOsdMenu { ++private: ++ cCommands *commands; ++ char *parameters; ++ eOSState Execute(void); ++public: ++ cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); ++ virtual ~cMenuCommands(); ++ virtual eOSState ProcessKey(eKeys Key); ++ }; + ++// --- cMenuTimerItem -------------------------------------------------------- + class cMenuTimerItem : public cOsdItem { + private: + cTimer *timer; +@@ -773,6 +785,7 @@ + virtual void Move(int From, int To); + eOSState Summary(void); + cTimer *CurrentTimer(void); ++ eOSState Commands(eKeys Key = kNone); + public: + cMenuTimers(void); + virtual ~cMenuTimers(); +@@ -876,6 +889,53 @@ + return Edit(); // convenience for people not using the Summary feature ;-) + } + ++#define CHECK_2PTR_NULL(x_,y_) ((x_)? ((y_)? y_:""):"") ++ ++eOSState cMenuTimers::Commands(eKeys Key) ++{ ++ if (HasSubMenu() || Count() == 0) ++ return osContinue; ++ cTimer *ti = CurrentTimer(); ++ if (ti) { ++ char *parameter = NULL; ++ const cEvent *pEvent = ti->Event(); ++ int iRecNumber=0; ++ ++ if(!pEvent) { ++ Timers.SetEvents(); ++ pEvent = ti->Event(); ++ } ++ if(pEvent) { ++// create a dummy recording to get the real filename ++ cRecording *rc_dummy = new cRecording(ti, pEvent->Title(), pEvent->ShortText(), ""); ++ Recordings.Load(); ++ cRecording *rc = Recordings.GetByName(rc_dummy->FileName()); ++ ++ delete rc_dummy; ++ if(rc) ++ iRecNumber=rc->Index() + 1; ++ } ++//Parameter format TimerNumber 'ChannelId' Start Stop 'Titel' 'Subtitel' 'file' RecNumer ++// 1 2 3 4 5 6 7 8 ++ asprintf(¶meter, "%d '%s' %d %d '%s' '%s' '%s' %d", ti->Index(), ++ *ti->Channel()->GetChannelID().ToString(), ++ (int)ti->StartTime(), ++ (int)ti->StopTime(), ++ CHECK_2PTR_NULL(pEvent, pEvent->Title()), ++ CHECK_2PTR_NULL(pEvent, pEvent->ShortText()), ++ ti->File(), ++ iRecNumber); ++ isyslog("timercmd: %s", parameter); ++ cMenuCommands *menu; ++ eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Timer commands"), &TimerCommands, parameter)); ++ free(parameter); ++ if (Key != kNone) ++ state = menu->ProcessKey(Key); ++ return state; ++ } ++ return osContinue; ++} ++ + eOSState cMenuTimers::ProcessKey(eKeys Key) + { + int TimerNumber = HasSubMenu() ? Count() : -1; +@@ -892,6 +951,8 @@ + else + Mark(); + break; ++ case k1...k9: return Commands(Key); ++ case k0: return (TimerCommands.Count()? Commands():osContinue); + default: break; + } + } +@@ -1240,17 +1301,6 @@ + + // --- cMenuCommands --------------------------------------------------------- + +-class cMenuCommands : public cOsdMenu { +-private: +- cCommands *commands; +- char *parameters; +- eOSState Execute(void); +-public: +- cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); +- virtual ~cMenuCommands(); +- virtual eOSState ProcessKey(eKeys Key); +- }; +- + cMenuCommands::cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters) + :cOsdMenu(Title) + { +diff -Nru vdr-1.3.23-orig/vdr.c vdr-1.3.23-timercmd/vdr.c +--- vdr-1.3.23-orig/vdr.c 2005-03-20 11:58:59.000000000 +0100 ++++ vdr-1.3.23-timercmd/vdr.c 2005-03-29 20:05:57.000000000 +0200 +@@ -393,6 +393,7 @@ + Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")) && + Commands.Load(AddDirectory(ConfigDirectory, "commands.conf"), true) && + RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) && ++ TimerCommands.Load(AddDirectory(ConfigDirectory, "timercmds.conf"), true) && + SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) && + CaDefinitions.Load(AddDirectory(ConfigDirectory, "ca.conf"), true) && + Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) && diff --git a/patches/timercmd-0.1_1.3.25.diff b/patches/timercmd-0.1_1.3.25.diff new file mode 100644 index 0000000..331330b --- /dev/null +++ b/patches/timercmd-0.1_1.3.25.diff @@ -0,0 +1,142 @@ +diff -ruN7p1 vdr-1.3.25-orig/config.c vdr-1.3.25/config.c +--- vdr-1.3.25-orig/config.c 2005-02-20 13:52:59.000000000 +0100 ++++ vdr-1.3.25/config.c 2005-05-31 00:07:56.000000000 +0200 +@@ -143,2 +143,3 @@ cCommands Commands; + cCommands RecordingCommands; ++cCommands TimerCommands; + +diff -ruN7p1 vdr-1.3.25-orig/config.h vdr-1.3.25/config.h +--- vdr-1.3.25-orig/config.h 2005-05-14 11:18:08.000000000 +0200 ++++ vdr-1.3.25/config.h 2005-05-31 00:07:56.000000000 +0200 +@@ -175,2 +175,3 @@ extern cCommands Commands; + extern cCommands RecordingCommands; ++extern cCommands TimerCommands; + extern cSVDRPhosts SVDRPhosts; +diff -ruN7p1 vdr-1.3.25-orig/i18n.c vdr-1.3.25/i18n.c +--- vdr-1.3.25-orig/i18n.c 2005-05-15 16:37:59.000000000 +0200 ++++ vdr-1.3.25/i18n.c 2005-05-31 00:07:56.000000000 +0200 +@@ -317,2 +317,23 @@ const tI18nPhrase Phrases[] = { + }, ++ { "Timer commands", ++ "Befehle für Timer", ++ "Ukazi za termine", ++ "Timer comandi", ++ "",// "Nederlands" ++ "",// "Português" ++ "Commandes de programmation", ++ "Timer kommandoer", ++ "Ajastinkomennot", ++ "",// "Polski" ++ "Comandos de programacion", ++ "",// "ÅëëçíéêÜ", // Greek ++ "Timer kommandon", ++ "Comenzi timer", ++ "",// "Magyar" ++ "Ordres de programació", ++ "",// "ÀãááÚØÙ", // Russian ++ "Naredbe za termine", ++ "",// "Eesti" ++ "",// "Dansk" ++ }, + { "Edit channel", +diff -ruN7p1 vdr-1.3.25-orig/menu.c vdr-1.3.25/menu.c +--- vdr-1.3.25-orig/menu.c 2005-05-16 15:59:03.000000000 +0200 ++++ vdr-1.3.25/menu.c 2005-05-31 00:12:31.000000000 +0200 +@@ -709,4 +709,16 @@ eOSState cMenuEditTimer::ProcessKey(eKey + +-// --- cMenuTimerItem -------------------------------------------------------- ++// --- cMenuCommands --------------------------------------------------------- ++// declaration shifted so it can be used in cMenuTimers ++class cMenuCommands : public cOsdMenu { ++private: ++ cCommands *commands; ++ char *parameters; ++ eOSState Execute(void); ++public: ++ cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); ++ virtual ~cMenuCommands(); ++ virtual eOSState ProcessKey(eKeys Key); ++ }; + ++// --- cMenuTimerItem -------------------------------------------------------- + class cMenuTimerItem : public cOsdItem { +@@ -775,2 +787,3 @@ private: + cTimer *CurrentTimer(void); ++ eOSState Commands(eKeys Key = kNone); + public: +@@ -877,2 +890,49 @@ eOSState cMenuTimers::Summary(void) + ++#define CHECK_2PTR_NULL(x_,y_) ((x_)? ((y_)? y_:""):"") ++ ++eOSState cMenuTimers::Commands(eKeys Key) ++{ ++ if (HasSubMenu() || Count() == 0) ++ return osContinue; ++ cTimer *ti = CurrentTimer(); ++ if (ti) { ++ char *parameter = NULL; ++ const cEvent *pEvent = ti->Event(); ++ int iRecNumber=0; ++ ++ if(!pEvent) { ++ Timers.SetEvents(); ++ pEvent = ti->Event(); ++ } ++ if(pEvent) { ++// create a dummy recording to get the real filename ++ cRecording *rc_dummy = new cRecording(ti, pEvent); ++ Recordings.Load(); ++ cRecording *rc = Recordings.GetByName(rc_dummy->FileName()); ++ ++ delete rc_dummy; ++ if(rc) ++ iRecNumber=rc->Index() + 1; ++ } ++//Parameter format TimerNumber 'ChannelId' Start Stop 'Titel' 'Subtitel' 'file' RecNumer ++// 1 2 3 4 5 6 7 8 ++ asprintf(¶meter, "%d '%s' %d %d '%s' '%s' '%s' %d", ti->Index(), ++ *ti->Channel()->GetChannelID().ToString(), ++ (int)ti->StartTime(), ++ (int)ti->StopTime(), ++ CHECK_2PTR_NULL(pEvent, pEvent->Title()), ++ CHECK_2PTR_NULL(pEvent, pEvent->ShortText()), ++ ti->File(), ++ iRecNumber); ++ isyslog("timercmd: %s", parameter); ++ cMenuCommands *menu; ++ eOSState state = AddSubMenu(menu = new cMenuCommands(tr("Timer commands"), &TimerCommands, parameter)); ++ free(parameter); ++ if (Key != kNone) ++ state = menu->ProcessKey(Key); ++ return state; ++ } ++ return osContinue; ++} ++ + eOSState cMenuTimers::ProcessKey(eKeys Key) +@@ -893,2 +952,4 @@ eOSState cMenuTimers::ProcessKey(eKeys K + break; ++ case k1...k9: return Commands(Key); ++ case k0: return (TimerCommands.Count()? Commands():osContinue); + default: break; +@@ -1241,13 +1302,2 @@ eOSState cMenuSchedule::ProcessKey(eKeys + +-class cMenuCommands : public cOsdMenu { +-private: +- cCommands *commands; +- char *parameters; +- eOSState Execute(void); +-public: +- cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters = NULL); +- virtual ~cMenuCommands(); +- virtual eOSState ProcessKey(eKeys Key); +- }; +- + cMenuCommands::cMenuCommands(const char *Title, cCommands *Commands, const char *Parameters) +diff -ruN7p1 vdr-1.3.25-orig/vdr.c vdr-1.3.25/vdr.c +--- vdr-1.3.25-orig/vdr.c 2005-05-26 12:45:29.000000000 +0200 ++++ vdr-1.3.25/vdr.c 2005-05-31 00:07:56.000000000 +0200 +@@ -395,2 +395,3 @@ int main(int argc, char *argv[]) + RecordingCommands.Load(AddDirectory(ConfigDirectory, "reccmds.conf"), true) && ++ TimerCommands.Load(AddDirectory(ConfigDirectory, "timercmds.conf"), true) && + SVDRPhosts.Load(AddDirectory(ConfigDirectory, "svdrphosts.conf"), true) && diff --git a/patches/vdr-replace-schedulemenu.diff b/patches/vdr-replace-schedulemenu.diff new file mode 100644 index 0000000..689eb5f --- /dev/null +++ b/patches/vdr-replace-schedulemenu.diff @@ -0,0 +1,33 @@ +--- menu.c.org 2005-06-18 12:31:52.000000000 +0200 ++++ menu.c 2005-07-04 19:47:42.000000000 +0200 +@@ -2447,7 +2447,11 @@ + // Initial submenus: + + switch (State) { +- case osSchedule: AddSubMenu(new cMenuSchedule); break; ++ case osSchedule: { ++ cPlugin *p = cPluginManager::GetPlugin("epgsearch"); ++ (p && !p->SetupParse("IsOrgSchedule", "0")) ? AddSubMenu((cOsdMenu *)p->MainMenuAction()) : AddSubMenu(new cMenuSchedule); ++ } ++ break; + case osChannels: AddSubMenu(new cMenuChannels); break; + case osTimers: AddSubMenu(new cMenuTimers); break; + case osRecordings: AddSubMenu(new cMenuRecordings(NULL, 0, true)); break; +@@ -2553,7 +2557,16 @@ + HadSubMenu |= HasSubMenu(); + + switch (state) { +- case osSchedule: return AddSubMenu(new cMenuSchedule); ++ case osSchedule: { ++ cPlugin *p = cPluginManager::GetPlugin("epgsearch"); ++ if (p && !p->SetupParse("IsOrgSchedule", "0")) { ++ return AddSubMenu((cOsdMenu *)p->MainMenuAction()); ++ state = osEnd; ++ } ++ else ++ return AddSubMenu(new cMenuSchedule); ++ } ++ break; + case osChannels: return AddSubMenu(new cMenuChannels); + case osTimers: return AddSubMenu(new cMenuTimers); + case osRecordings: return AddSubMenu(new cMenuRecordings); |