diff options
-rw-r--r-- | HISTORY | 22 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README | 49 | ||||
-rw-r--r-- | extrecmenu.c | 14 | ||||
-rw-r--r-- | extrecmenu.h | 2 | ||||
-rw-r--r-- | i18n.c | 218 | ||||
-rw-r--r-- | mymenumoverecording.c | 152 | ||||
-rw-r--r-- | mymenumoverecording.h | 75 | ||||
-rw-r--r-- | mymenurecordings.c | 170 | ||||
-rw-r--r-- | mymenurecordings.h | 6 | ||||
-rw-r--r-- | mymenurenamerecording.c | 36 | ||||
-rw-r--r-- | mymenusetup.c | 13 | ||||
-rw-r--r-- | mymenusetup.h | 7 | ||||
-rw-r--r-- | patchfont.c | 163 | ||||
-rw-r--r-- | patchfont.h | 1 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh | 49 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh.old | 37 | ||||
-rw-r--r-- | tools.c | 23 | ||||
-rw-r--r-- | tools.h | 1 |
19 files changed, 891 insertions, 149 deletions
@@ -1,6 +1,28 @@ VDR Plugin 'extrecmenu' Revision History ---------------------------------------- +2006-03-25: Version 0.7 +- added frensh translation; thanks to Patrice Staudt +- added finnish translation; thanks to Rolf Ahrenberg +- several bugfixes: + * if there are more then one recording with the same name, only one of it is + shown if the recording details are hidden; thanks to Monroe from + vdr-portal.de for reporting + * recording list entry (not the recording itselfs!) is deleted, if it is + moved to the same place; thanks to Monroe from vdr-portal.de for reporting + * if a recording was deleted, the selection bar jumps to the first list entry + * some people reported problems with wrong recording dates using LinVDR +- revised rename-recording-menu; thanks to Monroe from vdr-portal.de for + suggesting +- revised move-recording-menu - it is now more obvious; thanks to Monroe from + vdr-portal.de for suggesting +- added option to show an alternative new marker - it's only useful for german + speaking users because this icon shows 'NEU'; suggestions for an + international version are welcome, you has 22x22 pixels for it +- added the functionality of the DvdArchive- and the DVDShowArchive-patch + for VDR +- thanks fpr vejoun from vdr-portal.de for the script 'dvdarchive.sh' + 2006-03-17: Version 0.6a - fixed problem with open directories @@ -48,7 +48,7 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o mymenurenamerecording.o \ mymenumoverecording.o i18n.o mydvbplayer.o mymenurecordinginfo.o mymenusetup.o \ - mymenucommands.o + mymenucommands.o patchfont.o tools.o ### Implicit rules: @@ -4,22 +4,55 @@ 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 copyright -information +See the file COPYING for license information. See top of *.c for additional +copyright information -Description: +Description +------------------------------------------------------------------------------- This plugin provides a recordings menu enhanced with the possibility to -rename or move recordings. +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 +------------------------------------------------------------------------------- Renaming: Select a recording, press 'Yellow', then 'Red'. Type in/edit the name. By pressing 'Ok', the recording will be renamed with this name. Moving: -Select a recording, press 'Yellow', then 'Green'. Now you are in the base video -directory. You can browse the directories, the path to the selected directory -is shown at the title bar. By pressing 'Blue' you select this path for 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 -There is a patch for VDR in /patches for replacing VDR's recordings menu with +DVDArchive-patch 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. 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 +and 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. + +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 at +/etc/fstab. + +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 this plugin. You have to set the corresponding option at the setup menu of the plugin! diff --git a/extrecmenu.c b/extrecmenu.c index 918cb99..58ea7e7 100644 --- a/extrecmenu.c +++ b/extrecmenu.c @@ -35,6 +35,9 @@ bool cPluginExtrecmenu::ProcessArgs(int argc, char *argv[]) bool cPluginExtrecmenu::Initialize(void) { RegisterI18n(Phrases); + + mysetup.wasdvd=false; + return true; } @@ -86,7 +89,16 @@ bool cPluginExtrecmenu::SetupParse(const char *Name, const char *Value) if(!strcasecmp(Name,"ReplaceOrgRecMenu")) mysetup.ReplaceOrgRecMenu=atoi(Value); else - return false; + if(!strcasecmp(Name,"PatchNew")) + mysetup.PatchNew=atoi(Value); + else + if(!strcasecmp(Name,"PatchDvd")) + mysetup.PatchDvd=atoi(Value); + else + if(!strcasecmp(Name,"ShowDvdNr")) + mysetup.ShowDvdNr=atoi(Value); + else + return false; return true; } diff --git a/extrecmenu.h b/extrecmenu.h index f78b7b9..78bf1d6 100644 --- a/extrecmenu.h +++ b/extrecmenu.h @@ -1,6 +1,6 @@ #include <vdr/plugin.h> -static const char *VERSION = "0.6a"; +static const char *VERSION = "0.7"; static const char *DESCRIPTION = "Extended recordings menu"; static const char *MAINMENUENTRY = "ExtRecMenu"; @@ -1,71 +1,279 @@ /* * See the README file for copyright information and how to reach the author. - * */ - #include "i18n.h" const tI18nPhrase Phrases[] = { { "Extended recordings menu", "Erweitertes Aufzeichnungs-Menü", + "", + "", + "", + "", + "Menu enregistrement étandu", + "", + "Laajennettu tallennevalikko", }, { "Button$Open", "Öffnen", + "", + "", + "", + "", + "Ouvrir", + "", + "Avaa", }, { "Button$Cancel", "Abbrechen", + "", + "", + "", + "", + "Interrompre", + "", + "Peruuta", }, { "Button$Play", "Wiedergabe", + "", + "", + "", + "", + "Montrer", + "", + "Toista", }, { "Button$Commands", "Befehle", + "", + "", + "", + "", + "Commande", + "", + "Komennot", }, { "Button$Rewind", "Anfang", + "", + "", + "", + "", + "Début", + "", + "Alkuun", }, { "Button$Create", "Anlegen", - }, - { "Button$Select", - "Auswählen", + "", + "", + "", + "", + "Créer", + "", + "Luo", }, { "Button$Edit", "Editieren", + "", + "", + "", + "", + "Éditer", + "", + "Muokkaa", }, { "Button$Rename", "Umbenennen", + "", + "", + "", + "", + "Renommer", + "", + "Nimeä", }, { "Button$Move", "Verschieben", + "", + "", + "", + "", + "Déplacer", + "", + "Siirrä", }, { "Button$Delete", "Löschen", + "", + "", + "", + "", + "Effacer", + "", + "Poista", }, { "Button$Info", "Info", + "", + "", + "", + "", + "Info", + "", + "Tiedot", }, { "New folder", "Neues Verzeichnis", + "", + "", + "", + "", + "Nouveau dossier", + "", + "Uusi kansio", }, { "Rename recording", "Aufzeichnung umbenennen", + "", + "", + "", + "", + "Renommer l'enregistrement", + "", + "Nimeä tallenne", }, { "Show recording date", "Zeige Aufnahmedatum", + "", + "", + "", + "", + "Afiicher la date d'enregistrement", + "", + "Näytä tallenteen päiväys", }, { "Show recording time", "Zeige Aufnahmezeit", + "", + "", + "", + "", + "Afficher l'heure d'enregistrement", + "", + "Näytä tallenteen ajankohta", }, { "Show recording length", "Zeige Aufnahmelänge", + "", + "", + "", + "", + "Afficher la longeur de l'enregistrement", + "", + "Näytä tallenteen kesto", }, { "Hide main menu entry", "Hauptmenüeintrag ausblenden", + "", + "", + "", + "", + "Menu Enregistrement étandu invisible", + "", + "Piilota valinta päävalikosta", }, { "Replace original recordings menu", "Originales Aufzeichnungsmenü ersetzen", + "", + "", + "", + "", + "Remplacer le nenu original Enregistrement", + "", + "Korvaa alkuperäinen 'Tallenteet'-valikko", + }, + { "Show alternative new marker", + "Alternativen Neu-Marker anzeigen", + "", + "", + "", + "", + "Afficher les nouveaux symbole", + "", + "Näytä vaihtoehtoinen uuden tallenteen merkintä", + }, + { "Show alternative dvd marker", + "Alternativen DVD-Marker anzeigen", + "", + "", + "", + "", + "Afficher les symbole DVD", + "", + "Näytä vaihtoehtoinen DVD:n merkintä", + }, + { "Please insert DVD %s", + "Bitte DVD %s einlegen", + "", + "", + "", + "", + "Mettez le DVD %s dans le lecteur", + "", + "Laita DVD %s asemaan", + }, + { "Error while mounting DVD!", + "Fehler beim Einhängen der DVD!", + "", + "", + "", + "", + "Erreur lors du montage du DVD!", + "", + "DVD:n avaaminen epäonnistui!", + }, + { "Recording not found on DVD!", + "Aufzeichnung auf DVD nicht gefunden!", + "", + "", + "", + "", + "Il n'y a pas d'enregistrement sur le DVD!", + "", + "Tallennetta ei löydy DVD:ltä!", + }, + { "Show dvd number", + "DVD-Nummer anzeigen", + "", + "", + "", + "", + "Afficher le numéro des DVD", + "", + "Näytä DVD:n numero", + }, + { "Script 'dvdarchive.sh' not found!", + "Skript 'dvdarchive.sh' wurde nicht gefunden!", + "", + "", + "", + "", + "", + "", + "", + }, + { "[base dir]", + "[Stammverzeichnis]", + "", + "", + "", + "", + "", + "", + "", }, { NULL } }; diff --git a/mymenumoverecording.c b/mymenumoverecording.c index 5f41b61..c4abe69 100644 --- a/mymenumoverecording.c +++ b/mymenumoverecording.c @@ -5,7 +5,9 @@ #include <vdr/videodir.h> #include <vdr/menu.h> +#include <vdr/remote.h> #include "mymenurecordings.h" +#include "tools.h" bool clearall; char newname[128]; @@ -24,19 +26,22 @@ 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==osUnknown) + if(state==osContinue) { if(Key==kOk) { strn0cpy(newname,name,sizeof(newname)); state=osBack; } + if(Key==kBack) + state=osBack; } return state; @@ -49,34 +54,31 @@ class myMenuMoveRecordingItem:public cOsdItem 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(Level<level) { -/* - s=Recording->Name(); - while(Level) - { - s=strchr(Recording->Name(),'~')+1; - Level--; - } - title=strdup(s); - char *p=strchr(title,'~'); - if(p) - *p=0; - SetText(title); -*/ s=Recording->Name(); const char *p=s; while(*++s) @@ -106,7 +108,7 @@ myMenuMoveRecording::myMenuMoveRecording(cRecording *Recording,myMenuRecordings base=Base?strdup(Base):NULL; level=Level; Set(); - SetHelp(tr("Button$Cancel"),NULL,tr("Button$Create"),tr("Button$Select")); + SetHelp(tr("Button$Cancel"),NULL,tr("Button$Create"),tr("Button$Move")); } myMenuMoveRecording::~myMenuMoveRecording() @@ -116,17 +118,33 @@ myMenuMoveRecording::~myMenuMoveRecording() 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()&&(!lastitemtext||strcmp(lastitemtext,item->Text()))) + if(*item->Text()) { - Add(item); - free(lastitemtext); - lastitemtext=strdup(item->Text()); + 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 + { + Add(item); // different text means a new item to add + lastitem=item; + free(lastitemtext); + lastitemtext=strdup(lastitem->Text()); + } } else delete item; @@ -137,21 +155,10 @@ void myMenuMoveRecording::Set() eOSState myMenuMoveRecording::Open() { - if(newname[0]!=0) - { - const char *t; - char buffer[MaxFileName]; - if(base) - snprintf(buffer,sizeof(buffer),"%s~%s",base,newname); - else - snprintf(buffer,sizeof(buffer),"%s",newname); - t=buffer; - return AddSubMenu(new myMenuMoveRecording(recording,menurecordings,t,level+1)); - } - else + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); + if(item) { - myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); - if(item) + if(item->Level()>level) { const char *t=item->Text(); char buffer[MaxFileName]; @@ -168,48 +175,61 @@ eOSState myMenuMoveRecording::Open() eOSState myMenuMoveRecording::MoveRec() { - char *name; + char *dir=NULL,*p=NULL,*name,*newfilename; + eOSState state=osContinue; - char *p=strrchr(recording->Name(),'~'); - if(p) + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); + if(item) { - if(base) - asprintf(&name,"%s~%s",base,++p); + + if(!strcmp(tr("[base dir]"),item->Text())) + dir=""; else - asprintf(&name,"%s",++p); + 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 { - if(base) - asprintf(&name,"%s~%s",base,recording->Name()); + p=strrchr(recording->Name(),'~'); + if(p) + asprintf(&name,"%s~%s",base,++p); else - asprintf(&name,"%s",recording->Name()); + asprintf(&name,"%s~%s",base,recording->Name()); + + asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); } - char *newfilename; - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(name,true),strrchr(recording->FileName(),'/')+1); - - int result=MakeDirs(newfilename,true); - if(result) + if(MoveVideoFile(recording,newfilename)) { - result=RenameVideoFile(recording->FileName(),newfilename); - if(result) - { - // update recordings list - Recordings.AddByName(newfilename); - Recordings.Del(recording,false); - // update menu - menurecordings->Set(true); - // close move-recordings-menu - clearall=true; - } - else - Skins.Message(mtError,tr("Error while accessing recording!")); + menurecordings->Set(true); + clearall=true; // close move recording menu + state=osBack; } else Skins.Message(mtError,tr("Error while accessing recording!")); - - return osContinue; + + if(dir!="") + free(dir); + free(name); + free(newfilename); + return state; } eOSState myMenuMoveRecording::Create() @@ -234,7 +254,11 @@ eOSState myMenuMoveRecording::ProcessKey(eKeys Key) } if(newname[0]!=0) - return Open(); + { + Add(new myMenuMoveRecordingItem(newname,level+2)); + Display(); + strn0cpy(newname,"",sizeof(newname)); + } if(clearall) return osBack; diff --git a/mymenumoverecording.h b/mymenumoverecording.h new file mode 100644 index 0000000..bc7b389 --- /dev/null +++ b/mymenumoverecording.h @@ -0,0 +1,75 @@ +extern bool clearall; // needed for myMenuMoveRecording + +// --- myMenuRecordingsItem --------------------------------------------------- +class myMenuRecordingsItem:public cOsdItem +{ + private: + int level,isdirectory; + int totalentries,newentries; + char *title; + char *name; + const char *filename; + public: + myMenuRecordingsItem(cRecording *Recording,int Level); + ~myMenuRecordingsItem(); + const char *FileName(){return filename;} + const char *Name(){return name;} + bool IsDirectory(){return name!=NULL;} + void IncrementCounter(bool IsNew); +}; + +// --- myMenuRecordings ------------------------------------------------------- +class myMenuRecordings:public cOsdMenu +{ + private: + bool edit; + int level,helpkeys; + int recordingsstate; + char *base; + bool Open(); + void SetHelpKeys(); + cRecording *GetRecording(myMenuRecordingsItem *Item); + eOSState Play(); + eOSState Rewind(); + eOSState Delete(); + eOSState Rename(); + eOSState MoveRec(); + eOSState Info(); + eOSState Commands(eKeys Key=kNone); + public: + myMenuRecordings(const char *Base=NULL,int Level=0); + ~myMenuRecordings(); + void Set(bool Refresh=false); + virtual eOSState ProcessKey(eKeys Key); +}; + +// --- myMenuRenameRecording -------------------------------------------------- +class myMenuRenameRecording:public cOsdMenu +{ + private: + char name[MaxFileName]; + char path[MaxFileName]; + cRecording *recording; + myMenuRecordings *menurecordings; + public: + myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings); + virtual eOSState ProcessKey(eKeys Key); +}; + +// --- myMenuMoveRecording ---------------------------------------------------- +class myMenuMoveRecording:public cOsdMenu +{ + private: + int level; + char *base; + cRecording *recording; + myMenuRecordings *menurecordings; + void Set(); + eOSState Open(); + eOSState MoveRec(); + eOSState Create(); + public: + myMenuMoveRecording(cRecording *Recording,myMenuRecordings *MenuRecordings,const char *Base=NULL,int Level=0); + myMenuMoveRecording::~myMenuMoveRecording(); + virtual eOSState ProcessKey(eKeys Key); +}; diff --git a/mymenurecordings.c b/mymenurecordings.c index d39867c..20cef70 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -9,14 +9,18 @@ #include "mymenurecordings.h" #include "mymenusetup.h" #include "mymenucommands.h" +#include "patchfont.h" // --- myMenuRecordingsItem --------------------------------------------------- myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) { totalentries=newentries=0; - - char isnew=Recording->IsNew()?'*':' '; + isdvd=false; name=NULL; + id=NULL; + + strn0cpy(dvdnr,"",sizeof(dvdnr)); + bool isnew=Recording->IsNew(); filename=Recording->FileName(); // get the level of this recording @@ -31,21 +35,6 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) // create the title of this item if(Level<level) // directory entries { -/* - s=Recording->Name(); - printf("%s\n",s); - - while(Level) - { - s=strchr(Recording->Name(),'~')+1; - Level--; - } - - asprintf(&title,"\t\t%s",s); - char *p=strchr(title,'~'); - if(p) - *p=0; -*/ s=Recording->Name(); const char *p=s; while(*++s) @@ -71,18 +60,19 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) s=strrchr(Recording->Name(),'~'); // date and time of recording - struct tm t; - localtime_r(&Recording->start,&t); + struct tm tm_r; + struct tm *t=localtime_r(&Recording->start,&tm_r); - // recording length struct tIndex{int offset;uchar type;uchar number;short reserved;}; char RecLength[21],RecDate[9],RecTime[6],RecDelimiter[2]={'\t',0}; int last=-1; char *indexfilename; + // recording length asprintf(&indexfilename,"%s/index.vdr",filename); int delta=0; - if(!access(indexfilename,R_OK)) + int hasindex=!access(indexfilename,R_OK); + if(hasindex) { struct stat buf; if(!stat(indexfilename,&buf)) @@ -99,18 +89,44 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) } } free(indexfilename); + + // dvdarchive-patch functionality + asprintf(&indexfilename,"%s/dvd.vdr",filename); + isdvd=!access(indexfilename,R_OK); + if(isdvd) + { + FILE *f; + if((f=fopen(indexfilename,"r"))!=NULL) + { + if(fgets(dvdnr,sizeof(dvdnr),f)) + { + char *p=strchr(dvdnr,'\n'); + if(p) + *p=0; + } + fclose(f); + } + } + free(indexfilename); - 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%c%s", - (mysetup.ShowRecDate?RecDate:""), - (mysetup.ShowRecDate?RecDelimiter:""), - (mysetup.ShowRecTime?RecTime:""), - (mysetup.ShowRecTime?RecDelimiter:""), - (mysetup.ShowRecLength?RecLength:""), - (mysetup.ShowRecLength?RecDelimiter:""), - isnew, - s?s+1:Recording->Name()); + char New[2]={(mysetup.PatchNew?char(250):'*'),0}; + char Dvd[2]={(mysetup.PatchDvd?char(251):'~'),0}; + + 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 + ((hasindex&&mysetup.ShowRecLength)?RecLength:""), // show recording length? + (mysetup.ShowRecLength?RecDelimiter:""), // tab + (isdvd?Dvd:(isnew?New:"")), // 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()); } else if(Level>level) // any other @@ -141,17 +157,28 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) // --- myMenuRecordings ------------------------------------------------------- myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Base:tr("Extended recordings menu")) { + // patch font + if(Level==0&&(mysetup.PatchNew||mysetup.PatchDvd)) + { + if(Setup.UseSmallFont==2) + PatchFont(fontSml); + else + PatchFont(fontOsd); + } // set tabs - if(mysetup.ShowRecDate&&mysetup.ShowRecTime) // all details are shown - SetCols(8,6,4); + if(mysetup.ShowRecDate&&mysetup.ShowRecTime&&!mysetup.ShowRecLength) // recording date and time are shown, recording length not + SetCols(8,6); else - if(mysetup.ShowRecDate&&!mysetup.ShowRecTime) // recording time is not shown - SetCols(8,4); + if(mysetup.ShowRecDate&&mysetup.ShowRecTime) // all details are shown + SetCols(8,6,4); else - if(!mysetup.ShowRecDate&&mysetup.ShowRecTime&&mysetup.ShowRecLength) // recording date is not shown - SetCols(6,4); - else // recording date and time are not shown; even if recording length should be not shown we must set two tabs because the details of the directories - SetCols(4,4); + if(mysetup.ShowRecDate&&!mysetup.ShowRecTime) // recording time is not shown + SetCols(8,4); + else + if(!mysetup.ShowRecDate&&mysetup.ShowRecTime&&mysetup.ShowRecLength) // recording date is not shown + SetCols(6,4); + else // recording date and time are not shown; even if recording length should be not shown we must set two tabs because the details of the directories + SetCols(4,3); edit=false; level=Level; @@ -166,7 +193,16 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas SetCurrent(First()); else if(myReplayControl::LastReplayed()) + { + if(mysetup.wasdvd) + { + char *cmd; + asprintf(&cmd,"dvdarchive.sh umount '%s'",myReplayControl::LastReplayed()); + SystemExec(cmd); + free(cmd); + } Open(); + } Display(); SetHelpKeys(); @@ -175,6 +211,14 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas myMenuRecordings::~myMenuRecordings() { free(base); + + if(level==0&&(mysetup.PatchNew||mysetup.PatchDvd)) + { + if(Setup.UseSmallFont==2) + cFont::SetFont(fontSml); + else + cFont::SetFont(fontOsd); + } } void myMenuRecordings::SetHelpKeys() @@ -267,16 +311,16 @@ void myMenuRecordings::Set(bool Refresh) if(!base||(strstr(recording->Name(),base)==recording->Name()&&recording->Name()[strlen(base)]=='~')) { myMenuRecordingsItem *item=new myMenuRecordingsItem(recording,level); - if(*item->Text()&&(!lastitem||strcmp(lastitemtext,item->Text()))) + if(item->ID()&&(!lastitem||strcmp(lastitemtext,item->ID()))) { if(!item->IsDirectory()) { Add(item); inlist=true; - } + } lastitem=item; free(lastitemtext); - lastitemtext=strdup(lastitem->Text()); + lastitemtext=strdup(lastitem->ID()); } else delete item; @@ -336,6 +380,11 @@ bool myMenuRecordings::Open() // plays a recording eOSState myMenuRecordings::Play() { + char *msg=NULL; + char *name=NULL; + + char path[MaxFileName]; + myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); if(item) { @@ -346,6 +395,36 @@ eOSState myMenuRecordings::Play() cRecording *recording=GetRecording(item); if(recording) { + 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'",path,name); // call the dvdarchive.sh script + + int result=SystemExec(msg); + free(msg); + if(result) + { + if(result==256) + Skins.Message(mtError,tr("Error while mounting DVD!")); + if(result==512) + Skins.Message(mtError,tr("Recording not found on DVD!")); + if(result==32512) + Skins.Message(mtError,tr("Script 'dvdarchive.sh' not found!")); + return osContinue; + } + mysetup.wasdvd=true; + } + else + { + free(msg); + return osContinue; + } + } myReplayControl::SetRecording(recording->FileName(),recording->Title()); cControl::Shutdown(); // stop running playbacks cControl::Launch(new myReplayControl); // start playback @@ -527,6 +606,7 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) } else { + bool hadsubmenu=HasSubMenu(); state=cOsdMenu::ProcessKey(Key); if(state==osUnknown) { @@ -549,8 +629,10 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) default: break; } } - if(Recordings.StateChanged(recordingsstate)) + // 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/mymenurecordings.h b/mymenurecordings.h index bc7b389..795c48c 100644 --- a/mymenurecordings.h +++ b/mymenurecordings.h @@ -4,11 +4,14 @@ extern bool clearall; // needed for myMenuMoveRecording class myMenuRecordingsItem:public cOsdItem { private: + bool isdvd; + char dvdnr[BUFSIZ]; int level,isdirectory; int totalentries,newentries; char *title; char *name; const char *filename; + char *id; // this is the unique name that identifies a recording public: myMenuRecordingsItem(cRecording *Recording,int Level); ~myMenuRecordingsItem(); @@ -16,6 +19,9 @@ class myMenuRecordingsItem:public cOsdItem const char *Name(){return name;} bool IsDirectory(){return name!=NULL;} void IncrementCounter(bool IsNew); + bool IsDVD(){return isdvd;} + char *DvdNr(){return dvdnr;} + const char *ID(){return id;} }; // --- myMenuRecordings ------------------------------------------------------- diff --git a/mymenurenamerecording.c b/mymenurenamerecording.c index 0c36a01..5259f3d 100644 --- a/mymenurenamerecording.c +++ b/mymenurenamerecording.c @@ -5,7 +5,9 @@ #include <vdr/videodir.h> #include <vdr/menu.h> +#include <vdr/remote.h> #include "mymenurecordings.h" +#include "tools.h" myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Rename recording"),12) { @@ -28,44 +30,30 @@ myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordi 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==osUnknown) + if(state==osContinue) { if(Key==kOk) { - int result; char *buffer; - char *newFileName; + 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); - - result=MakeDirs(newFileName,true); - if(result) + asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); + + if(MoveVideoFile(recording,newfilename)) { - result=RenameVideoFile(recording->FileName(),newFileName); - if(result) - { - // update recordings list - Recordings.AddByName(newFileName); - Recordings.Del(recording); - // update menu - menurecordings->Set(true); - return osBack; - } - else - { - Skins.Message(mtError,tr("Error while accessing recording!")); - state=osContinue; - } + menurecordings->Set(true); + state=osBack; } else { @@ -73,8 +61,10 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) state=osContinue; } free(buffer); - free(newFileName); + free(newfilename); } + if(Key==kBack) + return osBack; } return state; } diff --git a/mymenusetup.c b/mymenusetup.c index 5803e40..0d038ed 100644 --- a/mymenusetup.c +++ b/mymenusetup.c @@ -5,21 +5,30 @@ mySetup mysetup; myMenuSetup::myMenuSetup() { hidemainmenuentry=mysetup.HideMainMenuEntry; + patchnew=mysetup.PatchNew; + patchdvd=mysetup.PatchDvd; replaceorgrecmenu=mysetup.ReplaceOrgRecMenu; showrecdate=mysetup.ShowRecDate; showrectime=mysetup.ShowRecTime; showreclength=mysetup.ShowRecLength; + showdvdnr=mysetup.ShowDvdNr; - Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&hidemainmenuentry)); - Add(new cMenuEditBoolItem(tr("Replace original recordings menu"),&replaceorgrecmenu)); Add(new cMenuEditBoolItem(tr("Show recording date"),&showrecdate)); Add(new cMenuEditBoolItem(tr("Show recording time"),&showrectime)); Add(new cMenuEditBoolItem(tr("Show recording length"),&showreclength)); + Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&hidemainmenuentry)); + Add(new cMenuEditBoolItem(tr("Replace original recordings menu"),&replaceorgrecmenu)); + Add(new cMenuEditBoolItem(tr("Show alternative new marker"),&patchnew)); + Add(new cMenuEditBoolItem(tr("Show alternative dvd marker"),&patchdvd)); + Add(new cMenuEditBoolItem(tr("Show dvd number"),&showdvdnr)); } void myMenuSetup::Store() { SetupStore("HideMainMenuEntry",mysetup.HideMainMenuEntry=hidemainmenuentry); + SetupStore("PatchNew",mysetup.PatchNew=patchnew); + SetupStore("PatchDvd",mysetup.PatchDvd=patchdvd); + SetupStore("ShowDvdNr",mysetup.ShowDvdNr=showdvdnr); SetupStore("ReplaceOrgRecMenu",mysetup.ReplaceOrgRecMenu=replaceorgrecmenu); SetupStore("ShowRecDate",mysetup.ShowRecDate=showrecdate); SetupStore("ShowRecTime",mysetup.ShowRecTime=showrectime); diff --git a/mymenusetup.h b/mymenusetup.h index 3a70a1d..138df76 100644 --- a/mymenusetup.h +++ b/mymenusetup.h @@ -8,6 +8,10 @@ class mySetup int ShowRecLength; int HideMainMenuEntry; int ReplaceOrgRecMenu; + int PatchNew; + int PatchDvd; + int ShowDvdNr; + bool wasdvd; // needed for dvdarchive-patch functionality }; extern mySetup mysetup; @@ -20,6 +24,9 @@ class myMenuSetup:public cMenuSetupPage int showreclength; int hidemainmenuentry; int replaceorgrecmenu; + int patchnew; + int patchdvd; + int showdvdnr; protected: virtual void Store(); public: diff --git a/patchfont.c b/patchfont.c new file mode 100644 index 0000000..320e036 --- /dev/null +++ b/patchfont.c @@ -0,0 +1,163 @@ +/* + * See the README file for copyright information and how to reach the author. + */ + +#include <vdr/font.h> +#include "patchfont.h" +#include "mymenusetup.h" + +void PatchFont(eDvbFont DvbFont) +{ + const cFont *font = cFont::GetFont(DvbFont); + int num_rows_global = font->Height(); + int num_rows = num_rows_global+2; + int i,j,num_char; + + cFont::tPixelData* font_data = new cFont::tPixelData[225*(num_rows)]; + + for (i = 0; i < 225; i++) + for (j = 0; j < num_rows; j++) + font_data[(i*num_rows)+j]=0x0000000000000000; + + font_data[0+0]=6;//font->CharData(0)->width; + font_data[0+1]=num_rows_global; + + for(num_char=33, i = 1; num_char<256; i++, num_char++) + { + const cFont::tCharData* char_data = font->CharData(num_char); + font_data[i*num_rows+0] = (num_char>=127 && num_char<=129)?6:char_data->width; + font_data[i*num_rows+1] = char_data->height; + + // new marker + if(num_char==250&&mysetup.PatchNew) + { + if(DvbFont==fontOsd) + { + font_data[i*num_rows+ 0]=16; + font_data[i*num_rows+ 1]=27; + font_data[i*num_rows+ 2]=0; // ................ + font_data[i*num_rows+ 3]=0xc600; // ##...##......... + font_data[i*num_rows+ 4]=0xe600; // ###..##......... + font_data[i*num_rows+ 5]=0xf600; // ####.##......... + font_data[i*num_rows+ 6]=0xf600; // ####.##......... + font_data[i*num_rows+ 7]=0xde00; // ##.####......... + font_data[i*num_rows+ 8]=0xde00; // ##.####......... + font_data[i*num_rows+ 9]=0xce00; // ##..###......... + font_data[i*num_rows+10]=0xc600; // ##...##......... + font_data[i*num_rows+11]=0x0; // ................ + font_data[i*num_rows+12]=0x1fc0; // ...#######...... + font_data[i*num_rows+13]=0x1fc0; // ...#######...... + font_data[i*num_rows+14]=0x1800; // ...##........... + font_data[i*num_rows+15]=0x1f00; // ...#####........ + font_data[i*num_rows+16]=0x1f00; // ...#####........ + font_data[i*num_rows+17]=0x1800; // ...##........... + font_data[i*num_rows+18]=0x1fc0; // ...#######...... + font_data[i*num_rows+19]=0x1fc0; // ...#######...... + font_data[i*num_rows+20]=0x0; // ................ + font_data[i*num_rows+21]=0x318; // ......##...##... + font_data[i*num_rows+22]=0x318; // ......##...##... + font_data[i*num_rows+23]=0x318; // ......##...##... + font_data[i*num_rows+24]=0x318; // ......##...##... + font_data[i*num_rows+25]=0x318; // ......##...##... + font_data[i*num_rows+26]=0x318; // ......##...##... + font_data[i*num_rows+27]=0x3f8; // ......#######... + font_data[i*num_rows+28]=0x1f0; // .......#####.... + } + else + { + font_data[i*num_rows+ 0]=16; + font_data[i*num_rows+ 1]=22; + font_data[i*num_rows+ 2]=0x0; // ................ + font_data[i*num_rows+ 3]=0xc600; // ##...##......... + font_data[i*num_rows+ 4]=0xe600; // ###..##......... + font_data[i*num_rows+ 5]=0xf600; // ####.##......... + font_data[i*num_rows+ 6]=0xde00; // ##.####......... + font_data[i*num_rows+ 7]=0xce00; // ##..###......... + font_data[i*num_rows+ 8]=0xc600; // ##...##......... + font_data[i*num_rows+ 9]=0x0; // ................ + font_data[i*num_rows+10]=0x1fc0; // ...#######...... + font_data[i*num_rows+11]=0x1fc0; // ...#######...... + font_data[i*num_rows+12]=0x1800; // ...##........... + font_data[i*num_rows+13]=0x1f00; // ...#####........ + font_data[i*num_rows+14]=0x1800; // ...##........... + font_data[i*num_rows+15]=0x1fc0; // ...#######...... + font_data[i*num_rows+16]=0x1fc0; // ...#######...... + font_data[i*num_rows+17]=0x0; // ................ + font_data[i*num_rows+18]=0x318; // ......##...##... + font_data[i*num_rows+19]=0x318; // ......##...##... + font_data[i*num_rows+20]=0x318; // ......##...##... + font_data[i*num_rows+21]=0x318; // ......##...##... + font_data[i*num_rows+22]=0x3f8; // ......#######... + font_data[i*num_rows+23]=0x1f0; // .......#####.... + } + } + // dvd marker + else if(num_char==251&&mysetup.PatchDvd) + { + if(DvbFont==fontOsd) + { + font_data[i*num_rows+ 0]=22; + font_data[i*num_rows+ 1]=27; + font_data[i*num_rows+ 5]=0x0; // .. .... .... .... .... .... + font_data[i*num_rows+ 6]=0x003f00; // .. .... ..## #### .... .... + font_data[i*num_rows+ 7]=0x01ffe0; // .. ...# #### #### ###. .... + font_data[i*num_rows+ 8]=0x03ff90; // .. ..## #### #### #..# .... + font_data[i*num_rows+ 9]=0x07ff08; // .. .### #### #### .... #... + font_data[i*num_rows+10]=0x0fff04; // .. #### #### #### .... .#.. + font_data[i*num_rows+11]=0x0ffe04; // .. #### #### ###. .... .#.. + font_data[i*num_rows+12]=0x0ffe0c; // .. #### #### ###. .... ##.. + font_data[i*num_rows+13]=0x1ffc3e; // .# #### #### ##.. ..## ###. + font_data[i*num_rows+14]=0x1ff2fe; // .# #### #### ..#. #### ###. + font_data[i*num_rows+15]=0x1fe1fe; // .# #### ###. ...# #### ###. + font_data[i*num_rows+16]=0x1fe1fe; // .# #### ###. ...# #### ###. + font_data[i*num_rows+17]=0x1fd3fe; // .# #### ##.# ..## #### ###. + font_data[i*num_rows+18]=0x1f0ffe; // .# #### .... #### #### ###. + font_data[i*num_rows+19]=0x0c1ffc; // .. ##.. ...# #### #### ##.. + font_data[i*num_rows+20]=0x081ffc; // .. #... ...# #### #### ##.. + font_data[i*num_rows+21]=0x083ffc; // .. #... ..## #### #### ##.. + font_data[i*num_rows+22]=0x043ff8; // .. .#.. ..## #### #### #... + font_data[i*num_rows+23]=0x027ff0; // .. ..#. .### #### #### .... + font_data[i*num_rows+24]=0x01ffe0; // .. ...# #### #### ###. .... + font_data[i*num_rows+25]=0x003f00; // .. .... ..## #### .... .... + font_data[i*num_rows+26]=0x000000; // .. .... .... .... .... .... + } + else + { + font_data[i*num_rows+ 0]=22; + font_data[i*num_rows+ 1]=22; + font_data[i*num_rows+ 2]=0x0; // .. .... .... .... .... .... + font_data[i*num_rows+ 3]=0x003f00; // .. .... ..## #### .... .... + font_data[i*num_rows+ 4]=0x01ffe0; // .. ...# #### #### ###. .... + font_data[i*num_rows+ 5]=0x03ff90; // .. ..## #### #### #..# .... + font_data[i*num_rows+ 6]=0x07ff08; // .. .### #### #### .... #... + font_data[i*num_rows+ 7]=0x0fff04; // .. #### #### #### .... .#.. + font_data[i*num_rows+ 8]=0x0ffe04; // .. #### #### ###. .... .#.. + font_data[i*num_rows+ 9]=0x0ffe0c; // .. #### #### ###. .... ##.. + font_data[i*num_rows+10]=0x1ffc3e; // .# #### #### ##.. ..## ###. + font_data[i*num_rows+11]=0x1ff2fe; // .# #### #### ..#. #### ###. + font_data[i*num_rows+12]=0x1fe1fe; // .# #### ###. ...# #### ###. + font_data[i*num_rows+13]=0x1fe1fe; // .# #### ###. ...# #### ###. + font_data[i*num_rows+14]=0x1fd3fe; // .# #### ##.# ..## #### ###. + font_data[i*num_rows+15]=0x1f0ffe; // .# #### .... #### #### ###. + font_data[i*num_rows+16]=0x0c1ffc; // .. ##.. ...# #### #### ##.. + font_data[i*num_rows+17]=0x081ffc; // .. #... ...# #### #### ##.. + font_data[i*num_rows+18]=0x083ffc; // .. #... ..## #### #### ##.. + font_data[i*num_rows+19]=0x043ff8; // .. .#.. ..## #### #### #... + font_data[i*num_rows+20]=0x027ff0; // .. ..#. .### #### #### .... + font_data[i*num_rows+21]=0x01ffe0; // .. ...# #### #### ###. .... + font_data[i*num_rows+22]=0x003f00; // .. .... ..## #### .... .... + font_data[i*num_rows+23]=0x000000; // .. .... .... .... .... .... + } + } + else + { + for(j = 0; j<(int)char_data->height; j++) + { + cFont::tPixelData Data = (cFont::tPixelData)char_data->lines[j]; + + font_data[(i*num_rows)+2+j] = Data; + } + } + } + cFont::SetFont(DvbFont, font_data); +} diff --git a/patchfont.h b/patchfont.h new file mode 100644 index 0000000..b4f712e --- /dev/null +++ b/patchfont.h @@ -0,0 +1 @@ +void PatchFont(eDvbFont DvbFont); diff --git a/scripts/dvdarchive.sh b/scripts/dvdarchive.sh new file mode 100755 index 0000000..70770ce --- /dev/null +++ b/scripts/dvdarchive.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +MOUNTCMD="/usr/bin/sudo /bin/mount" +UMOUNTCMD="/usr/bin/sudo /bin/umount" +MOUNTPOINT="/media/cdrom" # no trailing '/'! + +PATH="$2" +NAME="$3" + +case "$1" in +mount) + # mount dvd + $MOUNTCMD "$MOUNTPOINT" + if [ $? -eq 0 ] + then + DIR="$(/usr/bin/find "${MOUNTPOINT}/" -name "$NAME")" + # link vdr files + /bin/cp -s "${DIR}/index.vdr" "${PATH}/" + /bin/cp -s "${DIR}/"???.vdr "${PATH}/" + if [ $? -ne 0 ] + then + $UMOUNTCMD "$MOUNTPOINT" + # unlink broken links + for LINK in "${PATH}/"*.vdr; do + if [ -L "$LINK" -a ! -s "$LINK" ]; then + /bin/rm "$LINK" + fi + done + exit 2 + fi + else + exit 1 + fi + ;; +umount) + $MOUNTCMD | /bin/grep "$MOUNTPOINT" > /dev/null + if [ $? -eq 0 ] + then + # umount dvd + $UMOUNTCMD "$MOUNTPOINT" + # unlink broken links + for LINK in "${PATH}/"*.vdr; do + if [ -L "$LINK" -a ! -s "$LINK" ]; then + /bin/rm "$LINK" + fi + done + fi + ;; +esac diff --git a/scripts/dvdarchive.sh.old b/scripts/dvdarchive.sh.old new file mode 100755 index 0000000..ffe1737 --- /dev/null +++ b/scripts/dvdarchive.sh.old @@ -0,0 +1,37 @@ +#!/bin/sh + +#MOUNTCMD="/bin/mount" +MOUNTCMD="/usr/bin/sudo mount" +#UMOUNTCMD="/bin/umount" +UMOUNTCMD="/usr/bin/sudo umount" +MOUNTPOINT="/media/cdrom/" # trailing '/' is important! (for find command) +PATH=$2 +NAME=$3 + +case "$1" in +mount) + # mount dvd + $MOUNTCMD $MOUNTPOINT + if [ $? -eq 0 ] + then + DIR=$(/usr/bin/find $MOUNTPOINT -name $NAME) + # bind recording dir on dvd to recording dir in /video + $MOUNTCMD --bind $DIR $PATH + if [ $? -ne 0 ] + then + $UMOUNTCMD $MOUNTPOINT + exit 2 + fi + else + exit 1 + fi + ;; +umount) + $MOUNTCMD | /bin/grep $PATH > /dev/null + if [ $? -eq 0 ] + then + $UMOUNTCMD $PATH + $UMOUNTCMD $MOUNTPOINT + fi + ;; +esac @@ -0,0 +1,23 @@ +#include <vdr/videodir.h> +#include <vdr/recording.h> +#include "tools.h" + +bool MoveVideoFile(cRecording *Recording,char *NewName) +{ + if(!strcmp(Recording->FileName(),NewName)) + return true; + + 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; + } + } + return false; +} @@ -0,0 +1 @@ +bool MoveVideoFile(cRecording *Recording,char *NewName); |