diff options
author | Martin Prochnow <nordlicht@martins-kabuff.de> | 2006-04-17 17:00:18 +0200 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2006-04-17 17:00:18 +0200 |
commit | 3c04e4ce347dff915def3a79f348f2f46e60564d (patch) | |
tree | 51defa818f251ce9d70472ad202b85165c6837fc | |
parent | 82bfd4c15949019ede37b2b04be79659c5c65dbe (diff) | |
download | vdr-plugin-extrecmenu-3c04e4ce347dff915def3a79f348f2f46e60564d.tar.gz vdr-plugin-extrecmenu-3c04e4ce347dff915def3a79f348f2f46e60564d.tar.bz2 |
Version 0.9av0.9a
- fixed #ifdef's for JumpPlay-patch in myreplaycontrol.c; thanks to Thomas Günther for reporting
- include fixed 'dvdarchive.sh', umount wasn't possible; thanks to Mase from vdr-portal.de for reporting
- added support for CmdSubMenu-patch, it should now be possible to use sub menus if you patched your VDR with BigPatch or CmdSubMenu-patch
-rw-r--r-- | HISTORY | 8 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README | 12 | ||||
-rw-r--r-- | extrecmenu.h | 2 | ||||
-rw-r--r-- | mymenucommands.c | 9 | ||||
-rw-r--r-- | mymenueditrecording.c (renamed from mymenumoverecording.c) | 104 | ||||
-rw-r--r-- | mymenurecordingdetails.c | 48 | ||||
-rw-r--r-- | mymenurecordings.c | 40 | ||||
-rw-r--r-- | mymenurenamerecording.c | 70 | ||||
-rw-r--r-- | myreplaycontrol.c | 16 | ||||
-rw-r--r-- | myreplaycontrol.h | 2 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh | 10 | ||||
-rw-r--r-- | tools.c | 4 |
13 files changed, 167 insertions, 163 deletions
@@ -1,6 +1,14 @@ VDR Plugin 'extrecmenu' Revision History ---------------------------------------- +2006-04-17: Version 0.9a +- fixed #ifdef's for JumpPlay-patch in myreplaycontrol.c; thanks to Thomas + Günther for reporting +- include fixed 'dvdarchive.sh', umount wasn't possible; thanks to Mase from + vdr-portal.de for reporting +- added support for CmdSubMenu-patch, it should now be possible to use sub + menus if you patched your VDR with BigPatch or CmdSubMenu-patch + 2006-04-10: Version 0.9 - removed myDvbPlayer, use VDR's cDvbPlayer instead - made adjustments to work with BigPatch-VDRs (JumpPlay-patch) @@ -46,9 +46,8 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): -OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o mymenurenamerecording.o \ - mymenumoverecording.o i18n.o mymenurecordinginfo.o mymenusetup.o \ - mymenucommands.o patchfont.o tools.o mymenurecordingdetails.o +OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o i18n.o mymenurecordinginfo.o \ + mymenusetup.o mymenucommands.o patchfont.o tools.o mymenueditrecording.o ### Implicit rules: @@ -15,7 +15,7 @@ rename or move recordings. The display of recording date, time and length is configurable. The plugin also handles archive dvd's of VDR recordings (as known from the DVDArchive-patch for VDR). -Handling +Editing ------------------------------------------------------------------------------- Renaming: Select a recording, press 'Yellow', then 'Red'. Type in/edit the name. By pressing 'Ok', the recording will be renamed with this name. @@ -25,6 +25,9 @@ base directory of the /video-directory-hierarchy. 'Ok' opens sub-directories, with 'Yellow' you can create new dirs. 'Blue' moves the recording to the selected directory. +Details: Select a recording, press 'Yellow', then 'Blue'. In this menu you can +edit the lifetime and priority of the selected recording. + Sort recordings ------------------------------------------------------------------------------- There are four options for sorting at the setup menu: @@ -37,7 +40,7 @@ Flexible means, if the directory name ends with "-",".","$" or "ª", the recordings in this directory are sorted by name, else by date. -DVD-archive functionality +Archiv-DVD-functionality ------------------------------------------------------------------------------- Burn the entire directory, that contains the recording, to a dvd and label it with an indentifier (a number or anything else). You can of cource burn more @@ -68,7 +71,7 @@ variable MOUNTPOINT to the mount point of your dvd device is it is defined in Check the options at the setup menu of the plugin. They are self-explaining. -There is a patch for VDR in patches/ for replacing VDR's recordings menu with +There is a patch for VDR in contrib/ for replacing VDR's recordings menu with this plugin. You have to set the corresponding option at the setup menu of the plugin! @@ -76,6 +79,7 @@ There ist a patched TTF-Font for Enigma containing the dvd and alternative new symbols. See this post at vdr-portal.de: http://www.vdr-portal.de/board/thread.php?postid=447376#post447376 - +------------------------------------------------------------------------------- Do you like this plugin? Support the developer! Go to the project homepage and make a donation over the PayPal donation button. +------------------------------------------------------------------------------- diff --git a/extrecmenu.h b/extrecmenu.h index d504ace..48144d8 100644 --- a/extrecmenu.h +++ b/extrecmenu.h @@ -1,6 +1,6 @@ #include <vdr/plugin.h> -static const char *VERSION = "0.9"; +static const char *VERSION = "0.9a"; static const char *DESCRIPTION = "Extended recordings menu"; static const char *MAINMENUENTRY = "ExtRecMenu"; diff --git a/mymenucommands.c b/mymenucommands.c index 399df6e..97666dc 100644 --- a/mymenucommands.c +++ b/mymenucommands.c @@ -30,8 +30,13 @@ eOSState myMenuCommands::Execute() { char *buffer=NULL; bool confirmed=true; - if(command->Confirm()) - { +#ifdef CMD_SUBMENUS + if (command->hasChilds()) { + AddSubMenu(new cMenuCommands(command->Title(), command->getChilds(), parameters)); + return osContinue; + } +#endif // CMD_SUBMENUS + if(command->Confirm()) { asprintf(&buffer,"%s?",command->Title()); confirmed=Interface->Confirm(buffer); free(buffer); diff --git a/mymenumoverecording.c b/mymenueditrecording.c index c4abe69..ccd24be 100644 --- a/mymenumoverecording.c +++ b/mymenueditrecording.c @@ -4,14 +4,76 @@ */ #include <vdr/videodir.h> -#include <vdr/menu.h> #include <vdr/remote.h> +#include <vdr/menu.h> #include "mymenurecordings.h" #include "tools.h" bool clearall; char newname[128]; +// --- myMenuRenameRecording -------------------------------------------------- +myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Rename recording"),12) +{ + recording=Recording; + menurecordings=MenuRecordings; + + char *p=strrchr(recording->Name(),'~'); + if(p) + { + strn0cpy(name,++p,sizeof(name)); + strn0cpy(path,recording->Name(),sizeof(path)); + + p=strrchr(path,'~'); + if(p) + *p=0; + } + else + { + strn0cpy(name,recording->Name(),sizeof(name)); + strn0cpy(path,"",sizeof(path)); + } + Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); + cRemote::Put(kRight); +} + +eOSState myMenuRenameRecording::ProcessKey(eKeys Key) +{ + eOSState state=cOsdMenu::ProcessKey(Key); + if(state==osContinue) + { + if(Key==kOk) + { + char *buffer; + char *newfilename; + + if(strlen(path)) + asprintf(&buffer,"%s~%s",path,name); + else + asprintf(&buffer,"%s",name); + + asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); + + if(MoveVideoFile(recording,newfilename)) + { + menurecordings->Set(true); + state=osBack; + } + else + { + Skins.Message(mtError,tr("Error while accessing recording!")); + state=osContinue; + } + free(buffer); + free(newfilename); + } + if(Key==kBack) + return osBack; + } + return state; +} + +// --- myMenuMoveRecordings --------------------------------------------------- // --- myMenuNewName ---------------------------------------------------------- class myMenuNewName:public cOsdMenu { @@ -265,3 +327,43 @@ eOSState myMenuMoveRecording::ProcessKey(eKeys Key) return state; } + +// --- myMenuRecordingDetails ------------------------------------------------- +myMenuRecordingDetails::myMenuRecordingDetails(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Details"),12) +{ + recording=Recording; + menurecordings=MenuRecordings; + priority=recording->priority; + lifetime=recording->lifetime; + + Add(new cMenuEditIntItem(tr("Priority"),&priority,0,MAXPRIORITY)); + Add(new cMenuEditIntItem(tr("Lifetime"),&lifetime,0,MAXLIFETIME)); +} + +eOSState myMenuRecordingDetails::ProcessKey(eKeys Key) +{ + eOSState state=cOsdMenu::ProcessKey(Key); + if(state==osUnknown) + { + if(Key==kOk) + { + char *newfilename=strdup(recording->FileName()); + + sprintf(newfilename+strlen(newfilename)-9,"%02d.%02d.rec",priority,lifetime); + + if(MoveVideoFile(recording,newfilename)) + { + menurecordings->Set(true); + state=osBack; + } + else + { + Skins.Message(mtError,tr("Error while accessing recording!")); + state=osContinue; + } + + free(newfilename); + } + } + return state; +} diff --git a/mymenurecordingdetails.c b/mymenurecordingdetails.c deleted file mode 100644 index def9a57..0000000 --- a/mymenurecordingdetails.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * See the README file for copyright information and how to reach the author. - * - */ - -#include <vdr/videodir.h> -#include <vdr/menu.h> -#include "mymenurecordings.h" -#include "tools.h" - -myMenuRecordingDetails::myMenuRecordingDetails(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Details"),12) -{ - recording=Recording; - menurecordings=MenuRecordings; - priority=recording->priority; - lifetime=recording->lifetime; - - Add(new cMenuEditIntItem(tr("Priority"),&priority,0,MAXPRIORITY)); - Add(new cMenuEditIntItem(tr("Lifetime"),&lifetime,0,MAXLIFETIME)); -} - -eOSState myMenuRecordingDetails::ProcessKey(eKeys Key) -{ - eOSState state=cOsdMenu::ProcessKey(Key); - if(state==osUnknown) - { - if(Key==kOk) - { - char *newfilename=strdup(recording->FileName()); - - sprintf(newfilename+strlen(newfilename)-9,"%02d.%02d.rec",priority,lifetime); - - if(MoveVideoFile(recording,newfilename)) - { - menurecordings->Set(true); - state=osBack; - } - else - { - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } - - free(newfilename); - } - } - return state; -} diff --git a/mymenurecordings.c b/mymenurecordings.c index bbdb4da..5b13176 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -19,7 +19,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) isdvd=false; name=NULL; id=NULL; - + strn0cpy(dvdnr,"",sizeof(dvdnr)); bool isnew=Recording->IsNew(); filename=Recording->FileName(); @@ -58,14 +58,14 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) if(Level==level) // recording entries { s=strrchr(Recording->Name(),'~'); - + // date and time of recording struct tm tm_r; struct tm *t=localtime_r(&Recording->start,&tm_r); char RecLength[21]; char *indexfilename; - + // recording length asprintf(&indexfilename,"%s/index.vdr",filename); int haslength=!access(indexfilename,R_OK); @@ -98,7 +98,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) } } free(indexfilename); - + // dvdarchive-patch functionality asprintf(&indexfilename,"%s/dvd.vdr",filename); isdvd=!access(indexfilename,R_OK); @@ -145,7 +145,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) asprintf(&id,"%s %s %s",RecDate,RecTime,Recording->Name()); } - else + else if(Level>level) // any other { title=""; @@ -165,13 +165,13 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) totalentries++; if(IsNew) newentries++; - + char *buffer=NULL; if(mysetup.ShowNewRecs) asprintf(&buffer,"%d\t%d\t%s",totalentries,newentries,name); else asprintf(&buffer,"%d\t%s",totalentries,name); - + // don't show '-', '.', '$', 'ª' or '·' if the directory name ends with one of it if(buffer[strlen(buffer)-1]=='.'||buffer[strlen(buffer)-1]=='-'||buffer[strlen(buffer)-1]=='$'||buffer[strlen(buffer)-1]==char(170)||buffer[strlen(buffer)-1]==char(183)) buffer[strlen(buffer)-1]=0; @@ -209,9 +209,9 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas level=Level; helpkeys=-1; base=Base?strdup(Base):NULL; - + Recordings.StateChanged(recordingsstate); - + Display(); if(mysetup.wasdvd&&!cControl::Control()) @@ -228,14 +228,14 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas } isyslog("[extrecmenu] dvdarchive.sh returns %d",result); free(cmd); - + mysetup.wasdvd=false; } Set(); if(myReplayControl::LastReplayed()) Open(); - + Display(); SetHelpKeys(); } @@ -289,7 +289,7 @@ void myMenuRecordings::SetHelpKeys() void myMenuRecordings::Set(bool Refresh) { const char *lastreplayed=myReplayControl::LastReplayed(); - + cThreadLock RecordingsLock(&Recordings); Clear(); // create my own recordings list from VDR's @@ -301,7 +301,7 @@ void myMenuRecordings::Set(bool Refresh) // needed for move recording menu Recordings.Sort(); - + char *lastitemtext=NULL; myMenuRecordingsItem *lastitem=NULL; for(myRecListItem *listitem=list->First();listitem;listitem=list->Next(listitem)) @@ -332,7 +332,7 @@ void myMenuRecordings::Set(bool Refresh) } } } - } + } free(lastitemtext); delete list; if(Refresh) @@ -375,7 +375,7 @@ eOSState myMenuRecordings::Play() char *name=NULL; char path[MaxFileName]; - + myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); if(item) { @@ -455,7 +455,7 @@ eOSState myMenuRecordings::Delete() { if(HasSubMenu()||Count()==0) return osContinue; - + myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); if(item&&!item->IsDirectory()) { @@ -499,7 +499,7 @@ eOSState myMenuRecordings::Delete() Skins.Message(mtError,tr("Error while deleting recording!")); } } - } + } return osContinue; } @@ -540,7 +540,7 @@ eOSState myMenuRecordings::MoveRec() { if(HasSubMenu()||Count()==0) return osContinue; - + myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); if(item&&!item->IsDirectory()) { @@ -597,7 +597,7 @@ eOSState myMenuRecordings::Commands(eKeys Key) eOSState myMenuRecordings::ProcessKey(eKeys Key) { eOSState state; - + if(edit) { switch(Key) @@ -649,7 +649,7 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) // refresh list after submenu has closed if(hadsubmenu&&!HasSubMenu()&&Recordings.StateChanged(recordingsstate)) Set(true); - + // go back if list is empty if(!Count()) state=osBack; diff --git a/mymenurenamerecording.c b/mymenurenamerecording.c deleted file mode 100644 index 5259f3d..0000000 --- a/mymenurenamerecording.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * See the README file for copyright information and how to reach the author. - * - */ - -#include <vdr/videodir.h> -#include <vdr/menu.h> -#include <vdr/remote.h> -#include "mymenurecordings.h" -#include "tools.h" - -myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Rename recording"),12) -{ - recording=Recording; - menurecordings=MenuRecordings; - - char *p=strrchr(recording->Name(),'~'); - if(p) - { - strn0cpy(name,++p,sizeof(name)); - strn0cpy(path,recording->Name(),sizeof(path)); - - p=strrchr(path,'~'); - if(p) - *p=0; - } - else - { - strn0cpy(name,recording->Name(),sizeof(name)); - strn0cpy(path,"",sizeof(path)); - } - Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); - cRemote::Put(kRight); -} - -eOSState myMenuRenameRecording::ProcessKey(eKeys Key) -{ - eOSState state=cOsdMenu::ProcessKey(Key); - if(state==osContinue) - { - if(Key==kOk) - { - char *buffer; - char *newfilename; - - if(strlen(path)) - asprintf(&buffer,"%s~%s",path,name); - else - asprintf(&buffer,"%s",name); - - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); - - if(MoveVideoFile(recording,newfilename)) - { - menurecordings->Set(true); - state=osBack; - } - else - { - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } - free(buffer); - free(newfilename); - } - if(Key==kBack) - return osBack; - } - return state; -} diff --git a/myreplaycontrol.c b/myreplaycontrol.c index fb7f50f..eeee7ee 100644 --- a/myreplaycontrol.c +++ b/myreplaycontrol.c @@ -29,7 +29,7 @@ myReplayControl::myReplayControl(void) timeoutShow = 0; timeSearchActive = false; marks.Load(fileName); -#ifdef BIGPACKVERSION +#ifdef BIGPATCHVERSION lastLoadMarks = time(NULL); #endif cRecording Recording(fileName); @@ -253,11 +253,11 @@ void myReplayControl::MarkToggle(void) ShowTimed(2); bool Play, Forward; int Speed; -#ifndef BIGPACKVERSION +#ifndef BIGPATCHVERSION if (GetReplayMode(Play, Forward, Speed) && !Play) Goto(Current, true); #endif -#ifdef BIGBACKVERSION +#ifdef BIGPATCHVERSION if (GetReplayMode(Play, Forward, Speed) && !Play) { Goto(Current, true); displayFrames = true; @@ -276,11 +276,11 @@ void myReplayControl::MarkJump(bool Forward) if (GetIndex(Current, Total)) { cMark *m = Forward ? marks.GetNext(Current) : marks.GetPrev(Current); if (m) { -#ifndef BIGPACKVERSION +#ifndef BIGPATCHVERSION Goto(m->position, true); displayFrames = true; #endif -#ifdef BIGPACKVERSION +#ifdef BIGPATCHVERSION bool Play2, Forward2; int Speed; if (Setup.JumpPlay && GetReplayMode(Play2, Forward2, Speed) && @@ -347,10 +347,10 @@ void myReplayControl::EditTest(void) if (!m) m = marks.GetNext(Current); if (m) { -#ifndef BIGPACKVERSION +#ifndef BIGPATCHVERSION if ((m->Index() & 0x01) != 0) #endif -#ifdef BIGPACKVERSION +#ifdef BIGPATCHVERSION if ((m->Index() & 0x01) != 0 && !Setup.PlayJump) #endif m = marks.Next(m); @@ -374,7 +374,7 @@ eOSState myReplayControl::ProcessKey(eKeys Key) { if (!Active()) return osEnd; -#ifdef BIGPACKVERSION +#ifdef BIGPATCHVERSION if (Setup.LoadMarksInterval && time(NULL) >= lastLoadMarks + Setup.LoadMarksInterval) { marks.Load(fileName, true); diff --git a/myreplaycontrol.h b/myreplaycontrol.h index 274737e..915ab8a 100644 --- a/myreplaycontrol.h +++ b/myreplaycontrol.h @@ -11,7 +11,7 @@ private: bool lastPlay, lastForward; int lastSpeed; time_t timeoutShow; -#ifdef BIGPACKVERSION +#ifdef BIGPATCHVERSION time_t lastLoadMarks; #endif bool timeSearchActive, timeSearchHide; diff --git a/scripts/dvdarchive.sh b/scripts/dvdarchive.sh index 7f5b72b..f7bf066 100755 --- a/scripts/dvdarchive.sh +++ b/scripts/dvdarchive.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Version 1.4 2006-04-07 +# Version 1.5 2006-04-17 # # Exitcodes: # @@ -38,11 +38,15 @@ REC="$2" NAME="$3" call() { - echo -e "\nScript $0 needs three parameters. Action, rec and name. Action is mount or umount" + echo -e "\nScript $0 needs three parameters for mount and two for umount. The first must be mount or umount, the second is the full path.\n" + echo -e "Only for mounting the script needs a third parameter, the last part of the recording path.\n" echo -e "Example: dvdarchive.sh mount '/video1.0/Music/%Riverdance/2004-06-06.00:10.50.99.rec' '2004-06-06.00:10.50.99.rec'\n" + echo -e "Example: dvdarchive.sh umount '/video1.0/Music/%Riverdance/2004-06-06.00:10.50.99.rec'\n" } -[ $# -ne 3 ] && { call; exit 10; } +[ "$1" = "mount" -o "$1" = "umount" ] || { call; exit 10; } +[ -z "$2" ] && { call; exit 10; } +[ "$1" = mount -a -z "$3" ] && { call; exit 10; } case "$1" in mount) @@ -1,7 +1,7 @@ /* * See the README file for copyright information and how to reach the author. * - * The code for sort recordings as adopted from the SortRecordings-patch + * The code for sort recordings is adopted from the SortRecordings-patch * copyright by FrankJepsen and FRank99 from vdr-portal.de */ @@ -14,7 +14,7 @@ bool MoveVideoFile(cRecording *Recording,char *NewName) { if(!strcmp(Recording->FileName(),NewName)) return true; - + isyslog("[extrecmenu] moving file %s to %s",Recording->FileName(),NewName); int result=MakeDirs(NewName); if(result) |