diff options
-rw-r--r-- | HISTORY | 9 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | README | 81 | ||||
-rw-r--r-- | extrecmenu.c | 50 | ||||
-rw-r--r-- | extrecmenu.h | 29 | ||||
-rw-r--r-- | i18n.c | 164 | ||||
-rw-r--r-- | mymenucommands.c | 2 | ||||
-rw-r--r-- | mymenueditrecording.c | 33 | ||||
-rw-r--r-- | mymenurecordings.c | 272 | ||||
-rw-r--r-- | mymenurecordings.h | 5 | ||||
-rw-r--r-- | mymenusetup.c | 13 | ||||
-rw-r--r-- | mymenusetup.h | 2 | ||||
-rw-r--r-- | patchfont.c | 70 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh | 32 | ||||
-rw-r--r-- | tools.c | 92 | ||||
-rw-r--r-- | tools.h | 31 |
16 files changed, 543 insertions, 352 deletions
@@ -1,6 +1,15 @@ VDR Plugin 'extrecmenu' Revision History ---------------------------------------- +2006-11-06: Version 0.12 +- reworked layout +- added possibility to set sorting mode for each directory +- if you use the PIN-plugin, ExtRecMenu works together with it to protect + recordings +- fixed a very annoying bug which prevent renaming and moving recordings which + have special chars in their names if VDR is compiled with VFAT=1 or startet + with the option --vfat + 2006-28-05: Version 0.11 - added czech translation; thanks to Vladimír Bárta - added missing dialog for video dvds @@ -1,7 +1,9 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id$ + +# uncomment if you use the pin-plugin and want to protect your recordings +#WITHPINPLUGIN=1 # The official name of this plugin. # This name will be used in the '-P...' option of VDR to load the plugin. @@ -11,7 +13,7 @@ PLUGIN = extrecmenu ### The version number of this plugin (taken from the main source file): -VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).h | awk '{ print $$6 }' | sed -e 's/[";]//g') +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g') ### The C++ compiler and options: @@ -43,6 +45,10 @@ INCLUDES += -I$(VDRDIR)/include DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +ifdef WITHPINPLUGIN + DEFINES+=-DWITHPINPLUGIN +endif + ### The object files (add further files here): OBJS = $(PLUGIN).o mymenurecordings.o myreplaycontrol.o i18n.o \ @@ -1,19 +1,49 @@ This is a "plugin" for the Video Disk Recorder (VDR). - 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 Mike -Constabel (vejoun@toppoint.de). +copyright information. + +I want to thank to following contributors: +- Mike Constabel for the skript dvdarchive.sh +- Rolf Ahrenberg for the finnish translation +- Patrice Staudt for the frensh translation +- Vladimír Bárta for the czech translation +------------------------------------------------------------------------------- Description ------------------------------------------------------------------------------- This plugin provides a recordings menu enhanced with the possibility to 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). +and length is configurable. Sorting by name or date is selectable for each +directory. If you use the PIN-plugin, the replay and editing of recordings is +protected. The plugin also handles archive dvds of VDR recordings (as known +from the DVDArchive-patch for VDR). This plugin extends VDR's '-r'-option with +messages for deleting, moving and renaming a recording. + +------------------------------------------------------------------------------- +Installation +------------------------------------------------------------------------------- +Installation of the plugin itselfs is like any other plugin installation. Check +the Makefile if you use the PIN-plugin. You have to place the script +'dvdarchive.sh' from the 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 take. + +Check the options at the setup menu of the plugin. They are self-explaining. + +There is a patch for VDR in contrib/ for replacing VDR's recordings menu with +this plugin. You have to set the corresponding option at the setup menu of the +plugin! + +There ist a patched TTF-Font for Enigma containing the dvd and alternative new +symbols. See this post at vdr-portal.de: +http://www.vdr-portal.de/board/thread.php?postid=447376#post447376 + +------------------------------------------------------------------------------- +Handling +------------------------------------------------------------------------------- Editing ------------------------------------------------------------------------------- @@ -25,20 +55,16 @@ Moving: Press 'Yellow', then 'Green'. Now you are at the base directory of the 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. +edit the lifetime and priority of the selected recording. Editing the details +of archive dvd entries is not possible, because this would change the name by +which the recording is found on the disc. Sort recordings ------------------------------------------------------------------------------- -There are four options for sorting at the setup menu: -Sort recordings by: -- alphabet for main-, flexible for subdirectories -- date for main-, flexible for subdirectories -- alphabet for all directories -- date for all directories -Flexible means, if the directory name ends with "-",".","$" or "Ş", the -recordings in this directory are sorted by name, else by date. - +All directories are sorted by date by default. To change the sorting, simply +press '0'. +------------------------------------------------------------------------------- Archiv-DVD-functionality ------------------------------------------------------------------------------- Burn the entire directory, that contains the recording, to a dvd and label it @@ -64,29 +90,12 @@ 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 +The first column contains the dvd id, in the second column write 0000 (or +anything else, its only important that there is a second column). 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 +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 (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. - -There is a patch for VDR in contrib/ for replacing VDR's recordings menu with -this plugin. You have to set the corresponding option at the setup menu of the -plugin! - -There ist a patched TTF-Font for Enigma containing the dvd and alternative new -symbols. See this post at vdr-portal.de: -http://www.vdr-portal.de/board/thread.php?postid=447376#post447376 - ------------------------------------------------------------------------------- Do you like this plugin? Support the developer! Go to the project homepage and make a donation over the PayPal donation button. diff --git a/extrecmenu.c b/extrecmenu.c index 9c83f6e..ec53d96 100644 --- a/extrecmenu.c +++ b/extrecmenu.c @@ -2,10 +2,41 @@ * See the README file for copyright information and how to reach the author. */ +#include <vdr/plugin.h> #include "mymenusetup.h" #include "mymenurecordings.h" -#include "extrecmenu.h" #include "i18n.h" +#include "tools.h" + +static const char *VERSION = "0.12"; +static const char *DESCRIPTION = "Extended recordings menu"; +static const char *MAINMENUENTRY = "ExtRecMenu"; + +SortList *mySortList; + +// --- cPluginExtrecmenu ------------------------------------------------------ +class cPluginExtrecmenu:public cPlugin +{ + private: + public: + cPluginExtrecmenu(void); + virtual ~cPluginExtrecmenu(); + virtual const char *Version(void){return VERSION;} + virtual const char *Description(void){return tr(DESCRIPTION);} + virtual const char *CommandLineHelp(void); + virtual bool ProcessArgs(int argc,char *argv[]); + virtual bool Initialize(void); + virtual bool Start(void); + virtual void Stop(void); + virtual void Housekeeping(void); + virtual const char *MainMenuEntry(void){return mysetup.HideMainMenuEntry?NULL:MAINMENUENTRY;} + virtual cOsdObject *MainMenuAction(void); + virtual cMenuSetupPage *SetupMenu(void); + virtual bool SetupParse(const char *Name,const char *Value); + virtual bool Service(const char *Id,void *Data = NULL); + virtual const char **SVDRPHelpPages(void); + virtual cString SVDRPCommand(const char *Command,const char *Option,int &ReplyCode); +}; cPluginExtrecmenu::cPluginExtrecmenu(void) { @@ -20,7 +51,7 @@ const char *cPluginExtrecmenu::CommandLineHelp(void) return NULL; } -bool cPluginExtrecmenu::ProcessArgs(int argc, char *argv[]) +bool cPluginExtrecmenu::ProcessArgs(int argc,char *argv[]) { return true; } @@ -34,11 +65,15 @@ bool cPluginExtrecmenu::Initialize(void) bool cPluginExtrecmenu::Start(void) { + mySortList=new SortList; + mySortList->ReadConfigFile(); + return true; } void cPluginExtrecmenu::Stop(void) { + delete mySortList; } void cPluginExtrecmenu::Housekeeping(void) @@ -55,7 +90,7 @@ cMenuSetupPage *cPluginExtrecmenu::SetupMenu(void) return new myMenuSetup(); } -bool cPluginExtrecmenu::SetupParse(const char *Name, const char *Value) +bool cPluginExtrecmenu::SetupParse(const char *Name,const char *Value) { if(!strcasecmp(Name,"IsOrgRecMenu")) return (mysetup.ReplaceOrgRecMenu==false); // vdr-replace patch @@ -84,14 +119,11 @@ bool cPluginExtrecmenu::SetupParse(const char *Name, const char *Value) if(!strcasecmp(Name,"ShowNewRecs")) mysetup.ShowNewRecs=atoi(Value); else - if(!strcasecmp(Name,"SortRecords")) - mysetup.SortRecords=atoi(Value); - else - return false; + return false; return true; } -bool cPluginExtrecmenu::Service(const char *Id, void *Data) +bool cPluginExtrecmenu::Service(const char *Id,void *Data) { return false; } @@ -101,7 +133,7 @@ const char **cPluginExtrecmenu::SVDRPHelpPages(void) return NULL; } -cString cPluginExtrecmenu::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode) +cString cPluginExtrecmenu::SVDRPCommand(const char *Command,const char *Option,int &ReplyCode) { return NULL; } diff --git a/extrecmenu.h b/extrecmenu.h deleted file mode 100644 index 662481c..0000000 --- a/extrecmenu.h +++ /dev/null @@ -1,29 +0,0 @@ -#include <vdr/plugin.h> - -static const char *VERSION = "0.11"; -static const char *DESCRIPTION = "Extended recordings menu"; -static const char *MAINMENUENTRY = "ExtRecMenu"; - -// --- cPluginExtrecmenu ------------------------------------------------------ -class cPluginExtrecmenu:public cPlugin -{ - private: - public: - cPluginExtrecmenu(void); - virtual ~cPluginExtrecmenu(); - virtual const char *Version(void){return VERSION;} - virtual const char *Description(void){return tr(DESCRIPTION);} - virtual const char *CommandLineHelp(void); - virtual bool ProcessArgs(int argc,char *argv[]); - virtual bool Initialize(void); - virtual bool Start(void); - virtual void Stop(void); - virtual void Housekeeping(void); - virtual const char *MainMenuEntry(void){return mysetup.HideMainMenuEntry?NULL:MAINMENUENTRY;} - virtual cOsdObject *MainMenuAction(void); - virtual cMenuSetupPage *SetupMenu(void); - virtual bool SetupParse(const char *Name,const char *Value); - virtual bool Service(const char *Id,void *Data = NULL); - virtual const char **SVDRPHelpPages(void); - virtual cString SVDRPCommand(const char *Command,const char *Option,int &ReplyCode); -}; @@ -314,7 +314,7 @@ const tI18nPhrase Phrases[] = { "Přejmenovat", }, { "Show recording date", - "Zeige Aufnahmedatum", + "Aufnahmedatum anzeigen", "", "", "", @@ -336,7 +336,7 @@ const tI18nPhrase Phrases[] = { "Zobrazit datum nahrávky", }, { "Show recording time", - "Zeige Aufnahmezeit", + "Aufnahmezeit anzeigen", "", "", "", @@ -358,7 +358,7 @@ const tI18nPhrase Phrases[] = { "Zobrazit čas nahrávky", }, { "Show recording length", - "Zeige Aufnahmelänge", + "Aufnahmelänge anzeigen", "", "", "", @@ -409,7 +409,7 @@ const tI18nPhrase Phrases[] = { "", "Remplacer le nenu original Enregistrement", "", - "Korvaa alkuperäinen 'Tallenteet'-valikko", + "Korvaa alkuperäinen tallennevalikko", "", "", "", @@ -431,7 +431,7 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Käytä vaihtoehtoista uuden tallenteen merkintää", + "Merkitse uudet tallenteet symbolilla", "", "", "", @@ -643,15 +643,15 @@ const tI18nPhrase Phrases[] = { "", "sudo nebo mount --bind / umount selhal (VFAT-systém)", }, - { "Show \"new recordings column\"", - "\"Neue-Aufzeichnungen-Spalte\" anzeigen", + { "Details", + "Details", "", "", "", "", - "\"Colone nouveaux enregistrements\" Afficher", + "Détails", "", - "Näytä \"uudet tallenteet\"-sarake", + "Lisätiedot", "", "", "", @@ -663,17 +663,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Zobrazit \"sloupec nová nahrávka\"", + "Detaily", }, - { "Sort recordings by", - "Aufnahme sortieren nach", + { "DVD plugin is not installed!", + "Das DVD-Plugin ist nicht installiert!", "", "", "", "", - "Trier enregistrements par", + "Le plugin DVD n'est pas installé!", "", - "Järjestä tallenteet", + "DVD-laajennosta ei löydy!", "", "", "", @@ -685,17 +685,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Řadit nahrávky podle", + "Modul DVD není nainstalován!", }, - { "alphabet for main-, flexible for subdirectories", - "Alphabet für Haupt-, flexibel für Unterverzeichnisse", + { "Rename/Move failed!", + "Umbenennen/Verschieben fehlgeschlagen!", "", "", "", "", - "Alphabet pour les dossiers, flexible pour les sous-dossiers", + "Renommer/déplacer ŕ échoué!", "", - "juurihakemisto aakkosittain", + "Nimeäminen/siirto epäonnistui!", "", "", "", @@ -707,17 +707,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "abecedy pro hlavní, flex. pro podadresáře", + "Přejmenování/Přesun selhal!", }, - { "date for main-, flexible for subdirectories", - "Datum für Haupt, flexibel für Unterverzeichnisse", + { "Creating directories failed!", + "Verzeichnisse anlegen fehlgeschlagen!", "", "", "", "", - "Date pour les dossiers, flexible pour les sous-dossiers", + "Echecs lors de la création du dossier!", "", - "juurihakemisto päivämäärän mukaan", + "Hakemiston luonti epäonnistui!", "", "", "", @@ -729,17 +729,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "datumu pro hlavní, flex pro podadresáře", + "Selhalo vytvoření adresáře!", }, - { "alphabet for all directories", - "Alphabet für alle Verzeichnisse", + { "Invalid filename!", + "Ungültiger Dateiname!", "", "", "", "", - "Alphabet pour tous les dossiers", + "Nom de fichiers n'est pas valide'", "", - "kaikki aakkosittain", + "Virheellinen tiedoston nimi!", "", "", "", @@ -751,17 +751,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "abecedy pro všechny adresáře", + "Chybné jméno souboru!", }, - { "date for all directories", - "Datum für alle Verzeichnisse", + { "Editing not allowed while cutting!", + "Editieren während des Schneidens nicht erlaubt!", "", "", "", "", - "Date pour tous les dossiers", + "Editer pendant la découpe n'est pas possible!", "", - "kaikki päivämäärän mukaan", + "Muokkaus leikkauksen aikana ei ole sallittu!", "", "", "", @@ -773,17 +773,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "datumu pro všechny adresáře", + "Je spuštěn střih - Editovat nyní nelze!", }, - { "Details", - "Details", + { "Moving into own sub-directory not allowed!", + "Verschieben in eigenes Unterverzeichnis nicht erlaubt!", "", "", "", "", - "Détails", + "Déplacer dans le sous-dossier propre, n'est pas possible!", "", - "Lisätiedot", + "Siirto omaan alihakemistoon ei ole sallittu!", "", "", "", @@ -795,18 +795,17 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Detaily", + "Přesun do vlastního podadresáře není povolen!", }, - { "DVD plugin is not installed!", - "Das DVD-Plugin ist nicht installiert!", + { "Sort by name", + "Sortieren nach Namen", "", "", "", "", - "Le plugin DVD n'est pas installé!", "", - "DVD-laajennosta ei löydy!", "", + "Tallenteet järjestetään nimen mukaan", "", "", "", @@ -817,106 +816,44 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Modul DVD není nainstalován!", - }, - { "Rename/Move failed!", - "Umbenennen/Verschieben fehlgeschlagen!", - "", - "", - "", - "", - "Renommer/déplacer ŕ échoué!", - "", - "Nimeäminen/siirto epäonnistui!", - "", - "", - "", "", "", - "", - "", - "", - "", - "", - "", - "Přejmenování/Přesun selhal!", }, - { "Creating directories failed!", - "Verzeichnisse anlegen fehlgeschlagen!", - "", - "", - "", + { "Sort by date", + "Sortieren nach Datum", "", - "Echecs lors de la création du dossier!", - "", - "Hakemiston luonti epäonnistui!", "", "", "", "", "", + "Tallenteet järjestetään päivämäärän mukaan", "", "", "", "", "", "", - "Selhalo vytvoření adresáře!", - }, - { "Invalid filename!", - "Ungültiger Dateiname!", - "", - "", - "", - "", - "Nom de fichiers n'est pas valide'", - "", - "Virheellinen tiedoston nimi!", - "", - "", - "", "", "", "", "", "", "", - "", - "", - "Chybné jméno souboru!", }, - { "Editing not allowed while cutting!", - "Editieren während des Schneidens nicht erlaubt!", - "", - "", - "", - "", - "Editer pendant la découpe n'est pas possible!", - "", - "Muokkaus leikkauksen aikana ei ole sallittu!", - "", - "", + { "Show nr. of new recordings in a directory", + "Anzahl der neuen Aufn. im Ordners anzeigen", "", "", "", "", "", "", - "", - "", - "", - "Je spuštěn střih - Editovat nyní nelze!", - }, - { "Moving into own sub-directory not allowed!", - "Verschieben in eigenes Unterverzeichnis nicht erlaubt!", + "Näytä uusien tallenteiden lukumäärä", "", "", "", "", - "Déplacer dans le sous-dossier propre, n'est pas possible!", - "", - "Siirto omaan alihakemistoon ei ole sallittu!", - "", "", "", "", @@ -925,9 +862,6 @@ const tI18nPhrase Phrases[] = { "", "", "", - "", - "", - "Přesun do vlastního podadresáře není povolen!", }, { NULL } }; diff --git a/mymenucommands.c b/mymenucommands.c index b7e3c79..3c5099a 100644 --- a/mymenucommands.c +++ b/mymenucommands.c @@ -30,7 +30,7 @@ eOSState myMenuCommands::Execute() { char *buffer=NULL; bool confirmed=true; -#ifdef BIGPATCHVERSION +#ifdef CMDSUBMENUVERSNUM if (command->hasChilds()) { AddSubMenu(new myMenuCommands(command->Title(), command->getChilds(), parameters)); return osContinue; diff --git a/mymenueditrecording.c b/mymenueditrecording.c index e50c302..893a014 100644 --- a/mymenueditrecording.c +++ b/mymenueditrecording.c @@ -8,9 +8,6 @@ #include "mymenurecordings.h" #include "tools.h" -bool myMenuMoveRecording::clearall=false; -char newname[128]; - // --- myMenuRenameRecording -------------------------------------------------- myMenuRenameRecording::myMenuRenameRecording(myMenuRecordings *MenuRecordings,cRecording *Recording,const char *DirBase,const char *DirName):cOsdMenu(tr("Rename"),12) { @@ -19,6 +16,8 @@ myMenuRenameRecording::myMenuRenameRecording(myMenuRecordings *MenuRecordings,cR recording=Recording; dirbase=DirBase?strdup(DirBase):NULL; dirname=DirName?strdup(DirName):NULL; + strn0cpy(name,"",sizeof(name)); + strn0cpy(path,"",sizeof(path)); if(recording) { @@ -33,16 +32,14 @@ myMenuRenameRecording::myMenuRenameRecording(myMenuRecordings *MenuRecordings,cR *p=0; } else - { - strn0cpy(name,recording->Name(),sizeof(name)); - strn0cpy(path,"",sizeof(path)); - } + strn0cpy(name,recording->Name(),sizeof(name)); } else { isdir=true; strn0cpy(name,DirName,sizeof(name)); - strn0cpy(path,DirBase?DirBase:"",sizeof(path)); + if(DirBase) + strn0cpy(path,DirBase,sizeof(path)); } Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); cRemote::Put(kRight); @@ -63,6 +60,8 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) { char *oldname=NULL; char *newname=NULL; + char *tmppath=path[0]?strdup(path):NULL; + char *tmpname=name[0]?strdup(name):NULL; if(strchr(name,'.')==name||!strlen(name)) { @@ -72,11 +71,11 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) } if(isdir) - asprintf(&oldname,"%s%s%s/%s",VideoDirectory,path[0]?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); + asprintf(&oldname,"%s%s%s/%s",VideoDirectory,tmppath?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); else oldname=strdup(recording->FileName()); - asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,path[0]?"/":"",ExchangeChars(path,true),ExchangeChars(name,true),isdir?"":strrchr(recording->FileName(),'/')); + asprintf(&newname,"%s%s%s/%s%s",VideoDirectory,tmppath?"/":"",tmppath?ExchangeChars(tmppath,true):"",ExchangeChars(tmpname,true),isdir?"":strrchr(recording->FileName(),'/')); if(MoveRename(oldname,newname,isdir?NULL:recording,false)) { @@ -91,6 +90,8 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) free(oldname); free(newname); + free(tmppath); + free(tmpname); } if(Key==kBack) return osBack; @@ -99,6 +100,9 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) } // --- myMenuNewName ---------------------------------------------------------- +bool myMenuMoveRecording::clearall=false; +char newname[128]; + class myMenuNewName:public cOsdMenu { private: @@ -178,7 +182,7 @@ myMenuMoveRecordingItem::myMenuMoveRecordingItem(cRecording *Recording,int Level const char *p=s; while(*++s) { - if(*s == '~') + if(*s=='~') { if(Level--) p=s+1; @@ -203,6 +207,7 @@ myMenuMoveRecording::myMenuMoveRecording(myMenuRecordings *MenuRecordings,cRecor recording=Recording; menurecordings=MenuRecordings; base=Base?strdup(Base):NULL; + level=Level; Set(); SetHelp(tr("Button$Cancel"),NULL,tr("Button$Create"),tr("Button$Move")); @@ -283,7 +288,7 @@ eOSState myMenuMoveRecording::MoveRec() asprintf(&oldname,"%s%s%s/%s",VideoDirectory,dirbase?"/":"",dirbase?ExchangeChars(dirbase,true):"",ExchangeChars(dirname,true)); else oldname=strdup(recording->FileName()); - + myMenuMoveRecordingItem *item=(myMenuMoveRecordingItem*)Get(Current()); if(item) { @@ -317,7 +322,9 @@ eOSState myMenuMoveRecording::MoveRec() } } if(dir) - ExchangeChars(dir,true); + dir=ExchangeChars(dir,true); + + printf("dir: %s\n",dir); asprintf(&newname,"%s%s%s%s",VideoDirectory,dir?"/":"",dir?dir:"",strrchr(dirname?oldname:recording->FileName(),'/')); diff --git a/mymenurecordings.c b/mymenurecordings.c index 0b9e5e1..eac71d8 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -14,6 +14,8 @@ #include "patchfont.h" #include "tools.h" +extern SortList *mySortList; + // --- myMenuRecordingInfo ---------------------------------------------------- class myMenuRecordingInfo:public cOsdMenu { @@ -84,10 +86,8 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) isdvd=false; isvideodvd=false; name=NULL; - id=NULL; strn0cpy(dvdnr,"",sizeof(dvdnr)); - bool isnew=Recording->IsNew(); filename=Recording->FileName(); // get the level of this recording @@ -106,7 +106,7 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) const char *p=s; while(*++s) { - if(*s == '~') + if(*s=='~') { if(Level--) p=s+1; @@ -124,55 +124,16 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) { if(Level==level) // recording entries { - s=strrchr(Recording->Name(),'~'); - - // date and time of recording - struct tm tm_r; - struct tm *t=localtime_r(&Recording->start,&tm_r); - - char reclength[21]; - char *indexfilename; - - // recording length - asprintf(&indexfilename,"%s/index.vdr",filename); - int haslength=!access(indexfilename,R_OK); - if(haslength) // calculate recording length from the size of index.vdr - { - struct stat buf; - if(!stat(indexfilename,&buf)) - snprintf(reclength,sizeof(reclength),"%d'",(int)(buf.st_size/12000)); - } - else // no index -> is there a length.vdr, containing recording length as a string? - { - free(indexfilename); - asprintf(&indexfilename,"%s/length.vdr",filename); - haslength=!access(indexfilename,R_OK); - if(haslength) - { - FILE *f; - if((f=fopen(indexfilename,"r"))!=NULL) - { - char buffer[8]; - if(fgets(buffer,sizeof(buffer),f)) - { - char *p=strchr(buffer,'\n'); - if(p) - *p=0; - } - fclose(f); - snprintf(reclength,sizeof(reclength),"%s'\n",buffer); - } - } - } - free(indexfilename); - + char *buffer=NULL; + string titlebuffer; + // dvdarchive-patch functionality - asprintf(&indexfilename,"%s/dvd.vdr",filename); - isdvd=!access(indexfilename,R_OK); + asprintf(&buffer,"%s/dvd.vdr",filename); + isdvd=!access(buffer,R_OK); if(isdvd) { FILE *f; - if((f=fopen(indexfilename,"r"))!=NULL) + if((f=fopen(buffer,"r"))!=NULL) { // get the dvd id if(fgets(dvdnr,sizeof(dvdnr),f)) @@ -189,34 +150,101 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) fclose(f); } } - free(indexfilename); - - char recdate[9],rectime[6],recdelimiter[2]={'\t',0}; - char dvd[2]={0,0}; + free(buffer); + + // marker + titlebuffer=' '; + if(Recording->IsNew()&&!mysetup.PatchNew) + titlebuffer='*'; + if(!Recording->IsNew()&&mysetup.PatchNew) + titlebuffer=char(128); if(isdvd) - dvd[0]=char(129); - else - if(isnew&&!mysetup.PatchNew) - dvd[0]='*'; - else - if(!isnew&&mysetup.PatchNew) - dvd[0]=char(128); + titlebuffer=char(129); + + titlebuffer+='\t'; + + // date and time of recording + struct tm tm_r; + struct tm *t=localtime_r(&Recording->start,&tm_r); + char recdate[9],rectime[6]; + strn0cpy(recdate,"",sizeof(recdate)); + strn0cpy(rectime,"",sizeof(rectime)); 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 - 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()); + + if(mysetup.ShowRecDate) + { + titlebuffer+=recdate; + titlebuffer+='\t'; + } + + if(mysetup.ShowRecTime) + { + titlebuffer+=rectime; + titlebuffer+='\t'; + } + + // recording length + if(mysetup.ShowRecLength) + { + char reclength[21]; + strn0cpy(reclength,"",sizeof(reclength)); + + asprintf(&buffer,"%s/index.vdr",filename); + int haslength=!access(buffer,R_OK); + if(haslength) // calculate recording length from the size of index.vdr + { + struct stat buf; + if(!stat(buffer,&buf)) + snprintf(reclength,sizeof(reclength),"%3d'",(int)(buf.st_size/12000)); + } + else // no index -> is there a length.vdr, containing recording length as a string? + { + free(buffer); + asprintf(&buffer,"%s/length.vdr",filename); + haslength=!access(buffer,R_OK); + if(haslength) + { + FILE *f; + if((f=fopen(buffer,"r"))!=NULL) + { + char buf[8]; + if(fgets(buf,sizeof(buf),f)) + { + char *p=strchr(buf,'\n'); + if(p) + *p=0; + } + fclose(f); + snprintf(reclength,sizeof(reclength),"%3s'\n",buf); + } + } + } + free(buffer); + + strreplace(reclength,' ',char(131)); + + titlebuffer+=reclength; + titlebuffer+='\t'; + } + + if(!mysetup.ShowRecDate&&!mysetup.ShowRecTime&&!mysetup.ShowRecLength) + titlebuffer+='\t'; + + // dvd id + if(isdvd&&mysetup.ShowDvdNr) + { + titlebuffer+='['; + titlebuffer+=dvdnr; + titlebuffer+="]"; + } + + // recording title + s=strrchr(Recording->Name(),'~'); + titlebuffer+=s?s+1:Recording->Name(); + + title=strdup(titlebuffer.c_str()); } else { @@ -239,21 +267,41 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) totalentries++; if(IsNew) newentries++; - + char *buffer=NULL; + char entries[8]; + snprintf(entries,sizeof(entries),"%3d",totalentries); + strreplace(entries,' ',char(131)); + if(mysetup.ShowNewRecs) - asprintf(&buffer,"%d\t%d\t%s",totalentries,newentries,name); + { + asprintf(&buffer,"%c\t%s (%d)%s%s%s%s%s", + char(130), + entries, + newentries, + (!mysetup.ShowRecDate&&!mysetup.ShowRecTime&&!mysetup.ShowRecLength)?"\t":"", + (mysetup.ShowRecDate||mysetup.ShowRecTime||mysetup.ShowRecLength)?"\t":"", + (mysetup.ShowRecDate&&mysetup.ShowRecTime||mysetup.ShowRecTime&&mysetup.ShowRecLength||mysetup.ShowRecLength&&mysetup.ShowRecDate)?"\t":"", + (mysetup.ShowRecDate&&mysetup.ShowRecTime&&mysetup.ShowRecLength)?"\t":"", + name); + } else - asprintf(&buffer,"%d\t%s",totalentries,name); - - // don't show '-', '.', '$', 'Ş' or 'ˇ' if the directory name ends with one of it - if(buffer[strlen(buffer)-1]=='.'||buffer[strlen(buffer)-1]=='-'||buffer[strlen(buffer)-1]=='$'||buffer[strlen(buffer)-1]==char(170)||buffer[strlen(buffer)-1]==char(183)) - buffer[strlen(buffer)-1]=0; - + { + asprintf(&buffer,"%c\t%s%s%s%s%s%s", + char(130), + entries, + (!mysetup.ShowRecDate&&!mysetup.ShowRecTime&&!mysetup.ShowRecLength)?"\t":"", + (mysetup.ShowRecDate||mysetup.ShowRecTime||mysetup.ShowRecLength)?"\t":"", + (mysetup.ShowRecDate&&mysetup.ShowRecTime||mysetup.ShowRecTime&&mysetup.ShowRecLength||mysetup.ShowRecLength&&mysetup.ShowRecDate)?"\t":"", + (mysetup.ShowRecDate&&mysetup.ShowRecTime&&mysetup.ShowRecLength)?"\t":"", + name); + } SetText(buffer,false); } // --- myMenuRecordings ------------------------------------------------------- +#define MB_PER_MINUTE 25.75 // this is just an estimate! + bool myMenuRecordings::golastreplayed=false; bool myMenuRecordings::wasdvd; @@ -270,18 +318,23 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas } // set tabs if(mysetup.ShowRecDate&&mysetup.ShowRecTime&&!mysetup.ShowRecLength) // recording date and time are shown, recording length not - SetCols(8,6); + SetCols(2,8,6); else if(mysetup.ShowRecDate&&mysetup.ShowRecTime) // all details are shown - SetCols(8,6,4); + SetCols(2,8,6,4); else if(mysetup.ShowRecDate&&!mysetup.ShowRecTime) // recording time is not shown - SetCols(8,4); + SetCols(2,8,4); else if(!mysetup.ShowRecDate&&mysetup.ShowRecTime&&mysetup.ShowRecLength) // recording date is not shown - SetCols(6,4); + SetCols(2,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); + { + if(mysetup.ShowNewRecs) + SetCols(2,8,3); + else + SetCols(2,4,3); + } edit=false; level=Level; @@ -377,7 +430,7 @@ void myMenuRecordings::SetHelpKeys() void myMenuRecordings::Set(bool Refresh,char *current) { const char *lastreplayed=current?current:myReplayControl::LastReplayed(); - + if(level==0) SetFreeSpaceTitle(); @@ -401,7 +454,9 @@ void myMenuRecordings::Set(bool Refresh,char *current) for(cRecording *recording=Recordings.First();recording;recording=Recordings.Next(recording)) list->Add(new myRecListItem(recording)); // sort my recordings list - list->Sort(); + char path[BUFSIZ]; + snprintf(path,sizeof(path),"%s/%s",VideoDirectory,base?base:""); + list->Sort(mySortList->Find(path)); // needed for move recording menu Recordings.Sort(); @@ -414,7 +469,7 @@ void myMenuRecordings::Set(bool Refresh,char *current) if(!base||(strstr(listitem->recording->Name(),base)==listitem->recording->Name()&&listitem->recording->Name()[strlen(base)]=='~')) { myMenuRecordingsItem *recitem=new myMenuRecordingsItem(listitem->recording,level); - if(*recitem->Text()&&(!lastitem||strcmp(recitem->Text(),lastitemtext))) + if(*recitem->Text()&&((!lastitem||strcmp(recitem->Text(),lastitemtext))||!recitem->IsDirectory())) { Add(recitem); lastitem=recitem; @@ -434,7 +489,8 @@ void myMenuRecordings::Set(bool Refresh,char *current) { SetCurrent(lastitem); if(recitem&&!recitem->IsDirectory()) - golastreplayed=false; + if(!cControl::Control()) + golastreplayed=false; } if(recitem&&!recitem->IsDirectory()&&recitem->IsDVD()&&!cControl::Control()) cReplayControl::ClearLastReplayed(cReplayControl::LastReplayed()); @@ -488,6 +544,10 @@ eOSState myMenuRecordings::Play() myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); if(item) { +#ifdef WITHPINPLUGIN + if(cStatus::MsgReplayProtected(GetRecording(item),item->Name(),base,item->IsDirectory())==true) + return osContinue; +#endif if(item->IsDirectory()) Open(); else @@ -736,6 +796,35 @@ eOSState myMenuRecordings::Commands(eKeys Key) return osContinue; } +// change sorting +eOSState myMenuRecordings::ChangeSorting() +{ + char buffer[BUFSIZ]; + + snprintf(buffer,sizeof(buffer),"%s/%s",VideoDirectory,base?base:""); + + for(SortListItem *item=mySortList->First();item;item=mySortList->Next(item)) + { + if(!strcmp(buffer,item->Path())) + { + mySortList->Del(item); + mySortList->WriteConfigFile(); + Set(true); + + Skins.Message(mtInfo,tr("Sort by date"),1); + + return osContinue; + } + } + mySortList->Add(new SortListItem(buffer)); + mySortList->WriteConfigFile(); + Set(true); + + Skins.Message(mtInfo,tr("Sort by name"),1); + + return osContinue; +} + eOSState myMenuRecordings::ProcessKey(eKeys Key) { eOSState state; @@ -779,6 +868,10 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) else { myMenuRecordingsItem *item=(myMenuRecordingsItem*)Get(Current()); +#ifdef WITHPINPLUGIN + if(cStatus::MsgReplayProtected(GetRecording(item),item->Name(),base,item->IsDirectory())==true) + return osContinue; +#endif if(!HasSubMenu()&&item) { edit=true; @@ -791,6 +884,7 @@ eOSState myMenuRecordings::ProcessKey(eKeys Key) break; case kBlue: return Info(); case k1...k9: return Commands(Key); + case k0: return ChangeSorting(); default: break; } } diff --git a/mymenurecordings.h b/mymenurecordings.h index 8f17f69..694f112 100644 --- a/mymenurecordings.h +++ b/mymenurecordings.h @@ -1,5 +1,3 @@ -#define MB_PER_MINUTE 25.75 // this is just an estimate! - // --- myMenuRecordingsItem --------------------------------------------------- class myMenuRecordingsItem:public cOsdItem { @@ -12,7 +10,6 @@ class myMenuRecordingsItem:public cOsdItem 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(); @@ -23,7 +20,6 @@ class myMenuRecordingsItem:public cOsdItem bool IsDVD(){return isdvd;} bool IsVideoDVD(){return isvideodvd;} char *DvdNr(){return dvdnr;} - const char *ID(){return id;} }; // --- myMenuRecordings ------------------------------------------------------- @@ -48,6 +44,7 @@ class myMenuRecordings:public cOsdMenu eOSState Info(); eOSState Details(); eOSState Commands(eKeys Key=kNone); + eOSState ChangeSorting(); public: myMenuRecordings(const char *Base=NULL,int Level=0); ~myMenuRecordings(); diff --git a/mymenusetup.c b/mymenusetup.c index 4af1ca9..329631b 100644 --- a/mymenusetup.c +++ b/mymenusetup.c @@ -8,25 +8,19 @@ mySetup::mySetup() { mysetup.HideMainMenuEntry=0; - mysetup.PatchNew=0; + mysetup.PatchNew=1; mysetup.ShowDvdNr=0; mysetup.ReplaceOrgRecMenu=0; mysetup.ShowRecDate=1; mysetup.ShowRecTime=1; mysetup.ShowRecLength=0; mysetup.ShowNewRecs=1; - mysetup.SortRecords=0; } mySetup mysetup; myMenuSetup::myMenuSetup() { - sortrecordstext[0]=tr("alphabet for main-, flexible for subdirectories"); - sortrecordstext[1]=tr("date for main-, flexible for subdirectories"); - sortrecordstext[2]=tr("alphabet for all directories"); - sortrecordstext[3]=tr("date for all directories"); - hidemainmenuentry=mysetup.HideMainMenuEntry; patchnew=mysetup.PatchNew; replaceorgrecmenu=mysetup.ReplaceOrgRecMenu; @@ -35,17 +29,15 @@ myMenuSetup::myMenuSetup() showreclength=mysetup.ShowRecLength; showdvdnr=mysetup.ShowDvdNr; shownewrecs=mysetup.ShowNewRecs; - sortrecords=mysetup.SortRecords; 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("Show \"new recordings column\""),&shownewrecs)); + Add(new cMenuEditBoolItem(tr("Show nr. of new recordings in a directory"),&shownewrecs)); Add(new cMenuEditBoolItem(tr("Show alternative to new marker"),&patchnew)); Add(new cMenuEditBoolItem(tr("Show dvd id"),&showdvdnr)); - Add(new cMenuEditStraItem(tr("Sort recordings by"),&sortrecords,4,sortrecordstext)); } void myMenuSetup::Store() @@ -58,5 +50,4 @@ void myMenuSetup::Store() SetupStore("ShowRecTime",mysetup.ShowRecTime=showrectime); SetupStore("ShowRecLength",mysetup.ShowRecLength=showreclength); SetupStore("ShowNewRecs",mysetup.ShowNewRecs=shownewrecs); - SetupStore("SortRecords",mysetup.SortRecords=sortrecords); } diff --git a/mymenusetup.h b/mymenusetup.h index ccae3ee..6763aee 100644 --- a/mymenusetup.h +++ b/mymenusetup.h @@ -12,7 +12,6 @@ class mySetup int PatchNew; int ShowDvdNr; int ShowNewRecs; - int SortRecords; }; extern mySetup mysetup; @@ -29,7 +28,6 @@ class myMenuSetup:public cMenuSetupPage int patchnew; int showdvdnr; int shownewrecs; - int sortrecords; protected: virtual void Store(); public: diff --git a/patchfont.c b/patchfont.c index 0a4c7db..d85bcd2 100644 --- a/patchfont.c +++ b/patchfont.c @@ -35,7 +35,6 @@ void PatchFont(eDvbFont DvbFont) { font_data[i*num_rows+ 0]=22; font_data[i*num_rows+ 1]=27; - font_data[i*num_rows+ 5]=0x000000; // .. .... .... .... .... .... font_data[i*num_rows+ 6]=0x000f00; // .. .... .... #### .... .... font_data[i*num_rows+ 7]=0x007fe0; // .. .... .### #### ###. .... font_data[i*num_rows+ 8]=0x00fff0; // .. .... #### #### #### .... @@ -56,13 +55,11 @@ void PatchFont(eDvbFont DvbFont) font_data[i*num_rows+23]=0x000ff0; // .. .... .... #### #### .... font_data[i*num_rows+24]=0x001fe0; // .. .... ...# #### ###. .... font_data[i*num_rows+25]=0x000f00; // .. .... .... #### .... .... - 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]=0x000000; // .. .... .... .... .... .... font_data[i*num_rows+ 3]=0x000f00; // .. .... .... #### .... .... font_data[i*num_rows+ 4]=0x007fe0; // .. .... .### #### ###. .... font_data[i*num_rows+ 5]=0x00fff0; // .. .... #### #### #### .... @@ -83,7 +80,6 @@ void PatchFont(eDvbFont DvbFont) font_data[i*num_rows+20]=0x000ff0; // .. .... .... #### #### .... font_data[i*num_rows+21]=0x001fe0; // .. .... ...# #### ###. .... font_data[i*num_rows+22]=0x000f00; // .. .... .... #### .... .... - font_data[i*num_rows+23]=0x000000; // .. .... .... .... .... .... } } // dvd marker @@ -93,7 +89,6 @@ void PatchFont(eDvbFont DvbFont) { 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; // .. ..## #### #### #..# .... @@ -114,13 +109,11 @@ void PatchFont(eDvbFont DvbFont) 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; // .. ..## #### #### #..# .... @@ -141,7 +134,68 @@ void PatchFont(eDvbFont DvbFont) 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; // .. .... .... .... .... .... + } + } + // folder + else if(num_char==130) + { + if(DvbFont==fontOsd) + { + font_data[i*num_rows+ 0]=22; + font_data[i*num_rows+ 1]=27; + font_data[i*num_rows+ 8]=0x1fe000; // .# #### ###. .... .... .... + font_data[i*num_rows+ 9]=0x1ff000; // .# #### #### .... .... .... + font_data[i*num_rows+10]=0x181800; // .# #... ...# #... .... .... + font_data[i*num_rows+11]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+12]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+13]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+14]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+15]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+16]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+17]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+18]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+19]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+20]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+21]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+22]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+23]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+24]=0x1ffffe; // .# #### #### #### #### ###. + } + else + { + font_data[i*num_rows+ 0]=22; + font_data[i*num_rows+ 1]=22; + font_data[i*num_rows+ 5]=0x1fe000; // .# #### ###. .... .... .... + font_data[i*num_rows+ 6]=0x1ff000; // .# #### #### .... .... .... + font_data[i*num_rows+ 7]=0x181800; // .# #... ...# #... .... .... + font_data[i*num_rows+ 8]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+ 9]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+10]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+11]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+12]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+13]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+14]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+15]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+16]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+17]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+18]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+19]=0x180006; // .# #... .... .... .... .##. + font_data[i*num_rows+20]=0x1ffffe; // .# #### #### #### #### ###. + font_data[i*num_rows+21]=0x1ffffe; // .# #### #### #### #### ###. + } + } + // blank space with the same width as the numbers + else if(num_char==131) + { + if(DvbFont==fontOsd) + { + font_data[i*num_rows+ 0]=13; + font_data[i*num_rows+ 1]=27; + } + else + { + font_data[i*num_rows+ 0]=10; + font_data[i*num_rows+ 1]=22; } } else diff --git a/scripts/dvdarchive.sh b/scripts/dvdarchive.sh index c4cf157..9dad5ed 100755 --- a/scripts/dvdarchive.sh +++ b/scripts/dvdarchive.sh @@ -1,10 +1,13 @@ #!/bin/bash # -# Version 2.0 2006-05-03 +# Version 2.1 2006-06-02 # # Author: Mike Constabel # VDR-Portal: vejoun # EMail: vejoun @ toppoint.de +# WWW: http://www.constabel.net/vdr/scripts.htm +# +# ---> CONFIGURATION AT LINE 79 <--- # # MANUAL: # ------- @@ -56,6 +59,9 @@ # # HISTORY: # -------- +# 2.1 - Fixed bug in testing if dvd is mounted +# - more DEBUG=1 output +# # 2.0 - more logging # - check if mountpoint and device exists # - Debug Log in file $DEBUGLOG if $DEBUG is 1, for easier error reporting @@ -84,7 +90,7 @@ EJECTWRONG=0 EJECTUMOUNT=0 # Log warnings/errors in syslog. 1 = yes, 0 = no. -SYSLOG=1 +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. @@ -100,8 +106,18 @@ DEBUGLOG="/tmp/dvdarchive.sh-debug.log" # Remove trailing slash MOUNTPOINT=${MOUNTPOINT/%\/} +if [ -L "$MOUNTPOINT" ]; then + MOUNTPOINTT="$(find "$MOUNTPOINT" -printf "%l")" +else + MOUNTPOINTT="$MOUNTPOINT" +fi # determine dvd-device, used by eject and isodetect if exists DEVICE="$(awk '( $1 !~ /^#/ ) && ( $2 == "'$MOUNTPOINT'" ) { printf("%s", $1); exit; }' /etc/fstab)" +if [ -L "$DEVICE" ]; then + DEVICET="$(find "$DEVICE" -printf "%l")" +else + DEVICET="$DEVICE" +fi ACTION="$1" REC="$2" @@ -133,7 +149,11 @@ log() { if [ $DEBUG -eq 1 ]; then echo "-------" >> $DEBUGLOG echo -e "Parameters: $ACTION $REC $NAME\n" >> $DEBUGLOG - echo -e "ERROR: $2\n\nMountpoint: $MOUNTPOINT\nDevice: $DEVICE\n" >> $DEBUGLOG + echo -e "ERROR: $2\n\n" >> $DEBUGLOG + echo -e "Mountpoint: $MOUNTPOINT\nDevice: $DEVICE\n" >> $DEBUGLOG + echo -e "MountpointT: $MOUNTPOINTT\nDeviceT: $DEVICET\n" >> $DEBUGLOG + FSTAB="$(awk '( $1 !~ /^#/ ) && ( $2 == "'$MOUNTPOINT'" || $2 == "'$MOUNTPOINTT'" ) { printf("%s", $0); }' /etc/fstab)" + echo -e "fstab: ${FSTAB}\n" >>$DEBUGLOG echo -e "Filesystem: $(stat -f -c %T "$REC")\n" >> $DEBUGLOG mount >> $DEBUGLOG echo >> $DEBUGLOG @@ -164,9 +184,9 @@ mount) fi fi # check if not mounted - if mount | egrep -q " $MOUNTPOINT "; then + if mount | egrep -q " $MOUNTPOINTT "; then # check if dvd is in use - if mount | egrep -q "^$MOUNTPOINT"; then + if mount | egrep -q "^$DEVICET"; then log error "dvd in use (at: check if dvd is in use)" exit 1 fi @@ -235,7 +255,7 @@ mount) ;; umount) # check if dvd is mounted - mount | egrep -q " $MOUNTPOINT " || { log error "dvd not mounted (at: check if dvd is mounted)"; exit 1; } + mount | egrep -q " $MOUNTPOINTT " || { log error "dvd not mounted (at: check if dvd is mounted)"; exit 1; } # check if video partition is vfat if [ "$(stat -f -c %T "$REC")" != "vfat" ]; then # is mounted, umount dvd bevor unlinking @@ -2,11 +2,55 @@ * See the README file for copyright information and how to reach the author. */ +#include <vdr/plugin.h> #include <vdr/videodir.h> #include <vdr/recording.h> #include "tools.h" #include "mymenusetup.h" +#define CONFIGFILE "/extrecmenu.sort.conf" + +// --- SortList --------------------------------------------------------------- +void SortList::ReadConfigFile() +{ + string configfile(cPlugin::ConfigDirectory()); + configfile+=CONFIGFILE; + + ifstream in(configfile.c_str()); + if(in) + { + string buf; + while(!in.eof()) + { + getline(in,buf); + if(buf.length()>0) + Add(new SortListItem(buf.c_str())); + } + } +} + +void SortList::WriteConfigFile() +{ + string configfile(cPlugin::ConfigDirectory()); + configfile+=CONFIGFILE; + + ofstream outfile(configfile.c_str()); + + for(SortListItem *item=First();item;item=Next(item)) + outfile << item->Path() << endl; +} + +bool SortList::Find(char *Path) +{ + for(SortListItem *item=First();item;item=Next(item)) + { + if(!strcmp(item->Path(),Path)) + return true; + } + return false; +} + +// --- MoveRename ------------------------------------------------------------- // creates the necassery directories and renames the given old name to the new name bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bool Move) { @@ -28,6 +72,7 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo if(rename(OldName,NewName)==-1) { + esyslog("[extrecmenu] %s",strerror(errno)); Skins.Message(mtError,tr("Rename/Move failed!")); return false; } @@ -46,7 +91,6 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo { // is the new path within the old? asprintf(&buf,"%s/",OldName); // we have to append a / to make sure that we search for a directory - printf("%s\n%s\n",buf,NewName); if(!strncmp(buf,NewName,strlen(buf))) { Skins.Message(mtError,tr("Moving into own sub-directory not allowed!")); @@ -67,7 +111,7 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo if(!strncmp(OldName,item->recording->FileName(),strlen(OldName))) { buf=strdup(OldName+strlen(VideoDirectory)+1); - ExchangeChars(buf,false); + buf=ExchangeChars(buf,false); // exclude recordings with the same name as OldName if(strcmp(item->recording->Name(),buf)) @@ -87,16 +131,17 @@ bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bo } // --- myRecListItem ---------------------------------------------------------- +bool myRecListItem::SortByName=false; + myRecListItem::myRecListItem(cRecording *Recording) { recording=Recording; - filename=recording->FileName(); - sortbuffer=NULL; + filename=strdup(recording->FileName()); } myRecListItem::~myRecListItem() { - free(sortbuffer); + free(filename); } char *myRecListItem::StripEpisodeName(char *s) @@ -117,32 +162,31 @@ 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&&!SortByName) memmove(s1+1,s2,t-s2+1); + return s; } -char *myRecListItem::SortName()const +int myRecListItem::Compare(const cListObject &ListObject)const { - if(!sortbuffer) - { - char *s=StripEpisodeName(strdup(filename+strlen(VideoDirectory))); - strreplace(s,'/','a'); - int l=strxfrm(NULL,s,0)+1; - sortbuffer=MALLOC(char,l); - strxfrm(sortbuffer,s,l); - free(s); - } - return sortbuffer; + myRecListItem *item=(myRecListItem*)&ListObject; + + char *s1=StripEpisodeName(strdup(filename+strlen(VideoDirectory))); + char *s2=StripEpisodeName(strdup(item->filename+strlen(VideoDirectory))); + + int compare=strcasecmp(s1,s2); + + free(s1); + free(s2); + + return compare; } -int myRecListItem::Compare(const cListObject &ListObject)const +// --- myRecList -------------------------------------------------------------- +void myRecList::Sort(bool SortByName) { - myRecListItem *item=(myRecListItem*)&ListObject; - return strcasecmp(SortName(),item->SortName()); + myRecListItem::SortByName=SortByName; + cListBase::Sort(); } @@ -1,12 +1,35 @@ +#include <string> +#include <fstream> +#include <iostream> + +using namespace std; + +class SortListItem:public cListObject +{ + private: + string path; + public: + SortListItem(const char *Path){path=Path;}; + const char *Path(){return path.c_str();} +}; + +class SortList:public cList<SortListItem> +{ + public: + void ReadConfigFile(); + void WriteConfigFile(); + bool Find(char *Path); +}; + bool MoveRename(const char *OldName,const char *NewName,cRecording *Recording,bool Move); class myRecListItem:public cListObject { + friend class myRecList; private: - const char *filename; - mutable char *sortbuffer; + static bool SortByName; + char *filename; static char *StripEpisodeName(char *s); - char *SortName()const; public: myRecListItem(cRecording *Recording); ~myRecListItem(); @@ -16,4 +39,6 @@ class myRecListItem:public cListObject class myRecList:public cList<myRecListItem> { + public: + void Sort(bool SortByName); }; |