diff options
author | Martin Prochnow <nordlicht@martins-kabuff.de> | 2006-05-29 16:02:12 +0200 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2006-05-29 16:02:12 +0200 |
commit | 40d2369b12da350f684f5364a00c3501a6c038e6 (patch) | |
tree | 26355fcd63be09e46416bd903d2d6b7936791a1a /mymenueditrecording.c | |
parent | 47a981960f1d0b6d0d8cbe3bdc15f2b9e8665731 (diff) | |
download | vdr-plugin-extrecmenu-40d2369b12da350f684f5364a00c3501a6c038e6.tar.gz vdr-plugin-extrecmenu-40d2369b12da350f684f5364a00c3501a6c038e6.tar.bz2 |
Version 0.11v0.11
- added czech translation; thanks to Vladimír Bárta
- added missing dialog for video dvds
- added more meaningful error messages
- avoid empty names and names starting with . or .. while editing
- free space display in title bar is now updated immediately
- switched off editing of recordings and directories while a cut is in progress
- switched off resume by 'Play' or 'Menu'->'Blue' for archive dvd recordings
- changed back the behaviour if replay ends; plugin has to open to unmount archive dvds
- removed setup option "While opening jump to last replayed recording"; its implemention interfers with the following one
- after renaming a recording, the selection bar now stays at this renamed list entry
- the parameters 'move' and 'rename' for the '-r'-option of VDR have now the following format: move/rename oldname newname
- fixed hopefully all problems in connection with renaming and moving directories
- plugins closes if there are no recordings - fixed
Diffstat (limited to 'mymenueditrecording.c')
-rw-r--r-- | mymenueditrecording.c | 160 |
1 files changed, 64 insertions, 96 deletions
diff --git a/mymenueditrecording.c b/mymenueditrecording.c index a7f3c3f..e50c302 100644 --- a/mymenueditrecording.c +++ b/mymenueditrecording.c @@ -8,7 +8,7 @@ #include "mymenurecordings.h" #include "tools.h" -bool clearall; +bool myMenuMoveRecording::clearall=false; char newname[128]; // --- myMenuRenameRecording -------------------------------------------------- @@ -64,49 +64,30 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) char *oldname=NULL; char *newname=NULL; + if(strchr(name,'.')==name||!strlen(name)) + { + Skins.Message(mtError,tr("Invalid filename!")); + cRemote::Put(kRight); + return osContinue; + } + if(isdir) asprintf(&oldname,"%s%s%s/%s",VideoDirectory,path[0]?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); else oldname=strdup(recording->FileName()); asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,path[0]?"/":"",ExchangeChars(path,true),ExchangeChars(name,true),isdir?"":strrchr(recording->FileName(),'/')); - - if(strcmp(oldname,newname)) + + if(MoveRename(oldname,newname,isdir?NULL:recording,false)) { - if(MakeDirs(newname,true)==false) - { - Skins.Message(mtError,"Error while accessing recording!"); - state=osContinue; - } - else - { - isyslog("[extrecmenu] moving %s to %s",oldname,newname); - - if(rename(oldname,newname)==-1) - { - esyslog("[extrecmenu] error while moving: %s",strerror(errno)); - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } - else - { - cRecordingUserCommand::InvokeCommand("rename",newname); - if(isdir) - Recordings.Update(true); - else - { - free(newname); - asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,path[0]?"/":"",path,name,strrchr(recording->FileName(),'/')); - Recordings.AddByName(newname); - Recordings.Del(recording,false); - } - menurecordings->Set(true); - state=osBack; - } - } + state=osBack; + menurecordings->Set(true,isdir?NULL:newname); } else - state=osBack; + { + cRemote::Put(kRight); + state=osContinue; + } free(oldname); free(newname); @@ -142,8 +123,17 @@ eOSState myMenuNewName::ProcessKey(eKeys Key) { if(Key==kOk) { - strn0cpy(newname,name,sizeof(newname)); - state=osBack; + if(strchr(name,'.')==name||!strlen(name)) + { + Skins.Message(mtError,tr("Invalid filename!")); + cRemote::Put(kRight); + state=osContinue; + } + else + { + strn0cpy(newname,name,sizeof(newname)); + state=osBack; + } } if(Key==kBack) state=osBack; @@ -242,9 +232,8 @@ void myMenuMoveRecording::Set() if(lastitemtext&&!strcmp(lastitemtext,item->Text())) // same text { if(lastitem&&lastitem->Level()<item->Level()) // if level of the previous item is lower, set it to the new value - { lastitem->SetLevel(item->Level()); - } + delete item; } else @@ -287,70 +276,62 @@ eOSState myMenuMoveRecording::MoveRec() char *oldname=NULL; char *newname=NULL; char *dir=NULL; - char *p=NULL; eOSState state=osContinue; - myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); - if(dirname) asprintf(&oldname,"%s%s%s/%s",VideoDirectory,dirbase?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); else oldname=strdup(recording->FileName()); - p=strrchr(oldname,'/'); - if(p&&!dirname) - *p=0; - + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); if(item) { if(strcmp(tr("[base dir]"),item->Text())) { - asprintf(&dir,"%s%s%s",base?base:"",base?"~":"",item->Text()); - ExchangeChars(dir,true); + if(dirname) + asprintf(&dir,"%s%s%s",base?base:"",base?"~":"",item->Text()); + else + { + char *p=strrchr(recording->Name(),'~'); + asprintf(&dir,"%s%s%s~%s",base?base:"",base?"~":"",item->Text(),p?p+1:recording->Name()); + } + } + else + { + if(!dirname) + { + char *p=strrchr(recording->Name(),'~'); + asprintf(&dir,"%s",p?++p:recording->Name()); + } } } else { - asprintf(&dir,"%s",base); - ExchangeChars(dir,true); + if(dirname) + asprintf(&dir,"%s",base); + else + { + char *p=strrchr(recording->Name(),'~'); + asprintf(&dir,"%s~%s",base,p?p:recording->Name()); + } } + if(dir) + ExchangeChars(dir,true); - asprintf(&newname,"%s%s%s/%s",VideoDirectory,dir?"/":"",dir?dir:"",strrchr(oldname,'/')+1); + asprintf(&newname,"%s%s%s%s",VideoDirectory,dir?"/":"",dir?dir:"",strrchr(dirname?oldname:recording->FileName(),'/')); - if(MakeDirs(newname,true)==false) + if(MoveRename(oldname,newname,dirname?NULL:recording,true)) { - Skins.Message(mtError,"Error while accessing recording!"); - state=osContinue; - } - else - { - isyslog("[extrecmenu] moving %s to %s",oldname,newname); - if(rename(oldname,newname)==-1) - { - esyslog("[extrecmenu] error while moving: %s",strerror(errno)); - Skins.Message(mtError,"Error while accessing recording!"); - state=osContinue; - } - else - { - cRecordingUserCommand::InvokeCommand("move",newname); - if(dirname) - Recordings.Update(true); - else - { - free(newname); - asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,dir?"/":"",dir?dir:"",strrchr(oldname,'/')+1,strrchr(recording->FileName(),'/')); - Recordings.AddByName(newname); - Recordings.Del(recording,false); - } - clearall=true; - state=osBack; - } + clearall=true; + state=osBack; + menurecordings->Set(true); } + free(oldname); free(newname); free(dir); + return state; } @@ -412,26 +393,13 @@ eOSState myMenuRecordingDetails::ProcessKey(eKeys Key) sprintf(newname+strlen(newname)-9,"%02d.%02d.rec",priority,lifetime); - if(strcmp(oldname,newname)) + if(MoveRename(oldname,newname,recording,false)) { - isyslog("[extrecmenu] moving %s to %s",oldname,newname); - - if(rename(oldname,newname)==-1) - { - esyslog("[extrecmenu] error while moving: %s",strerror(errno)); - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } - else - { - Recordings.AddByName(newname); - Recordings.Del(recording,false); - menurecordings->Set(true); - state=osBack; - } + state=osBack; + menurecordings->Set(true,newname); } else - state=osBack; + state=osContinue; free(oldname); free(newname); |