From 3c04e4ce347dff915def3a79f348f2f46e60564d Mon Sep 17 00:00:00 2001 From: Martin Prochnow Date: Mon, 17 Apr 2006 17:00:18 +0200 Subject: =?UTF-8?q?Version=200.9a=20-=20fixed=20#ifdef's=20for=20JumpPlay-?= =?UTF-8?q?patch=20in=20myreplaycontrol.c;=20thanks=20to=20Thomas=20G?= =?UTF-8?q?=C3=BCnther=20for=20reporting=20-=20include=20fixed=20'dvdarchi?= =?UTF-8?q?ve.sh',=20umount=20wasn't=20possible;=20thanks=20to=20Mase=20fr?= =?UTF-8?q?om=20vdr-portal.de=20for=20reporting=20-=20added=20support=20fo?= =?UTF-8?q?r=20CmdSubMenu-patch,=20it=20should=20now=20be=20possible=20to?= =?UTF-8?q?=20use=20sub=20menus=20if=20you=20patched=20your=20VDR=20with?= =?UTF-8?q?=20BigPatch=20or=20CmdSubMenu-patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HISTORY | 8 + Makefile | 5 +- README | 12 +- extrecmenu.h | 2 +- mymenucommands.c | 9 +- mymenueditrecording.c | 369 +++++++++++++++++++++++++++++++++++++++++++++++ mymenumoverecording.c | 267 ---------------------------------- mymenurecordingdetails.c | 48 ------ mymenurecordings.c | 40 ++--- mymenurenamerecording.c | 70 --------- myreplaycontrol.c | 16 +- myreplaycontrol.h | 2 +- scripts/dvdarchive.sh | 10 +- tools.c | 4 +- 14 files changed, 433 insertions(+), 429 deletions(-) create mode 100644 mymenueditrecording.c delete mode 100644 mymenumoverecording.c delete mode 100644 mymenurecordingdetails.c delete mode 100644 mymenurenamerecording.c diff --git a/HISTORY b/HISTORY index 2585985..96d2a58 100644 --- a/HISTORY +++ b/HISTORY @@ -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) diff --git a/Makefile b/Makefile index e2318df..af730f8 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/README b/README index 495ce2f..dcd22bb 100644 --- a/README +++ b/README @@ -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 -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/mymenueditrecording.c b/mymenueditrecording.c new file mode 100644 index 0000000..ccd24be --- /dev/null +++ b/mymenueditrecording.c @@ -0,0 +1,369 @@ +/* + * See the README file for copyright information and how to reach the author. + * + */ + +#include +#include +#include +#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 +{ + private: + char name[128]; + public: + myMenuNewName(); + virtual eOSState ProcessKey(eKeys Key); +}; + +myMenuNewName::myMenuNewName():cOsdMenu(tr("New folder"),12) +{ + strn0cpy(name,tr("New folder"),sizeof(name)); + Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); + cRemote::Put(kRight); +} + +eOSState myMenuNewName::ProcessKey(eKeys Key) +{ + eOSState state=cOsdMenu::ProcessKey(Key); + + if(state==osContinue) + { + if(Key==kOk) + { + strn0cpy(newname,name,sizeof(newname)); + state=osBack; + } + if(Key==kBack) + state=osBack; + } + + return state; +} + +// --- myMenuMoveRecordingItem ------------------------------------------------ +class myMenuMoveRecordingItem:public cOsdItem +{ + private: + int level; + char *title; + public: + myMenuMoveRecordingItem(const char *Title,int Level); + myMenuMoveRecordingItem(cRecording *Recording,int Level); + int Level(){return level;} + void SetLevel(int Level){level=Level;} +}; + +myMenuMoveRecordingItem::myMenuMoveRecordingItem(const char *Title,int Level) +{ + level=Level; + title=strdup(Title); + SetText(title); +} + +myMenuMoveRecordingItem::myMenuMoveRecordingItem(cRecording *Recording,int Level) +{ + level=0; + + const char *s=Recording->Name(); + while(*++s) + { + if(*s=='~') + level++; + } + if(LevelName(); + const char *p=s; + while(*++s) + { + if(*s == '~') + { + if(Level--) + p=s+1; + else + break; + } + } + title=MALLOC(char,s-p+1); + strn0cpy(title,p,s-p+1); + SetText(title); + } + else + SetText(""); +} + +// --- myMenuMoveRecording ---------------------------------------------------- +myMenuMoveRecording::myMenuMoveRecording(cRecording *Recording,myMenuRecordings *MenuRecordings,const char *Base,int Level):cOsdMenu(Base?Base:"") +{ + strn0cpy(newname,"",sizeof(newname)); + recording=Recording; + menurecordings=MenuRecordings; + base=Base?strdup(Base):NULL; + level=Level; + Set(); + SetHelp(tr("Button$Cancel"),NULL,tr("Button$Create"),tr("Button$Move")); +} + +myMenuMoveRecording::~myMenuMoveRecording() +{ + free(base); +} + +void myMenuMoveRecording::Set() +{ + if(level==0) + Add(new myMenuMoveRecordingItem(tr("[base dir]"),0)); + + char *lastitemtext=NULL; + myMenuMoveRecordingItem *lastitem=NULL; + for(cRecording *recording=Recordings.First();recording;recording=Recordings.Next(recording)) + { + if(!base||(strstr(recording->Name(),base)==recording->Name()&&recording->Name()[strlen(base)]=='~')) + { + myMenuMoveRecordingItem *item=new myMenuMoveRecordingItem(recording,level); + if(*item->Text()) + { + if(lastitemtext&&!strcmp(lastitemtext,item->Text())) // same text + { + if(lastitem&&lastitem->Level()Level()) // if level of the previous item is lower, set it to the new value + { + lastitem->SetLevel(item->Level()); + } + delete item; + } + else + { + Add(item); // different text means a new item to add + lastitem=item; + free(lastitemtext); + lastitemtext=strdup(lastitem->Text()); + } + } + else + delete item; + } + } + free(lastitemtext); +} + +eOSState myMenuMoveRecording::Open() +{ + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); + if(item) + { + if(item->Level()>level) + { + const char *t=item->Text(); + char buffer[MaxFileName]; + if(base) + { + snprintf(buffer,sizeof(buffer),"%s~%s",base,t); + t=buffer; + } + return AddSubMenu(new myMenuMoveRecording(recording,menurecordings,t,level+1)); + } + } + return osContinue; +} + +eOSState myMenuMoveRecording::MoveRec() +{ + char *dir=NULL,*p=NULL,*name,*newfilename; + eOSState state=osContinue; + + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); + if(item) + { + + if(!strcmp(tr("[base dir]"),item->Text())) + dir=""; + else + asprintf(&dir,"%s~",item->Text()); + + p=strrchr(recording->Name(),'~'); + if(p) + { + if(base) + asprintf(&name,"%s~%s%s",base,dir,++p); + else + asprintf(&name,"%s%s",dir,++p); + } + else + { + if(base) + asprintf(&name,"%s~%s%s",base,dir,recording->Name()); + else + asprintf(&name,"%s%s",dir,recording->Name()); + } + + asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); + } + else + { + p=strrchr(recording->Name(),'~'); + if(p) + asprintf(&name,"%s~%s",base,++p); + else + asprintf(&name,"%s~%s",base,recording->Name()); + + asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); + } + + if(MoveVideoFile(recording,newfilename)) + { + menurecordings->Set(true); + clearall=true; // close move recording menu + state=osBack; + } + else + Skins.Message(mtError,tr("Error while accessing recording!")); + + if(dir!="") + free(dir); + free(name); + free(newfilename); + return state; +} + +eOSState myMenuMoveRecording::Create() +{ + return AddSubMenu(new myMenuNewName); +} + +eOSState myMenuMoveRecording::ProcessKey(eKeys Key) +{ + eOSState state=cOsdMenu::ProcessKey(Key); + + if(state==osUnknown) + { + switch(Key) + { + case kRed: clearall=true;break; + case kYellow: return Create(); + case kBlue: return MoveRec(); + case kOk: return Open(); + default: break; + } + } + + if(newname[0]!=0) + { + Add(new myMenuMoveRecordingItem(newname,level+2)); + Display(); + strn0cpy(newname,"",sizeof(newname)); + } + + if(clearall) + return osBack; + + 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/mymenumoverecording.c b/mymenumoverecording.c deleted file mode 100644 index c4abe69..0000000 --- a/mymenumoverecording.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * See the README file for copyright information and how to reach the author. - * - */ - -#include -#include -#include -#include "mymenurecordings.h" -#include "tools.h" - -bool clearall; -char newname[128]; - -// --- myMenuNewName ---------------------------------------------------------- -class myMenuNewName:public cOsdMenu -{ - private: - char name[128]; - public: - myMenuNewName(); - virtual eOSState ProcessKey(eKeys Key); -}; - -myMenuNewName::myMenuNewName():cOsdMenu(tr("New folder"),12) -{ - strn0cpy(name,tr("New folder"),sizeof(name)); - Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); - cRemote::Put(kRight); -} - -eOSState myMenuNewName::ProcessKey(eKeys Key) -{ - eOSState state=cOsdMenu::ProcessKey(Key); - - if(state==osContinue) - { - if(Key==kOk) - { - strn0cpy(newname,name,sizeof(newname)); - state=osBack; - } - if(Key==kBack) - state=osBack; - } - - return state; -} - -// --- myMenuMoveRecordingItem ------------------------------------------------ -class myMenuMoveRecordingItem:public cOsdItem -{ - private: - int level; - char *title; - public: - myMenuMoveRecordingItem(const char *Title,int Level); - myMenuMoveRecordingItem(cRecording *Recording,int Level); - int Level(){return level;} - void SetLevel(int Level){level=Level;} -}; - -myMenuMoveRecordingItem::myMenuMoveRecordingItem(const char *Title,int Level) -{ - level=Level; - title=strdup(Title); - SetText(title); -} - -myMenuMoveRecordingItem::myMenuMoveRecordingItem(cRecording *Recording,int Level) -{ - level=0; - - const char *s=Recording->Name(); - while(*++s) - { - if(*s=='~') - level++; - } - if(LevelName(); - const char *p=s; - while(*++s) - { - if(*s == '~') - { - if(Level--) - p=s+1; - else - break; - } - } - title=MALLOC(char,s-p+1); - strn0cpy(title,p,s-p+1); - SetText(title); - } - else - SetText(""); -} - -// --- myMenuMoveRecording ---------------------------------------------------- -myMenuMoveRecording::myMenuMoveRecording(cRecording *Recording,myMenuRecordings *MenuRecordings,const char *Base,int Level):cOsdMenu(Base?Base:"") -{ - strn0cpy(newname,"",sizeof(newname)); - recording=Recording; - menurecordings=MenuRecordings; - base=Base?strdup(Base):NULL; - level=Level; - Set(); - SetHelp(tr("Button$Cancel"),NULL,tr("Button$Create"),tr("Button$Move")); -} - -myMenuMoveRecording::~myMenuMoveRecording() -{ - free(base); -} - -void myMenuMoveRecording::Set() -{ - if(level==0) - Add(new myMenuMoveRecordingItem(tr("[base dir]"),0)); - - char *lastitemtext=NULL; - myMenuMoveRecordingItem *lastitem=NULL; - for(cRecording *recording=Recordings.First();recording;recording=Recordings.Next(recording)) - { - if(!base||(strstr(recording->Name(),base)==recording->Name()&&recording->Name()[strlen(base)]=='~')) - { - myMenuMoveRecordingItem *item=new myMenuMoveRecordingItem(recording,level); - if(*item->Text()) - { - if(lastitemtext&&!strcmp(lastitemtext,item->Text())) // same text - { - if(lastitem&&lastitem->Level()Level()) // if level of the previous item is lower, set it to the new value - { - lastitem->SetLevel(item->Level()); - } - delete item; - } - else - { - Add(item); // different text means a new item to add - lastitem=item; - free(lastitemtext); - lastitemtext=strdup(lastitem->Text()); - } - } - else - delete item; - } - } - free(lastitemtext); -} - -eOSState myMenuMoveRecording::Open() -{ - myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); - if(item) - { - if(item->Level()>level) - { - const char *t=item->Text(); - char buffer[MaxFileName]; - if(base) - { - snprintf(buffer,sizeof(buffer),"%s~%s",base,t); - t=buffer; - } - return AddSubMenu(new myMenuMoveRecording(recording,menurecordings,t,level+1)); - } - } - return osContinue; -} - -eOSState myMenuMoveRecording::MoveRec() -{ - char *dir=NULL,*p=NULL,*name,*newfilename; - eOSState state=osContinue; - - myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); - if(item) - { - - if(!strcmp(tr("[base dir]"),item->Text())) - dir=""; - else - asprintf(&dir,"%s~",item->Text()); - - p=strrchr(recording->Name(),'~'); - if(p) - { - if(base) - asprintf(&name,"%s~%s%s",base,dir,++p); - else - asprintf(&name,"%s%s",dir,++p); - } - else - { - if(base) - asprintf(&name,"%s~%s%s",base,dir,recording->Name()); - else - asprintf(&name,"%s%s",dir,recording->Name()); - } - - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); - } - else - { - p=strrchr(recording->Name(),'~'); - if(p) - asprintf(&name,"%s~%s",base,++p); - else - asprintf(&name,"%s~%s",base,recording->Name()); - - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); - } - - if(MoveVideoFile(recording,newfilename)) - { - menurecordings->Set(true); - clearall=true; // close move recording menu - state=osBack; - } - else - Skins.Message(mtError,tr("Error while accessing recording!")); - - if(dir!="") - free(dir); - free(name); - free(newfilename); - return state; -} - -eOSState myMenuMoveRecording::Create() -{ - return AddSubMenu(new myMenuNewName); -} - -eOSState myMenuMoveRecording::ProcessKey(eKeys Key) -{ - eOSState state=cOsdMenu::ProcessKey(Key); - - if(state==osUnknown) - { - switch(Key) - { - case kRed: clearall=true;break; - case kYellow: return Create(); - case kBlue: return MoveRec(); - case kOk: return Open(); - default: break; - } - } - - if(newname[0]!=0) - { - Add(new myMenuMoveRecordingItem(newname,level+2)); - Display(); - strn0cpy(newname,"",sizeof(newname)); - } - - if(clearall) - return osBack; - - 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 -#include -#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 -#include -#include -#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) diff --git a/tools.c b/tools.c index 6c52a63..1ab1854 100644 --- a/tools.c +++ b/tools.c @@ -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) -- cgit v1.2.3