diff options
-rw-r--r-- | HISTORY | 23 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | README | 54 | ||||
-rw-r--r-- | extrecmenu.c | 6 | ||||
-rw-r--r-- | extrecmenu.h | 2 | ||||
-rw-r--r-- | i18n.c | 38 | ||||
-rw-r--r-- | mymenucommands.c | 6 | ||||
-rw-r--r-- | mymenueditrecording.c | 238 | ||||
-rw-r--r-- | mymenurecordinginfo.c | 79 | ||||
-rw-r--r-- | mymenurecordings.c | 291 | ||||
-rw-r--r-- | mymenurecordings.h | 12 | ||||
-rw-r--r-- | mymenusetup.c | 8 | ||||
-rw-r--r-- | mymenusetup.h | 2 | ||||
-rw-r--r-- | myreplaycontrol.c | 462 | ||||
-rw-r--r-- | myreplaycontrol.h | 57 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh | 200 | ||||
-rw-r--r-- | tools.c | 31 | ||||
-rw-r--r-- | tools.h | 2 |
18 files changed, 648 insertions, 874 deletions
@@ -1,9 +1,28 @@ VDR Plugin 'extrecmenu' Revision History ---------------------------------------- +2006-02-05: Version 0.10 +- made changes to Makefile for APIVERSION (VDR >= 1.3.47) +- changed myReplayControl; suggested by Thomas Günther +- added display of free disk space to the title bar +- fixed adjustments for BigPatch/CmdSubMenu-patch; thanks to Thomas Günther + for the patch +- renaming/moving directories is now possible +- fixed escaping of parameters for dvdarchive.sh +- changed behaviour if the replay of a recording ends, plugins will not open +- 'Play' and 'Menu'->'Blue' for resuming a replay work now; BUT: the replay + isn't done with the plugin if you start replaying this way, means if you stop + the replay you come to VDR's recordings menu +- switched off editing of details (priority and lifetime) or archive dvd + recordings to avoid trouble with the dir name that identifies it on the media +- added option to mark last replayed recording while opening the plugin +- added possibilty to include video dvd's into the recordings hierarchy; see + README +- introduced new parameters for the '-r'-option if VDR: move, rename and delete + 2006-04-17: Version 0.9a - fixed #ifdef's for JumpPlay-patch in myreplaycontrol.c; thanks to Thomas - Günther for reporting + 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 @@ -97,7 +116,7 @@ VDR Plugin 'extrecmenu' Revision History 2006-03-11: Version 0.2 - implemented own dvbplayercontrol-class so that people who haved patch their - vdr with the jumpplay-patch can compile the plugin + vdr with the JumpPlay-patch can compile the plugin - 'Info' while replaying opens recording info - option 'Info' added to recordings list to show the description of a recording @@ -20,7 +20,6 @@ CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual ### The directory environment: -DVBDIR = ../../../../DVB VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp @@ -29,9 +28,9 @@ TMPDIR = /tmp -include $(VDRDIR)/Make.config -### The version number of VDR (taken from VDR's "config.h"): +### The version number of VDR / VDR's plugin API (taken from VDR's "config.h"): -VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') +APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h) ### The name of the distribution archive: @@ -40,13 +39,13 @@ PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): -INCLUDES += -I$(VDRDIR)/include -I$(DVBDIR)/include +INCLUDES += -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' ### The object files (add further files here): -OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o i18n.o mymenurecordinginfo.o \ +OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o i18n.o \ mymenusetup.o mymenucommands.o patchfont.o tools.o mymenueditrecording.o ### Implicit rules: @@ -69,7 +68,7 @@ all: libvdr-$(PLUGIN).so libvdr-$(PLUGIN).so: $(OBJS) $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ - @cp $@ $(LIBDIR)/$@.$(VDRVERSION) + @cp $@ $(LIBDIR)/$@.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @@ -5,25 +5,24 @@ Written by: Martin Prochnow (nordlicht@martins-kabuff.de) Project's homepage: http://martins-kabuff.de/extrecmenu.html See the file COPYING for license information. See top of *.c for additional -copyright information. The script 'dvdarchive.sh' is provided by vejoun from -vdr-portal.de. +copyright information. The script 'dvdarchive.sh' is provided by Mike +Constabel (vejoun@toppoint.de). Description ------------------------------------------------------------------------------- This plugin provides a recordings menu enhanced with the possibility to -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). +rename or move recordings and directories. 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). 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. +Renaming: Press 'Yellow', then 'Red'. Type in/edit the name. By pressing 'Ok' +renaming will be executed. -Moving: Select a recording, press 'Yellow', then 'Green'. Now you are at the -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. +Moving: Press 'Yellow', then 'Green'. Now you are at the base directory of the +/video-directory-hierarchy. 'Ok' opens sub-directories, with 'Yellow' you can +create new dirs. With 'Blue' moving to the selected dir will be executed. Details: Select a recording, press 'Yellow', then 'Blue'. In this menu you can edit the lifetime and priority of the selected recording. @@ -36,38 +35,47 @@ Sort recordings by: - date for main-, flexible for subdirectories - alphabet for all directories - date for all directories -Flexible means, if the directory name ends with "-",".","$" or "ª", the +Flexible means, if the directory name ends with "-",".","$" or "ª", the recordings in this directory are sorted by name, else by date. 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 -than one recording to a dvd. +with an identifier (a number or anything else). At least the *.rec-folder has +to be on the dvd, because the recording is identified by this. You can of +course burn more than one recording to a dvd. + Now you can delete the video data files (001.vdr, 002.vdr, ...) from your hard disc. Leave the index.vdr and info.vdr at the dir. index.vdr is needed if you want the length of the recording displayed. You can also use 'getlength' from the tools/-directory to create a length.vdr, containing the length of the recording. If you do this, you can also delete index.vdr. + Create a new file dvd.vdr, that contains the identifier of the dvd. If you now call the plugin and select such a recording entry you are asked to insert this dvd. It will be mounted by the plugin and the replay starts from the dvd. After replay ends, the dvd is unmountet instantly. +You can also include normal video dvds to your recordings hierarchy. Create a +folder with the name of the dvd. In this folder, create another one with +following name scheme: DD-MM-YY.hh.mm.pr.li.rec. The letters have following +meanings: DD - day (01-31), MM - month (01-12), YY - year (00-99), hh - hour +(00-23), mm - minutes (00-59), pr - priority (00-99), li - lifetime (00-99). +(Example: 01-01-06.20.15.50.99.rec) You must use this name scheme, so that VDR +identifies the folder as a recording. Now create in this folder a file dvd.vdr. +The first column contains the dvd id, in the second column write 0000. This +identifies the dvd as a video dvd. If you now select such a recording in the +list you are asked to insert the dvd and after confirming this the dvd-plugin +is started to play the video dvd. + Installation ------------------------------------------------------------------------------- Installation of the plugin itselfs is like any other plugin installation. In addition you have to place the script 'dvdarchive.sh' from the -scripts/-directory within your $PATH (eventualy adjust the rights) for the -DVDArchive-patch functionality. - -For VDR running as a user the script is designed to use sudo. Therefor sudo has -to be installed on your system and configured to execute mount and umount -without asking for a password. If you run VDR as root, change the variables -MOUNTCMD and UMOUNTCMD at top of the skript. Furthermore you have to adjust the -variable MOUNTPOINT to the mount point of your dvd device is it is defined in -/etc/fstab. +scripts/-directory within your $PATH (maybe adjust the permissions) for the +DVDArchive-patch functionality. See the top of 'dvdarchive.sh' for the +adjustments you maybe have to do. Check the options at the setup menu of the plugin. They are self-explaining. diff --git a/extrecmenu.c b/extrecmenu.c index c37ea64..01388b5 100644 --- a/extrecmenu.c +++ b/extrecmenu.c @@ -1,6 +1,5 @@ /* * See the README file for copyright information and how to reach the author. - * */ #include "mymenusetup.h" @@ -88,7 +87,10 @@ bool cPluginExtrecmenu::SetupParse(const char *Name, const char *Value) if(!strcasecmp(Name,"SortRecords")) mysetup.SortRecords=atoi(Value); else - return false; + if(!strcasecmp(Name,"JumpRec")) + mysetup.JumpRec=atoi(Value); + else + return false; return true; } diff --git a/extrecmenu.h b/extrecmenu.h index 48144d8..542886c 100644 --- a/extrecmenu.h +++ b/extrecmenu.h @@ -1,6 +1,6 @@ #include <vdr/plugin.h> -static const char *VERSION = "0.9a"; +static const char *VERSION = "0.10"; static const char *DESCRIPTION = "Extended recordings menu"; static const char *MAINMENUENTRY = "ExtRecMenu"; @@ -135,15 +135,15 @@ const tI18nPhrase Phrases[] = { "", "Uusi kansio", }, - { "Rename recording", - "Aufzeichnung umbenennen", + { "Rename", + "Umbenennen", "", "", "", "", - "Renommer l'enregistrement", + "Renommer", "", - "Nimeä tallenne", + "Nimeä", }, { "Show recording date", "Zeige Aufnahmedatum", @@ -285,6 +285,16 @@ const tI18nPhrase Phrases[] = { "", "Tiedostojen [0-9]*.vdr linkittäminen epäonnistui!", }, + { "sudo or mount --bind / umount error (vfat system)", + "sudo oder mount --bind / umount Fehler (VFAT-System)", + "", + "", + "", + "", + "", + "", + "", + }, { "Show \"new recordings column\"", "\"Neue-Aufzeichnungen-Spalte\" anzeigen", "", @@ -355,5 +365,25 @@ const tI18nPhrase Phrases[] = { "", "Lisätiedot", }, + { "While opening jump to last replayed recording", + "Zuletzt abgespielte Aufnahme beim Öffnen anspringen", + "", + "", + "", + "", + "", + "", + "", + }, + { "DVD plugin is not installed!", + "Das DVD-Plugin ist nicht installiert!", + "", + "", + "", + "", + "", + "", + "", + }, { NULL } }; diff --git a/mymenucommands.c b/mymenucommands.c index 97666dc..b7e3c79 100644 --- a/mymenucommands.c +++ b/mymenucommands.c @@ -30,12 +30,12 @@ eOSState myMenuCommands::Execute() { char *buffer=NULL; bool confirmed=true; -#ifdef CMD_SUBMENUS +#ifdef BIGPATCHVERSION if (command->hasChilds()) { - AddSubMenu(new cMenuCommands(command->Title(), command->getChilds(), parameters)); + AddSubMenu(new myMenuCommands(command->Title(), command->getChilds(), parameters)); return osContinue; } -#endif // CMD_SUBMENUS +#endif if(command->Confirm()) { asprintf(&buffer,"%s?",command->Title()); confirmed=Interface->Confirm(buffer); diff --git a/mymenueditrecording.c b/mymenueditrecording.c index ccd24be..a7f3c3f 100644 --- a/mymenueditrecording.c +++ b/mymenueditrecording.c @@ -1,6 +1,5 @@ /* * See the README file for copyright information and how to reach the author. - * */ #include <vdr/videodir.h> @@ -13,30 +12,48 @@ bool clearall; char newname[128]; // --- myMenuRenameRecording -------------------------------------------------- -myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Rename recording"),12) +myMenuRenameRecording::myMenuRenameRecording(myMenuRecordings *MenuRecordings,cRecording *Recording,const char *DirBase,const char *DirName):cOsdMenu(tr("Rename"),12) { - recording=Recording; + isdir=false; menurecordings=MenuRecordings; - - char *p=strrchr(recording->Name(),'~'); - if(p) + recording=Recording; + dirbase=DirBase?strdup(DirBase):NULL; + dirname=DirName?strdup(DirName):NULL; + + if(recording) { - strn0cpy(name,++p,sizeof(name)); - strn0cpy(path,recording->Name(),sizeof(path)); - - p=strrchr(path,'~'); + char *p=strrchr(recording->Name(),'~'); if(p) - *p=0; + { + 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)); + } } else { - strn0cpy(name,recording->Name(),sizeof(name)); - strn0cpy(path,"",sizeof(path)); + isdir=true; + strn0cpy(name,DirName,sizeof(name)); + strn0cpy(path,DirBase?DirBase:"",sizeof(path)); } Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); cRemote::Put(kRight); } +myMenuRenameRecording::~myMenuRenameRecording() +{ + free(dirbase); + free(dirname); +} + eOSState myMenuRenameRecording::ProcessKey(eKeys Key) { eOSState state=cOsdMenu::ProcessKey(Key); @@ -44,28 +61,55 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) { if(Key==kOk) { - char *buffer; - char *newfilename; - - if(strlen(path)) - asprintf(&buffer,"%s~%s",path,name); + char *oldname=NULL; + char *newname=NULL; + + if(isdir) + asprintf(&oldname,"%s%s%s/%s",VideoDirectory,path[0]?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); else - asprintf(&buffer,"%s",name); - - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); + oldname=strdup(recording->FileName()); - if(MoveVideoFile(recording,newfilename)) + asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,path[0]?"/":"",ExchangeChars(path,true),ExchangeChars(name,true),isdir?"":strrchr(recording->FileName(),'/')); + + if(strcmp(oldname,newname)) { - menurecordings->Set(true); - state=osBack; + 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; + } + } } else - { - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } - free(buffer); - free(newfilename); + state=osBack; + + free(oldname); + free(newname); } if(Key==kBack) return osBack; @@ -73,7 +117,6 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) return state; } -// --- myMenuMoveRecordings --------------------------------------------------- // --- myMenuNewName ---------------------------------------------------------- class myMenuNewName:public cOsdMenu { @@ -162,8 +205,10 @@ myMenuMoveRecordingItem::myMenuMoveRecordingItem(cRecording *Recording,int Level } // --- myMenuMoveRecording ---------------------------------------------------- -myMenuMoveRecording::myMenuMoveRecording(cRecording *Recording,myMenuRecordings *MenuRecordings,const char *Base,int Level):cOsdMenu(Base?Base:"") +myMenuMoveRecording::myMenuMoveRecording(myMenuRecordings *MenuRecordings,cRecording *Recording,const char *DirBase,const char *DirName,const char *Base,int Level):cOsdMenu(Base?Base:"") { + dirbase=DirBase?strdup(DirBase):NULL; + dirname=DirName?strdup(DirName):NULL; strn0cpy(newname,"",sizeof(newname)); recording=Recording; menurecordings=MenuRecordings; @@ -176,6 +221,8 @@ myMenuMoveRecording::myMenuMoveRecording(cRecording *Recording,myMenuRecordings myMenuMoveRecording::~myMenuMoveRecording() { free(base); + free(dirbase); + free(dirname); } void myMenuMoveRecording::Set() @@ -229,7 +276,7 @@ eOSState myMenuMoveRecording::Open() snprintf(buffer,sizeof(buffer),"%s~%s",base,t); t=buffer; } - return AddSubMenu(new myMenuMoveRecording(recording,menurecordings,t,level+1)); + return AddSubMenu(new myMenuMoveRecording(menurecordings,recording,dirbase,dirname,t,level+1)); } } return osContinue; @@ -237,60 +284,73 @@ eOSState myMenuMoveRecording::Open() eOSState myMenuMoveRecording::MoveRec() { - char *dir=NULL,*p=NULL,*name,*newfilename; - eOSState state=osContinue; + 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; + if(item) { - - if(!strcmp(tr("[base dir]"),item->Text())) - dir=""; - else - asprintf(&dir,"%s~",item->Text()); - - p=strrchr(recording->Name(),'~'); - if(p) + if(strcmp(tr("[base dir]"),item->Text())) { - if(base) - asprintf(&name,"%s~%s%s",base,dir,++p); - else - asprintf(&name,"%s%s",dir,++p); + asprintf(&dir,"%s%s%s",base?base:"",base?"~":"",item->Text()); + ExchangeChars(dir,true); } - 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); + asprintf(&dir,"%s",base); + ExchangeChars(dir,true); } - if(MoveVideoFile(recording,newfilename)) + asprintf(&newname,"%s%s%s/%s",VideoDirectory,dir?"/":"",dir?dir:"",strrchr(oldname,'/')+1); + + if(MakeDirs(newname,true)==false) { - menurecordings->Set(true); - clearall=true; // close move recording menu - state=osBack; + Skins.Message(mtError,"Error while accessing recording!"); + state=osContinue; } else - Skins.Message(mtError,tr("Error while accessing recording!")); - - if(dir!="") - free(dir); - free(name); - free(newfilename); + { + 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; + } + } + free(oldname); + free(newname); + free(dir); return state; } @@ -347,22 +407,34 @@ eOSState myMenuRecordingDetails::ProcessKey(eKeys Key) { if(Key==kOk) { - char *newfilename=strdup(recording->FileName()); + char *oldname=strdup(recording->FileName()); + char *newname=strdup(recording->FileName()); - sprintf(newfilename+strlen(newfilename)-9,"%02d.%02d.rec",priority,lifetime); + sprintf(newname+strlen(newname)-9,"%02d.%02d.rec",priority,lifetime); - if(MoveVideoFile(recording,newfilename)) + if(strcmp(oldname,newname)) { - menurecordings->Set(true); - state=osBack; + 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; + } } else - { - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } + state=osBack; - free(newfilename); + free(oldname); + free(newname); } } return state; diff --git a/mymenurecordinginfo.c b/mymenurecordinginfo.c deleted file mode 100644 index 70384b3..0000000 --- a/mymenurecordinginfo.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * See the README file for copyright information and how to reach the author. - * - * This code is directly taken from VDR with some changes by me to work with this plugin - */ - -#include <vdr/status.h> -#include "myreplaycontrol.h" - -myMenuRecordingInfo::myMenuRecordingInfo(const cRecording *Recording,bool WithButtons):cOsdMenu(tr("Recording info")) -{ - recording=Recording; - withButtons=WithButtons; - if(withButtons) - SetHelp(tr("Button$Play"),tr("Button$Rewind")); -} - -void myMenuRecordingInfo::Display(void) -{ - cOsdMenu::Display(); - DisplayMenu()->SetRecording(recording); - cStatus::MsgOsdTextItem(recording->Info()->Description()); -} - -eOSState myMenuRecordingInfo::Play() -{ - if(recording) - { - myReplayControl::SetRecording(recording->FileName(),recording->Title()); - cControl::Shutdown(); // stop running playbacks - cControl::Launch(new myReplayControl); // start playback - return osEnd; // close plugin - } - return osContinue; -} - -eOSState myMenuRecordingInfo::Rewind() -{ - if(recording) - { - cDevice::PrimaryDevice()->StopReplay(); - cResumeFile ResumeFile(recording->FileName()); - ResumeFile.Delete(); - return Play(); - } - return osContinue; -} - -eOSState myMenuRecordingInfo::ProcessKey(eKeys Key) -{ - switch (Key) - { - case kUp|k_Repeat: - case kUp: - case kDown|k_Repeat: - case kDown: - case kLeft|k_Repeat: - case kLeft: - case kRight|k_Repeat: - case kRight: DisplayMenu()->Scroll(NORMALKEY(Key)==kUp||NORMALKEY(Key)==kLeft,NORMALKEY(Key)==kLeft||NORMALKEY(Key)==kRight); - cStatus::MsgOsdTextItem(NULL,NORMALKEY(Key)==kUp); - return osContinue; - default: break; - } - - eOSState state=cOsdMenu::ProcessKey(Key); - - if(state==osUnknown) - { - switch (Key) - { - case kRed: return Play(); - case kGreen: return Rewind(); - case kOk: return osBack; - default: break; - } - } - return state; -} diff --git a/mymenurecordings.c b/mymenurecordings.c index 5b13176..5279e01 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -1,10 +1,11 @@ /* * See the README file for copyright information and how to reach the author. - * */ #include <vdr/interface.h> #include <vdr/videodir.h> +#include <vdr/status.h> +#include <vdr/plugin.h> #include "myreplaycontrol.h" #include "mymenurecordings.h" #include "mymenusetup.h" @@ -12,11 +13,75 @@ #include "patchfont.h" #include "tools.h" +// --- myMenuRecordingInfo ---------------------------------------------------- +class myMenuRecordingInfo:public cOsdMenu +{ + private: + const cRecording *recording; + bool withButtons; + eOSState Play(); + eOSState Rewind(); + public: + myMenuRecordingInfo(const cRecording *Recording,bool WithButtons = false); + virtual void Display(void); + virtual eOSState ProcessKey(eKeys Key); +}; + +myMenuRecordingInfo::myMenuRecordingInfo(const cRecording *Recording, bool WithButtons):cOsdMenu(tr("Recording info")) +{ + recording=Recording; + withButtons=WithButtons; + if(withButtons) + SetHelp(tr("Button$Play"),tr("Button$Rewind")); +} + +void myMenuRecordingInfo::Display(void) +{ + cOsdMenu::Display(); + DisplayMenu()->SetRecording(recording); + cStatus::MsgOsdTextItem(recording->Info()->Description()); +} + +eOSState myMenuRecordingInfo::ProcessKey(eKeys Key) +{ + switch(Key) + { + case kUp|k_Repeat: + case kUp: + case kDown|k_Repeat: + case kDown: + case kLeft|k_Repeat: + case kLeft: + case kRight|k_Repeat: + case kRight: DisplayMenu()->Scroll(NORMALKEY(Key)==kUp||NORMALKEY(Key)==kLeft,NORMALKEY(Key)==kLeft||NORMALKEY(Key)==kRight); + cStatus::MsgOsdTextItem(NULL, NORMALKEY(Key) == kUp); + return osContinue; + default: break; + } + + eOSState state=cOsdMenu::ProcessKey(Key); + if(state==osUnknown) + { + switch(Key) + { + case kRed: if(withButtons) + Key=kOk; // will play the recording, even if recording commands are defined + case kGreen: if(!withButtons) + break; + cRemote::Put(Key,true); + case kOk: return osBack; + default: break; + } + } + return state; +} + // --- myMenuRecordingsItem --------------------------------------------------- myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) { totalentries=newentries=0; isdvd=false; + isvideodvd=false; name=NULL; id=NULL; @@ -63,7 +128,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) struct tm tm_r; struct tm *t=localtime_r(&Recording->start,&tm_r); - char RecLength[21]; + char reclength[21]; char *indexfilename; // recording length @@ -73,7 +138,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) { struct stat buf; if(!stat(indexfilename,&buf)) - snprintf(RecLength,sizeof(RecLength),"%d'",(int)(buf.st_size/12000)); + snprintf(reclength,sizeof(reclength),"%d'",(int)(buf.st_size/12000)); } else // no index -> is there a length.vdr, containing recording length as a string? { @@ -93,7 +158,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) *p=0; } fclose(f); - snprintf(RecLength,sizeof(RecLength),"%s'\n",buffer); + snprintf(reclength,sizeof(reclength),"%s'\n",buffer); } } } @@ -107,43 +172,49 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) FILE *f; if((f=fopen(indexfilename,"r"))!=NULL) { + // get the dvd id if(fgets(dvdnr,sizeof(dvdnr),f)) { char *p=strchr(dvdnr,'\n'); if(p) *p=0; } + // determine if the dvd is a video dvd + char tmp[BUFSIZ]; + if(fgets(tmp,sizeof(tmp),f)&&!strncmp(tmp,"0000",4)) + isvideodvd=true; + fclose(f); } } free(indexfilename); - char RecDate[9],RecTime[6],RecDelimiter[2]={'\t',0}; - char New[2]={0,0}; + char recdate[9],rectime[6],recdelimiter[2]={'\t',0}; + char dvd[2]={0,0}; if(isdvd) - New[0]=char(129); + dvd[0]=char(129); else if(isnew&&!mysetup.PatchNew) - New[0]='*'; + dvd[0]='*'; else if(!isnew&&mysetup.PatchNew) - New[0]=char(128); + dvd[0]=char(128); - snprintf(RecDate,sizeof(RecDate),"%02d.%02d.%02d",t->tm_mday,t->tm_mon+1,t->tm_year%100); - snprintf(RecTime,sizeof(RecTime),"%02d:%02d",t->tm_hour,t->tm_min); + snprintf(recdate,sizeof(recdate),"%02d.%02d.%02d",t->tm_mday,t->tm_mon+1,t->tm_year%100); + snprintf(rectime,sizeof(rectime),"%02d:%02d",t->tm_hour,t->tm_min); asprintf(&title,"%s%s%s%s%s%s%s%s%s%s", - (mysetup.ShowRecDate?RecDate:""), // show recording date? - (mysetup.ShowRecDate?RecDelimiter:""), // tab - (mysetup.ShowRecTime?RecTime:""), // show recording time? - (mysetup.ShowRecTime?RecDelimiter:""), // tab - ((haslength&&mysetup.ShowRecLength)?RecLength:""), // show recording length? - (mysetup.ShowRecLength?RecDelimiter:""), // tab - New, // dvd/new marker + (mysetup.ShowRecDate?recdate:""), // show recording date? + (mysetup.ShowRecDate?recdelimiter:""), // tab + (mysetup.ShowRecTime?rectime:""), // show recording time? + (mysetup.ShowRecTime?recdelimiter:""), // tab + ((haslength&&mysetup.ShowRecLength)?reclength:""), // show recording length? + (mysetup.ShowRecLength?recdelimiter:""), // tab + dvd, // dvd/new marker (mysetup.ShowDvdNr?dvdnr:""), // show dvd nummber ((isdvd&&mysetup.ShowDvdNr)?" ":""), // space for fancy looking s?s+1:Recording->Name()); // recording name - asprintf(&id,"%s %s %s",RecDate,RecTime,Recording->Name()); + asprintf(&id,"%s %s %s",recdate,rectime,Recording->Name()); } else if(Level>level) // any other @@ -172,7 +243,7 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) else asprintf(&buffer,"%d\t%s",totalentries,name); - // don't show '-', '.', '$', 'ª' or '·' if the directory name ends with one of it + // 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; @@ -180,15 +251,26 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) } // --- myMenuRecordings ------------------------------------------------------- -myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Base:tr("Extended recordings menu")) +#define MB_PER_MINUTE 25.75 // this is just an estimate! + +myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Base:"") { - // patch font + // only called if plugin menu is opened if(Level==0) { + // patch font if(Setup.UseSmallFont==2) PatchFont(fontSml); else PatchFont(fontOsd); + + // show free disc space at title bar + int freemb; + VideoDiskSpace(&freemb); + int minutes=int(double(freemb)/MB_PER_MINUTE); + char buffer[40]; + snprintf(buffer,sizeof(buffer),"%s - %2d:%02d %s",tr("Recordings"),minutes/60,minutes%60,tr("free")); + SetTitle(buffer); } // set tabs if(mysetup.ShowRecDate&&mysetup.ShowRecTime&&!mysetup.ShowRecLength) // recording date and time are shown, recording length not @@ -216,8 +298,8 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas if(mysetup.wasdvd&&!cControl::Control()) { - char *cmd; - asprintf(&cmd,"dvdarchive.sh umount \"%s\"",myReplayControl::LastReplayed()); + char *cmd=NULL; + asprintf(&cmd,"dvdarchive.sh umount \"%s\"",*strescape(myReplayControl::LastReplayed(),"'\\\"$")); isyslog("[extrecmenu] calling %s to unmount dvd",cmd); int result=SystemExec(cmd); if(result) @@ -233,7 +315,7 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas } Set(); - if(myReplayControl::LastReplayed()) + if(myReplayControl::LastReplayed()&&myReplayControl::jumprec) Open(); Display(); @@ -275,7 +357,7 @@ void myMenuRecordings::SetHelpKeys() switch(newhelpkeys) { case 0: SetHelp(NULL);break; - case 1: SetHelp(tr("Button$Open"));break; + case 1: SetHelp(tr("Button$Open"),NULL,tr("Button$Edit"));break; case 2: SetHelp(RecordingCommands.Count()?tr("Button$Commands"):tr("Button$Play"),tr("Button$Rewind"),tr("Button$Edit"),NULL);break; case 3: SetHelp(RecordingCommands.Count()?tr("Button$Commands"):tr("Button$Play"),tr("Button$Rewind"),tr("Button$Edit"),tr("Button$Info"));break; } @@ -324,11 +406,11 @@ void myMenuRecordings::Set(bool Refresh) { if(lastitem->IsDirectory()) lastitem->IncrementCounter(recording->IsNew()); - if(lastreplayed&&!strcmp(lastreplayed,recording->FileName())) + if(lastreplayed&&!strcmp(lastreplayed,recording->FileName())&&myReplayControl::jumprec) { SetCurrent(lastitem); - if(recitem&&!recitem->IsDirectory()&&!cControl::Control()) - myReplayControl::ClearLastReplayed(recording->FileName()); + if(recitem&&!recitem->IsDirectory()&&!cControl::Control()&&!mysetup.JumpRec) + myReplayControl::jumprec=false; } } } @@ -386,47 +468,69 @@ eOSState myMenuRecordings::Play() cRecording *recording=GetRecording(item); if(recording) { - if(item->IsDVD()) + if(item->IsVideoDVD()) { - asprintf(&msg,tr("Please insert DVD %s"),item->DvdNr()); - if(Interface->Confirm(msg)) + cPlugin *plugin=cPluginManager::GetPlugin("dvd"); + if(plugin) { - free(msg); - strcpy(path,recording->FileName()); - name=strrchr(path,'/')+1; - asprintf(&msg,"dvdarchive.sh mount \"%s\" \"%s\"",path,name); // call the dvdarchive.sh script - - isyslog("[extrecmenu] calling %s to mount dvd",msg); - int result=SystemExec(msg); - isyslog("[extrecmenu] dvdarchive.sh returns %d",result); - free(msg); - if(result) - { - result=result/256; - if(result==1) - Skins.Message(mtError,tr("Error while mounting DVD!")); - if(result==2) - Skins.Message(mtError,tr("No DVD in drive!")); - if(result==3) - Skins.Message(mtError,tr("Recording not found on DVD!")); - if(result==4) - Skins.Message(mtError,tr("Error while linking [0-9]*.vdr!")); - if(result==127) - Skins.Message(mtError,tr("Script 'dvdarchive.sh' not found!")); - return osContinue; - } - mysetup.wasdvd=true; + cOsdObject *osd=plugin->MainMenuAction(); + delete osd; + osd=NULL; + return osEnd; } else { - free(msg); + Skins.Message(mtError,tr("DVD plugin is not installed!")); return osContinue; } } - myReplayControl::SetRecording(recording->FileName(),recording->Title()); - cControl::Shutdown(); // stop running playbacks - cControl::Launch(new myReplayControl); // start playback - return osEnd; // close plugin + else + { + if(item->IsDVD()) + { + asprintf(&msg,tr("Please insert DVD %s"),item->DvdNr()); + if(Interface->Confirm(msg)) + { + free(msg); + strcpy(path,recording->FileName()); + name=strrchr(path,'/')+1; + asprintf(&msg,"dvdarchive.sh mount \"%s\" '%s'",*strescape(path,"'"),*strescape(name,"'\\\"$")); + + isyslog("[extrecmenu] calling %s to mount dvd",msg); + int result=SystemExec(msg); + isyslog("[extrecmenu] dvdarchive.sh returns %d",result); + free(msg); + if(result) + { + result=result/256; + if(result==1) + Skins.Message(mtError,tr("Error while mounting DVD!")); + if(result==2) + Skins.Message(mtError,tr("No DVD in drive!")); + if(result==3) + Skins.Message(mtError,tr("Recording not found on DVD!")); + if(result==4) + Skins.Message(mtError,tr("Error while linking [0-9]*.vdr!")); + if(result==5) + Skins.Message(mtError,tr("sudo or mount --bind / umount error (vfat system)")); + if(result==127) + Skins.Message(mtError,tr("Script 'dvdarchive.sh' not found!")); + return osContinue; + } + mysetup.wasdvd=true; + } + else + { + free(msg); + return osContinue; + } + } + myReplayControl::jumprec=true; + myReplayControl::SetRecording(recording->FileName(),recording->Title()); + cControl::Shutdown(); // stop running playbacks + cControl::Launch(new myReplayControl); // start playback + return osEnd; // close plugin + } } } } @@ -487,6 +591,7 @@ eOSState myMenuRecordings::Delete() { if(recording->Delete()) { + cRecordingUserCommand::InvokeCommand("delete",item->FileName()); myReplayControl::ClearLastReplayed(item->FileName()); Recordings.DelByName(item->FileName()); cOsdMenu::Del(Current()); @@ -510,11 +615,16 @@ eOSState myMenuRecordings::Rename() return osContinue; myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); - if(item&&!item->IsDirectory()) + if(item) { - cRecording *recording=GetRecording(item); - if(recording) - return AddSubMenu(new myMenuRenameRecording(recording,this)); + if(item->IsDirectory()) + return AddSubMenu(new myMenuRenameRecording(this,NULL,base,item->Name())); + else + { + cRecording *recording=GetRecording(item); + if(recording) + return AddSubMenu(new myMenuRenameRecording(this,recording,NULL,NULL)); + } } return osContinue; } @@ -542,13 +652,16 @@ eOSState myMenuRecordings::MoveRec() return osContinue; myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); - if(item&&!item->IsDirectory()) + if(item) { - cRecording *recording=GetRecording(item); - if(recording) + clearall=false; + if(item->IsDirectory()) + return AddSubMenu(new myMenuMoveRecording(this,NULL,base,item->Name())); + else { - clearall=false; - return AddSubMenu(new myMenuMoveRecording(recording,this)); + cRecording *recording=GetRecording(item); + if(recording) + return AddSubMenu(new myMenuMoveRecording(this,recording,NULL,NULL)); } } return osContinue; @@ -600,23 +713,22 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) if(edit) { + myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); + if(Key==kRed||Key==kGreen||Key==kYellow||(!item->IsDVD()&&Key==kBlue)||Key==kBack) + { + edit=false; + helpkeys=-1; + } switch(Key) { - case kRed: edit=false; - helpkeys=-1; - return Rename(); - case kGreen: edit=false, - helpkeys=-1; - return MoveRec(); - case kYellow: edit=false; - helpkeys=-1; - return Delete(); - case kBlue: edit=false; - helpkeys=-1; - return Details(); - case kBack: edit=false; - helpkeys=-1; - SetHelpKeys(); + case kRed: return Rename(); + case kGreen: return MoveRec(); + case kYellow: return Delete(); + case kBlue: if(item&&!item->IsDVD()) + return Details(); + else + break; + case kBack: SetHelpKeys(); default: break; } state=osContinue; @@ -634,10 +746,13 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) case kGreen: return Rewind(); case kYellow: { myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); - if(item&&!item->IsDirectory()) + if(!HasSubMenu()&&item) { edit=true; - SetHelp(tr("Button$Rename"),tr("Button$Move"),tr("Button$Delete"),tr("Details")); + if(item->IsDirectory()) + SetHelp(tr("Button$Rename"),tr("Button$Move")); + else + SetHelp(tr("Button$Rename"),tr("Button$Move"),tr("Button$Delete"),!item->IsDVD()?tr("Details"):NULL); } break; } diff --git a/mymenurecordings.h b/mymenurecordings.h index 36e3f17..c7d8830 100644 --- a/mymenurecordings.h +++ b/mymenurecordings.h @@ -5,6 +5,7 @@ class myMenuRecordingsItem:public cOsdItem { private: bool isdvd; + bool isvideodvd; char dvdnr[BUFSIZ]; int level,isdirectory; int totalentries,newentries; @@ -20,6 +21,7 @@ class myMenuRecordingsItem:public cOsdItem bool IsDirectory(){return name!=NULL;} void IncrementCounter(bool IsNew); bool IsDVD(){return isdvd;} + bool IsVideoDVD(){return isvideodvd;} char *DvdNr(){return dvdnr;} const char *ID(){return id;} }; @@ -54,12 +56,15 @@ class myMenuRecordings:public cOsdMenu class myMenuRenameRecording:public cOsdMenu { private: + bool isdir; + char *dirbase,*dirname; char name[MaxFileName]; char path[MaxFileName]; cRecording *recording; myMenuRecordings *menurecordings; public: - myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings); + myMenuRenameRecording(myMenuRecordings *MenuRecordings,cRecording *Recording,const char *DirBase,const char *DirName); + ~myMenuRenameRecording(); virtual eOSState ProcessKey(eKeys Key); }; @@ -69,6 +74,7 @@ class myMenuMoveRecording:public cOsdMenu private: int level; char *base; + char *dirbase,*dirname; cRecording *recording; myMenuRecordings *menurecordings; void Set(); @@ -76,12 +82,12 @@ class myMenuMoveRecording:public cOsdMenu eOSState MoveRec(); eOSState Create(); public: - myMenuMoveRecording(cRecording *Recording,myMenuRecordings *MenuRecordings,const char *Base=NULL,int Level=0); + myMenuMoveRecording(myMenuRecordings *MenuRecordings,cRecording *Recording,const char *DirBase,const char *DirName,const char *Base=NULL,int Level=0); myMenuMoveRecording::~myMenuMoveRecording(); virtual eOSState ProcessKey(eKeys Key); }; -// --- myMenuRenameRecording -------------------------------------------------- +// --- myMenuRecordingDetails ------------------------------------------------- class myMenuRecordingDetails:public cOsdMenu { private: diff --git a/mymenusetup.c b/mymenusetup.c index e5dec57..ccbf76a 100644 --- a/mymenusetup.c +++ b/mymenusetup.c @@ -1,3 +1,7 @@ +/* + * See the README file for copyright information and how to reach the author. + */ + #include <vdr/menu.h> #include "mymenusetup.h" @@ -12,6 +16,7 @@ mySetup::mySetup() mysetup.ShowRecLength=0; mysetup.ShowNewRecs=1; mysetup.SortRecords=0; + mysetup.JumpRec=1; mysetup.wasdvd=false; } @@ -33,6 +38,7 @@ myMenuSetup::myMenuSetup() showdvdnr=mysetup.ShowDvdNr; shownewrecs=mysetup.ShowNewRecs; sortrecords=mysetup.SortRecords; + jumprec=mysetup.JumpRec; Add(new cMenuEditBoolItem(tr("Show recording date"),&showrecdate)); Add(new cMenuEditBoolItem(tr("Show recording time"),&showrectime)); @@ -43,6 +49,7 @@ myMenuSetup::myMenuSetup() Add(new cMenuEditBoolItem(tr("Show dvd number"),&showdvdnr)); Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&hidemainmenuentry)); Add(new cMenuEditBoolItem(tr("Replace original recordings menu"),&replaceorgrecmenu)); + Add(new cMenuEditBoolItem(tr("While opening jump to last replayed recording"),&jumprec)); } void myMenuSetup::Store() @@ -56,4 +63,5 @@ void myMenuSetup::Store() SetupStore("ShowRecLength",mysetup.ShowRecLength=showreclength); SetupStore("ShowNewRecs",mysetup.ShowNewRecs=shownewrecs); SetupStore("SortRecords",mysetup.SortRecords=sortrecords); + SetupStore("JumpRec",mysetup.JumpRec=jumprec); } diff --git a/mymenusetup.h b/mymenusetup.h index 8813ac9..164de87 100644 --- a/mymenusetup.h +++ b/mymenusetup.h @@ -13,6 +13,7 @@ class mySetup int ShowDvdNr; int ShowNewRecs; int SortRecords; + int JumpRec; bool wasdvd; // needed for dvdarchive-patch functionality }; @@ -31,6 +32,7 @@ class myMenuSetup:public cMenuSetupPage int showdvdnr; int shownewrecs; int sortrecords; + int jumprec; protected: virtual void Store(); public: diff --git a/myreplaycontrol.c b/myreplaycontrol.c index eeee7ee..65c9dd5 100644 --- a/myreplaycontrol.c +++ b/myreplaycontrol.c @@ -1,468 +1,20 @@ /* * See the README file for copyright information and how to reach the author. - * - * This code is directly taken from VDR with some changes by me to work with this plugin. - * Also to JumpPlay-Patch is integrated using #ifdef's. */ #include <vdr/interface.h> #include <vdr/status.h> -#include <vdr/cutter.h> #include "myreplaycontrol.h" -char *myReplayControl::fileName = NULL; -char *myReplayControl::title = NULL; +bool myReplayControl::jumprec=true; -myReplayControl::myReplayControl(void) -#ifdef BIGPATCHVERSION -:cDvbPlayerControl(fileName,&marks) -#endif -#ifndef BIGPATCHVERSION -:cDvbPlayerControl(fileName) -#endif -{ - displayReplay = NULL; - visible = modeOnly = shown = displayFrames = false; - lastCurrent = lastTotal = -1; - lastPlay = lastForward = false; - lastSpeed = -1; - timeoutShow = 0; - timeSearchActive = false; - marks.Load(fileName); -#ifdef BIGPATCHVERSION - lastLoadMarks = time(NULL); -#endif - cRecording Recording(fileName); - cStatus::MsgReplaying(this, Recording.Name(), Recording.FileName(), true); -} - -myReplayControl::~myReplayControl() +eOSState myReplayControl::ProcessKey(eKeys Key) { - Hide(); - cStatus::MsgReplaying(this, NULL, fileName, false); - Stop(); -// --- <my changes> --- -// calls the main menu of this plugin after playback ends + if(Key==kBack) + { cRemote::CallPlugin("extrecmenu"); -// --- </my changes> --- -} - -void myReplayControl::SetRecording(const char *FileName, const char *Title) -{ - free(fileName); - free(title); - fileName = FileName ? strdup(FileName) : NULL; - title = Title ? strdup(Title) : NULL; -} - -const char *myReplayControl::LastReplayed(void) -{ - return fileName; -} - -void myReplayControl::ClearLastReplayed(const char *FileName) -{ - if (fileName && FileName && strcmp(fileName, FileName) == 0) { - free(fileName); - fileName = NULL; - } -} - -void myReplayControl::ShowTimed(int Seconds) -{ - if (modeOnly) - Hide(); - if (!visible) { - shown = ShowProgress(true); - timeoutShow = (shown && Seconds > 0) ? time(NULL) + Seconds : 0; - } -} - -void myReplayControl::Show(void) -{ - ShowTimed(); -} - -void myReplayControl::Hide(void) -{ - if (visible) { - delete displayReplay; - displayReplay = NULL; - needsFastResponse = visible = false; - modeOnly = false; - lastPlay = lastForward = false; - lastSpeed = -1; - timeSearchActive = false; - } -} - -void myReplayControl::ShowMode(void) -{ - if (visible || Setup.ShowReplayMode && !cOsd::IsOpen()) { - bool Play, Forward; - int Speed; - if (GetReplayMode(Play, Forward, Speed) && (!visible || Play != lastPlay || Forward != lastForward || Speed != lastSpeed)) { - bool NormalPlay = (Play && Speed == -1); - - if (!visible) { - if (NormalPlay) - return; // no need to do indicate ">" unless there was a different mode displayed before - visible = modeOnly = true; - displayReplay = Skins.Current()->DisplayReplay(modeOnly); - } - - if (modeOnly && !timeoutShow && NormalPlay) - timeoutShow = time(NULL) + MODETIMEOUT; - displayReplay->SetMode(Play, Forward, Speed); - lastPlay = Play; - lastForward = Forward; - lastSpeed = Speed; - } - } -} - -bool myReplayControl::ShowProgress(bool Initial) -{ - int Current, Total; - - if (GetIndex(Current, Total) && Total > 0) { - if (!visible) { - displayReplay = Skins.Current()->DisplayReplay(modeOnly); - displayReplay->SetMarks(&marks); - needsFastResponse = visible = true; - } - if (Initial) { - if (title) - displayReplay->SetTitle(title); - lastCurrent = lastTotal = -1; - } - if (Total != lastTotal) { - displayReplay->SetTotal(IndexToHMSF(Total)); - if (!Initial) - displayReplay->Flush(); - } - if (Current != lastCurrent || Total != lastTotal) { - displayReplay->SetProgress(Current, Total); - if (!Initial) - displayReplay->Flush(); - displayReplay->SetCurrent(IndexToHMSF(Current, displayFrames)); - displayReplay->Flush(); - lastCurrent = Current; - } - lastTotal = Total; - ShowMode(); - return true; - } - return false; -} + return osEnd; + } -void myReplayControl::TimeSearchDisplay(void) -{ - char buf[64]; - strcpy(buf, tr("Jump: ")); - int len = strlen(buf); - char h10 = '0' + (timeSearchTime >> 24); - char h1 = '0' + ((timeSearchTime & 0x00FF0000) >> 16); - char m10 = '0' + ((timeSearchTime & 0x0000FF00) >> 8); - char m1 = '0' + (timeSearchTime & 0x000000FF); - char ch10 = timeSearchPos > 3 ? h10 : '-'; - char ch1 = timeSearchPos > 2 ? h1 : '-'; - char cm10 = timeSearchPos > 1 ? m10 : '-'; - char cm1 = timeSearchPos > 0 ? m1 : '-'; - sprintf(buf + len, "%c%c:%c%c", ch10, ch1, cm10, cm1); - displayReplay->SetJump(buf); -} - -void myReplayControl::TimeSearchProcess(eKeys Key) -{ -#define STAY_SECONDS_OFF_END 10 - int Seconds = (timeSearchTime >> 24) * 36000 + ((timeSearchTime & 0x00FF0000) >> 16) * 3600 + ((timeSearchTime & 0x0000FF00) >> 8) * 600 + (timeSearchTime & 0x000000FF) * 60; - int Current = (lastCurrent / FRAMESPERSEC); - int Total = (lastTotal / FRAMESPERSEC); - switch (Key) { - case k0 ... k9: - if (timeSearchPos < 4) { - timeSearchTime <<= 8; - timeSearchTime |= Key - k0; - timeSearchPos++; - TimeSearchDisplay(); - } - break; - case kFastRew: - case kLeft: - case kFastFwd: - case kRight: { - int dir = ((Key == kRight || Key == kFastFwd) ? 1 : -1); - if (dir > 0) - Seconds = min(Total - Current - STAY_SECONDS_OFF_END, Seconds); - SkipSeconds(Seconds * dir); - timeSearchActive = false; - } - break; - case kPlay: - case kUp: - case kPause: - case kDown: - case kOk: - Seconds = min(Total - STAY_SECONDS_OFF_END, Seconds); - Goto(Seconds * FRAMESPERSEC, Key == kDown || Key == kPause || Key == kOk); - timeSearchActive = false; - break; - default: - timeSearchActive = false; - break; - } - - if (!timeSearchActive) { - if (timeSearchHide) - Hide(); - else - displayReplay->SetJump(NULL); - ShowMode(); - } -} - -void myReplayControl::TimeSearch(void) -{ - timeSearchTime = timeSearchPos = 0; - timeSearchHide = false; - if (modeOnly) - Hide(); - if (!visible) { - Show(); - if (visible) - timeSearchHide = true; - else - return; - } - timeoutShow = 0; - TimeSearchDisplay(); - timeSearchActive = true; -} - -void myReplayControl::MarkToggle(void) -{ - int Current, Total; - if (GetIndex(Current, Total, true)) { - cMark *m = marks.Get(Current); - lastCurrent = -1; // triggers redisplay - if (m) - marks.Del(m); - else { - marks.Add(Current); - ShowTimed(2); - bool Play, Forward; - int Speed; -#ifndef BIGPATCHVERSION - if (GetReplayMode(Play, Forward, Speed) && !Play) - Goto(Current, true); -#endif -#ifdef BIGPATCHVERSION - if (GetReplayMode(Play, Forward, Speed) && !Play) { - Goto(Current, true); - displayFrames = true; - } -#endif - } - - marks.Save(); - } -} - -void myReplayControl::MarkJump(bool Forward) -{ - if (marks.Count()) { - int Current, Total; - if (GetIndex(Current, Total)) { - cMark *m = Forward ? marks.GetNext(Current) : marks.GetPrev(Current); - if (m) { -#ifndef BIGPATCHVERSION - Goto(m->position, true); - displayFrames = true; -#endif -#ifdef BIGPATCHVERSION - bool Play2, Forward2; - int Speed; - if (Setup.JumpPlay && GetReplayMode(Play2, Forward2, Speed) && - Play2 && Forward && m->position < Total - SecondsToFrames(3)) { - Goto(m->position); - Play(); - } - else { - Goto(m->position, true); - displayFrames = true; - } -#endif - } - } - } -} - -void myReplayControl::MarkMove(bool Forward) -{ - int Current, Total; - if (GetIndex(Current, Total)) { - cMark *m = marks.Get(Current); - if (m) { - displayFrames = true; - int p = SkipFrames(Forward ? 1 : -1); - cMark *m2; - if (Forward) { - if ((m2 = marks.Next(m)) != NULL && m2->position <= p) - return; - } - else { - if ((m2 = marks.Prev(m)) != NULL && m2->position >= p) - return; - } - Goto(m->position = p, true); - marks.Save(); - } - } -} - -void myReplayControl::EditCut(void) -{ - if (fileName) { - Hide(); - if (!cCutter::Active()) { - if (!marks.Count()) - Skins.Message(mtError, tr("No editing marks defined!")); - else if (!cCutter::Start(fileName)) - Skins.Message(mtError, tr("Can't start editing process!")); - else - Skins.Message(mtInfo, tr("Editing process started")); - } - else - Skins.Message(mtError, tr("Editing process already active!")); - ShowMode(); - } -} - -void myReplayControl::EditTest(void) -{ - int Current, Total; - if (GetIndex(Current, Total)) { - cMark *m = marks.Get(Current); - if (!m) - m = marks.GetNext(Current); - if (m) { -#ifndef BIGPATCHVERSION - if ((m->Index() & 0x01) != 0) -#endif -#ifdef BIGPATCHVERSION - if ((m->Index() & 0x01) != 0 && !Setup.PlayJump) -#endif - m = marks.Next(m); - if (m) { - Goto(m->position - SecondsToFrames(3)); - Play(); - } - } - } -} - -cOsdObject *myReplayControl::GetInfo(void) -{ - cRecording *Recording = Recordings.GetByName(myReplayControl::LastReplayed()); - if (Recording) - return new myMenuRecordingInfo(Recording, false); - return NULL; -} - -eOSState myReplayControl::ProcessKey(eKeys Key) -{ - if (!Active()) - return osEnd; -#ifdef BIGPATCHVERSION - if (Setup.LoadMarksInterval && - time(NULL) >= lastLoadMarks + Setup.LoadMarksInterval) { - marks.Load(fileName, true); - lastLoadMarks = time(NULL); - } -#endif - if (visible) { - if (timeoutShow && time(NULL) > timeoutShow) { - Hide(); - ShowMode(); - timeoutShow = 0; - } - else if (modeOnly) - ShowMode(); - else - shown = ShowProgress(!shown) || shown; - } - bool DisplayedFrames = displayFrames; - displayFrames = false; - if (timeSearchActive && Key != kNone) { - TimeSearchProcess(Key); - return osContinue; - } - bool DoShowMode = true; - switch (Key) { - // Positioning: - case kPlay: - case kUp: Play(); break; - case kPause: - case kDown: Pause(); break; - case kFastRew|k_Release: - case kLeft|k_Release: - if (Setup.MultiSpeedMode) break; - case kFastRew: - case kLeft: Backward(); break; - case kFastFwd|k_Release: - case kRight|k_Release: - if (Setup.MultiSpeedMode) break; - case kFastFwd: - case kRight: Forward(); break; - case kRed: TimeSearch(); break; - case kGreen|k_Repeat: - case kGreen: SkipSeconds(-60); break; - case kYellow|k_Repeat: - case kYellow: SkipSeconds( 60); break; - case kStop: - case kBlue: Hide(); - Stop(); - return osEnd; - default: { - DoShowMode = false; - switch (Key) { - // Editing: - case kMarkToggle: MarkToggle(); break; - case kMarkJumpBack|k_Repeat: - case kMarkJumpBack: MarkJump(false); break; - case kMarkJumpForward|k_Repeat: - case kMarkJumpForward: MarkJump(true); break; - case kMarkMoveBack|k_Repeat: - case kMarkMoveBack: MarkMove(false); break; - case kMarkMoveForward|k_Repeat: - case kMarkMoveForward: MarkMove(true); break; - case kEditCut: EditCut(); break; - case kEditTest: EditTest(); break; - default: { - displayFrames = DisplayedFrames; - switch (Key) { - // Menu control: - case kOk: if (visible && !modeOnly) { - Hide(); - DoShowMode = true; - } - else - Show(); - break; -// --- <my changes> --- -// changed to get the plugin main menu instead of the recordings menu -// because this one line i had the build this hole class new :-D -// case kBack: return osRecordings; - case kBack: return osEnd; -// --- </my changes> --- - default: return osUnknown; - } - } - } - } - } - if (DoShowMode) - ShowMode(); - return osContinue; + return cReplayControl::ProcessKey(Key); } diff --git a/myreplaycontrol.h b/myreplaycontrol.h index 915ab8a..78d0008 100644 --- a/myreplaycontrol.h +++ b/myreplaycontrol.h @@ -1,57 +1,8 @@ -#include <vdr/dvbplayer.h> -#define MODETIMEOUT 3 // seconds +#include <vdr/menu.h> -// --- myReplayControls ------------------------------------------------------- -class myReplayControl : public cDvbPlayerControl { -private: - cSkinDisplayReplay *displayReplay; - cMarks marks; - bool visible, modeOnly, shown, displayFrames; - int lastCurrent, lastTotal; - bool lastPlay, lastForward; - int lastSpeed; - time_t timeoutShow; -#ifdef BIGPATCHVERSION - time_t lastLoadMarks; -#endif - bool timeSearchActive, timeSearchHide; - int timeSearchTime, timeSearchPos; - void TimeSearchDisplay(void); - void TimeSearchProcess(eKeys Key); - void TimeSearch(void); - void ShowTimed(int Seconds = 0); - static char *fileName; - static char *title; - void ShowMode(void); - bool ShowProgress(bool Initial); - void MarkToggle(void); - void MarkJump(bool Forward); - void MarkMove(bool Forward); - void EditCut(void); - void EditTest(void); -public: - myReplayControl(void); - virtual ~myReplayControl(); - virtual cOsdObject *GetInfo(void); - virtual eOSState ProcessKey(eKeys Key); - virtual void Show(void); - virtual void Hide(void); - bool Visible(void) { return visible; } - static void SetRecording(const char *FileName, const char *Title); - static const char *LastReplayed(void); - static void ClearLastReplayed(const char *FileName); - }; - -// --- myMenuRecordingInfo ---------------------------------------------------- -class myMenuRecordingInfo:public cOsdMenu +class myReplayControl:public cReplayControl { - private: - const cRecording *recording; - bool withButtons; - eOSState Play(); - eOSState Rewind(); public: - myMenuRecordingInfo(const cRecording *Recording,bool WithButtons = false); - virtual void Display(void); - virtual eOSState ProcessKey(eKeys Key); + eOSState ProcessKey(eKeys Key); + static bool jumprec; }; diff --git a/scripts/dvdarchive.sh b/scripts/dvdarchive.sh index f7bf066..cf545ee 100755 --- a/scripts/dvdarchive.sh +++ b/scripts/dvdarchive.sh @@ -1,7 +1,46 @@ #!/bin/bash # -# Version 1.5 2006-04-17 +# Version 1.9 2006-04-28 # +# Author: Mike Constabel +# VDR-Portal: vejoun +# EMail: vejoun @ toppoint.de +# +# MANUAL: +# ------- +# 1. +# If you run VDR as user, you need in /etc/fstab the option "user" for your DVD mountpoint. +# +# Example: +# /dev/hdc /media/cdrom iso9660 defaults,ro,user,noauto 0 0 +# +# 2. +# If you use a VFAT partition for your video-data, you must configure sudo to allow the +# VDR-user to execute mount and umount as root. To edit sudoers run 'visudo' command as root. +# +# Example: +# # Cmnd alias specification +# Cmnd_Alias SYSTEM = /bin/mount, /bin/umount +# # User privilege specification +# vdr ALL=(root) NOPASSWD: SYSTEM +# +# With a vfat partition some things doesn't work: resume, marks +# +# 3. +# For dvd-in-drive detection compile isodetect.c and put it into the $PATH, +# usually /usr/local/bin/ +# You find isodetect.c in the extrecmenu plugin source package. +# +# 4. +# Tools needed: mount, awk, find, test, stat +# Optional tools: isodetect +# +# 5. +# If you have some DVDs with the index.vdr only on DVD, you don't use vfat and you +# want to see the recording length in the menu, you can switch GETLENGTH to 1 and +# the script will create a length.vdr for you. +# +# 6. # Exitcodes: # # exit 0 - no error @@ -9,29 +48,44 @@ # exit 2 - no dvd in drive # exit 3 - wrong dvd in drive / recording not found # exit 4 - error while linking [0-9]*.vdr +# exit 5 - sudo or mount --bind / umount error (vfat system) # -# Errorhandling/Symlinking: vejoun@vdr-portal +# HISTORY: +# -------- +# 1.9 - use "sudo mount --bind" for mounting if filesystem is vfat +# - automatic fallback to 'sudo' and 'mount --bind' if filesystem is vfat +# - mounting more failure tolerant +# - added MANUAL part in script +# - length.vdr creation, you must not use it ;) # -# For dvd-in-drive detection download isodetect.c, compile it and put it into the PATH, -# usually /usr/local/bin/ +# 1.8 - remove sudo, is not necessary +# - on mount, if already mounted try to umount first +# - logging per syslog, see $SYSLOG # -# Tools needed: mount, awk, find, test -# Optional tools: isodetect #<Configuration> -MOUNTCMD="/usr/bin/sudo /bin/mount" -UMOUNTCMD="/usr/bin/sudo /bin/umount" - -MOUNTPOINT="/media/cdrom" # no trailing '/'! +# Mountpoint, the same as in fstab +MOUNTPOINT="/media/cdrom" # no trailing '/' # Eject DVD for exit-codes 2 and 3 (no or wrong dvd). 1 = yes, 0 = no. EJECTWRONG=0 + # Eject DVD after unmounting. 1 = yes, 0 = no. EJECTUMOUNT=0 +# Log warnings/errors in syslog. 1 = yes, 0 = no. +SYSLOG=0 + +# Create a length.vdr after mounting the dvd for the played recording. 1 = yes, 0 = no. +# Only for non-vfat and with index.vdr only on dvd. +GETLENGTH=0 + #</Configuration> +# No changes needed after this mark + +MOUNTPOINT=${MOUNTPOINT/%\/} DEVICE="$(awk '( $1 !~ /^#/ ) && ( $2 == "'$MOUNTPOINT'" ) { printf("%s", $1); exit; }' /etc/fstab)" # dvd-device, used by isodetect if exists REC="$2" @@ -40,8 +94,22 @@ NAME="$3" call() { 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" + echo -e "Example: dvdarchive.sh mount '/video0/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 '/video0/Music/%Riverdance/2004-06-06.00:10.50.99.rec'\n" + echo -e "For more information read the MANUAL part inside this script.\n" +} + +log() { + case $1 in + warning) + echo -e "WARNING: $2" + [ $SYSLOG -eq 1 ] && logger -t "$0" "WARNING: $2" + ;; + error) + echo -e "ERROR: $2" + [ $SYSLOG -eq 1 ] && logger -t "$0" "ERROR: $2" + ;; + esac } [ "$1" = "mount" -o "$1" = "umount" ] || { call; exit 10; } @@ -54,61 +122,105 @@ mount) if [ -n "$(which isodetect)" -a -n "$DEVICE" ]; then isodetect -d "$DEVICE" >/dev/null 2>&1 if [ $? -ne 0 ]; then - echo "no dvd in drive" + log warning "no dvd in drive" [ $EJECTWRONG -eq 1 ] && { eject "$DEVICE"; } exit 2 fi fi # check if not mounted - $MOUNTCMD | grep "$MOUNTPOINT" >/dev/null && { echo "dvd already mounted"; exit 1; } + if mount | egrep -q " $MOUNTPOINT "; then + # check if dvd is in use + if mount | egrep -q "^$MOUNTPOINT"; then + log error "dvd in use" + exit 1 + fi + # if already mountet, try to umount + log warning "dvd already mounted, try to umount" + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } + # unlink broken existing links + for LINK in "${REC}/"*.vdr; do + if [ -L "$LINK" -a ! -s "$LINK" ]; then + rm "$LINK" + fi + done + fi # mount dvd - $MOUNTCMD "$MOUNTPOINT" || { echo "dvd mount error"; exit 1; } - # is mounted? - # find recording on dvd + mount "$MOUNTPOINT" || { log error "dvd mount error"; exit 1; } + # is mounted, find recording on dvd DIR="$(find "${MOUNTPOINT}/" -name "$NAME")" # if not found, umount if [ -z "$DIR" ]; then - $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } - echo "wrong dvd in drive / recording not found on dvd" + log error "wrong dvd in drive / recording not found on dvd" + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } + # If wanted, eject dvd [ $EJECTWRONG -eq 1 ] && { eject "$DEVICE"; } exit 3 fi - # link index.vdr if not exist - if [ ! -e "${REC}/index.vdr" ]; then - cp -s "${DIR}/index.vdr" "${REC}/" + # check if video partition is vfat + if [ "$(stat -f -c %T "$REC")" != "vfat" ]; then + # link index.vdr if not exist + if [ ! -e "${REC}/index.vdr" ]; then + cp -s "${DIR}/index.vdr" "${REC}/" + fi + # link [0-9]*.vdr files + cp -s "${DIR}"/[0-9]*.vdr "${REC}/" + # error while linking [0-9]*.vdr files? + if [ $? -ne 0 ]; then + log error "error while linking [0-9]*.vdr" + # umount dvd bevor unlinking + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } + # unlink broken links + for LINK in "${REC}/"*.vdr; do + if [ -L "$LINK" -a ! -s "$LINK" ]; then + rm "$LINK" + fi + done + exit 4 + fi + # If wanted, create length.vdr + if [ $GETLENGTH -eq 1 -a ! -s "${REC}/length.vdr" -a -L "${REC}/index.vdr" ]; then + echo $(( $(stat -L -c %s "${REC}/index.vdr")/12000 )) > "${REC}/length.vdr" + fi + else + if [ ! "$(sudo -l | egrep "\(root\) NOPASSWD: /bin/mount")" -o ! "$(sudo -l | egrep "\(root\) NOPASSWD: /bin/umount")" ]; then + log error "you must configure sudo and allow $(whoami) to use mount/umount!" + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } + exit 5 + fi + # mount recording + sudo mount --bind "$DIR" "$REC" + if [ $? -ne 0 ]; then + log error "sudo mount --bind $DIR $REC" + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } + exit 5 + fi fi - # link [0-9]*.vdr files - cp -s "${DIR}/"[0-9]*.vdr "${REC}/" - # error while linking [0-9]*.vdr files? - if [ $? -ne 0 ]; then - # umount dvd bevor unlinking - $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } + ;; +umount) + # check if dvd is mounted + mount | egrep -q " $MOUNTPOINT " || { log error "dvd not mounted"; exit 1; } + # check if video partition is vfat + if [ "$(stat -f -c %T "$REC")" != "vfat" ]; then + # is mounted, umount dvd bevor unlinking + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } # unlink broken links for LINK in "${REC}/"*.vdr; do if [ -L "$LINK" -a ! -s "$LINK" ]; then rm "$LINK" fi done - echo "error while linking [0-9]*.vdr" - exit 4 + else + # umount recording + sudo umount "$REC" || { log error "sudo umount $REC"; exit 5; } + # umount dvd + umount "$MOUNTPOINT" || { log error "dvd umount error"; exit 1; } fi - ;; -umount) - # check if dvd is mounted - $MOUNTCMD | grep "$MOUNTPOINT" >/dev/null || { echo "dvd not mounted"; exit 1; } - # is mounted? - # umount dvd bevor unlinking - $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } - # unlink broken links - for LINK in "${REC}/"*.vdr; do - if [ -L "$LINK" -a ! -s "$LINK" ]; then - rm "$LINK" - fi - done + # If wanted, eject dvd [ $EJECTUMOUNT -eq 1 ] && { eject "$DEVICE"; } ;; *) - echo -e "\nWrong action." + # Output help + log error "\nWrong action." call ;; esac @@ -1,8 +1,5 @@ /* * See the README file for copyright information and how to reach the author. - * - * The code for sort recordings is adopted from the SortRecordings-patch - * copyright by FrankJepsen and FRank99 from vdr-portal.de */ #include <vdr/videodir.h> @@ -10,28 +7,6 @@ #include "tools.h" #include "mymenusetup.h" -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) - { - result=RenameVideoFile(Recording->FileName(),NewName); - if(result) - { - // update recordings list - Recordings.AddByName(NewName); - Recordings.Del(Recording,false); - return true; - } - } - isyslog("[extrecmenu] moving failed"); - return false; -} - // --- myRecListItem ---------------------------------------------------------- myRecListItem::myRecListItem(cRecording *Recording) { @@ -63,8 +38,12 @@ char *myRecListItem::StripEpisodeName(char *s) } t++; } +/* + * The code for sort recordings is adopted from the SortRecordings-patch + * copyright by FrankJepsen and Frank99 from vdr-portal.de +*/ *s1=255; - if(s1&&s2&&(s1==s&&(mysetup.SortRecords&1)||s1!=s&&(mysetup.SortRecords==3||mysetup.SortRecords!=2&&!strchr(".-$ª·",*(s1-1))))) + if(s1&&s2&&(s1==s&&(mysetup.SortRecords&1)||s1!=s&&(mysetup.SortRecords==3||mysetup.SortRecords!=2&&!strchr(".-$ª·",*(s1-1))))) memmove(s1+1,s2,t-s2+1); return s; } @@ -1,5 +1,3 @@ -bool MoveVideoFile(cRecording *Recording,char *NewName); - class myRecListItem:public cListObject { private: |