diff options
author | Martin Prochnow <nordlicht@martins-kabuff.de> | 2006-03-29 18:54:49 +0200 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2006-03-29 18:54:49 +0200 |
commit | 0ff08f0bfb1460e0d0035081956a75b92aaa8359 (patch) | |
tree | 3a77a0dec260c32659bf7dda9e35ef04299b8d47 | |
parent | 54d5f6870a7351584fcb1c3e861a4fc9224badf3 (diff) | |
download | vdr-plugin-extrecmenu-0ff08f0bfb1460e0d0035081956a75b92aaa8359.tar.gz vdr-plugin-extrecmenu-0ff08f0bfb1460e0d0035081956a75b92aaa8359.tar.bz2 |
Version 0.8v0.8
- added some logging
- added option to hide the "new recordings column"
- added possibility to edit lifetime and priority at the rename menu
- changed alternative new marker, it marks now the recordings that are not "rewinded", if turned of the behaviour is like that of VDR's recordings menu
- added support for a file length.vdr, containing the length of a recording as a string
- new version of 'dvdarchive.sh'; thanks to vejoun from vdr-portal.de
- added two small tools (in tools/); isodetect to check for a dvd in drive (optionally used by 'dvdarchive.sh'); getlength to create a length.vdr
- updated error messages, more detailed now
- fixed quoting of the parameters for dvdarchive.sh to avoid problems with filenames containing a '
- fixed unnecessary calls of 'dvdarchive.sh'; thanks to vejoun from vdr-portal.de for reporting
-rw-r--r-- | HISTORY | 24 | ||||
-rw-r--r-- | README | 35 | ||||
-rw-r--r-- | extrecmenu.c | 5 | ||||
-rw-r--r-- | extrecmenu.h | 2 | ||||
-rw-r--r-- | i18n.c | 44 | ||||
-rw-r--r-- | mymenurecordings.c | 92 | ||||
-rw-r--r-- | mymenurecordings.h | 1 | ||||
-rw-r--r-- | mymenurenamerecording.c | 25 | ||||
-rw-r--r-- | mymenusetup.c | 9 | ||||
-rw-r--r-- | mymenusetup.h | 2 | ||||
-rw-r--r-- | patchfont.c | 101 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh | 101 | ||||
-rwxr-xr-x | scripts/dvdarchive.sh.old | 37 | ||||
-rw-r--r-- | tools.c | 2 | ||||
-rw-r--r-- | tools/getlength.c | 68 | ||||
-rw-r--r-- | tools/isodetect.c | 150 |
16 files changed, 515 insertions, 183 deletions
@@ -1,6 +1,24 @@ VDR Plugin 'extrecmenu' Revision History ---------------------------------------- +2006-03-29: Version 0.8 +- added some logging +- added option to hide the "new recordings column" +- added possibility to edit lifetime and priority at the rename menu +- changed alternative new marker, it marks now the recordings that are not + "rewinded", if turned of the behaviour is like that of VDR's recordings + menu +- added support for a file length.vdr, containing the length of a recording as + a string +- new version of 'dvdarchive.sh'; thanks to vejoun from vdr-portal.de +- added two small tools (in tools/); isodetect to check for a dvd in drive + (optionally used by 'dvdarchive.sh'); getlength to create a length.vdr +- updated error messages, more detailed now +- fixed quoting of the parameters for dvdarchive.sh to avoid problems with + filenames containing a ' +- fixed unnecessary calls of 'dvdarchive.sh'; thanks to vejoun from + vdr-portal.de for reporting + 2006-03-25: Version 0.7 - added frensh translation; thanks to Patrice Staudt - added finnish translation; thanks to Rolf Ahrenberg @@ -18,10 +36,10 @@ VDR Plugin 'extrecmenu' Revision History 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 + international version are welcome, you have 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' +- thanks to vejoun from vdr-portal.de for the script 'dvdarchive.sh' 2006-03-17: Version 0.6a - fixed problem with open directories @@ -5,7 +5,8 @@ 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 +copyright information. The script 'dvdarchive.sh' is provided by vejoun from +vdr-portal.de Description ------------------------------------------------------------------------------- @@ -16,26 +17,28 @@ configurable. The plugin also handles archive dvd's of VDR recordings 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. +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 at the base -directory of the /video-directory-hierarchy. 'Ok' opens sub-directories, with -'Yellow' you can create new dirs. 'Blue' moves the recording to the selected -directory +Moving: 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. 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. +than one recording to a dvd. +Now you can delete the video data files (001.vdr, 002.vdr, ...) from your hard +disc. Leave the index.vdr and info.vdr at the dir. index.vdr is needed if you +want the length of the recording displayed. You can also use 'getlength' from +the tools/-directory to create a length.vdr, containing the length of the +recording. If you do this, you can also delete index.vdr. +Create a new file dvd.vdr, that contains the identifier of the dvd. If you now +call the plugin and select such a recording entry you are asked to insert this +dvd. It will be mounted by the plugin and the replay starts from the dvd. After +replay ends, the dvd is unmountet instantly. Installation ------------------------------------------------------------------------------- @@ -48,7 +51,7 @@ 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 +variable MOUNTPOINT to the mount point of your dvd device is it is defined in /etc/fstab. Check the options at the setup menu of the plugin. They are self-explaining. diff --git a/extrecmenu.c b/extrecmenu.c index 58ea7e7..622042b 100644 --- a/extrecmenu.c +++ b/extrecmenu.c @@ -98,7 +98,10 @@ bool cPluginExtrecmenu::SetupParse(const char *Name, const char *Value) if(!strcasecmp(Name,"ShowDvdNr")) mysetup.ShowDvdNr=atoi(Value); else - return false; + if(!strcasecmp(Name,"ShowNewRecs")) + mysetup.ShowNewRecs=atoi(Value); + else + return false; return true; } diff --git a/extrecmenu.h b/extrecmenu.h index 78bf1d6..af0f89b 100644 --- a/extrecmenu.h +++ b/extrecmenu.h @@ -1,6 +1,6 @@ #include <vdr/plugin.h> -static const char *VERSION = "0.7"; +static const char *VERSION = "0.8"; static const char *DESCRIPTION = "Extended recordings menu"; static const char *MAINMENUENTRY = "ExtRecMenu"; @@ -181,7 +181,7 @@ const tI18nPhrase Phrases[] = { "", "", "", - "Menu Enregistrement étandu invisible", + "Menu Enregistrement étandu invisible", "", "Piilota valinta päävalikosta", }, @@ -195,15 +195,15 @@ const tI18nPhrase Phrases[] = { "", "Korvaa alkuperäinen 'Tallenteet'-valikko", }, - { "Show alternative new marker", - "Alternativen Neu-Marker anzeigen", + { "Show alternative to new marker", + "Alternative zu Neu-Marker anzeigen", + "", + "", "", "", "", "", - "Afficher les nouveaux symbole", "", - "Näytä vaihtoehtoinen uuden tallenteen merkintä", }, { "Show alternative dvd marker", "Alternativen DVD-Marker anzeigen", @@ -261,9 +261,9 @@ const tI18nPhrase Phrases[] = { "", "", "", + "Impossible de trouver le script 'dvdarchive.sh'!", "", - "", - "", + "'dvdarchive.sh'-skriptiä ei löydetä!", }, { "[base dir]", "[Stammverzeichnis]", @@ -271,6 +271,36 @@ const tI18nPhrase Phrases[] = { "", "", "", + "[rép. parent]", + "", + "[juurihakemisto]", + }, + { "No DVD in drive!", + "Keine DVD im Laufwerk!", + "", + "", + "", + "", + "", + "", + "", + }, + { "Error while linking [0-9]*.vdr!", + "Fehler beim Anlegen der Symlinks [0-9]*.vdr!", + "", + "", + "", + "", + "", + "", + "", + }, + { "Show \"new recordings column\"", + "\"Neue-Aufzeichnungen-Spalte\" anzeigen", + "", + "", + "", + "", "", "", "", diff --git a/mymenurecordings.c b/mymenurecordings.c index 20cef70..0ad32e9 100644 --- a/mymenurecordings.c +++ b/mymenurecordings.c @@ -63,31 +63,40 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) struct tm tm_r; struct tm *t=localtime_r(&Recording->start,&tm_r); - 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 RecLength[21]; char *indexfilename; // recording length asprintf(&indexfilename,"%s/index.vdr",filename); - int delta=0; - int hasindex=!access(indexfilename,R_OK); - if(hasindex) + 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) { - delta=buf.st_size%sizeof(tIndex); - if(delta) - delta=sizeof(tIndex)-delta; - last=(buf.st_size+delta)/sizeof(tIndex)+1; - char hour[2],min[3]; - snprintf(RecLength,sizeof(RecLength),"%s",*IndexToHMSF(last,true)); - snprintf(hour,sizeof(hour),"%c",RecLength[0]); - snprintf(min,sizeof(min),"%c%c",RecLength[2],RecLength[3]); - snprintf(RecLength,sizeof(RecLength),"%d'",(atoi(hour)*60)+atoi(min)); + 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); // dvdarchive-patch functionality @@ -109,8 +118,16 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) } free(indexfilename); - char New[2]={(mysetup.PatchNew?char(250):'*'),0}; - char Dvd[2]={(mysetup.PatchDvd?char(251):'~'),0}; + char RecDate[9],RecTime[6],RecDelimiter[2]={'\t',0}; + char New[2]={0,0}; + if(isdvd) + New[0]=mysetup.PatchDvd?char(129):'~'; + else + if(isnew&&!mysetup.PatchNew) + New[0]='*'; + else + if(!isnew&&mysetup.PatchNew) + New[0]=char(128); snprintf(RecDate,sizeof(RecDate),"%02d.%02d.%02d",t->tm_mday,t->tm_mon+1,t->tm_year%100); snprintf(RecTime,sizeof(RecTime),"%02d:%02d",t->tm_hour,t->tm_min); @@ -119,9 +136,9 @@ myMenuRecordingsItem::myMenuRecordingsItem(cRecording *Recording,int Level) (mysetup.ShowRecDate?RecDelimiter:""), // tab (mysetup.ShowRecTime?RecTime:""), // show recording time? (mysetup.ShowRecTime?RecDelimiter:""), // tab - ((hasindex&&mysetup.ShowRecLength)?RecLength:""), // show recording length? + ((haslength&&mysetup.ShowRecLength)?RecLength:""), // show recording length? (mysetup.ShowRecLength?RecDelimiter:""), // tab - (isdvd?Dvd:(isnew?New:"")), // dvd/new marker + New, // dvd/new marker (mysetup.ShowDvdNr?dvdnr:""), // show dvd nummber ((isdvd&&mysetup.ShowDvdNr)?" ":""), // space for fancy looking s?s+1:Recording->Name()); // recording name @@ -150,7 +167,11 @@ void myMenuRecordingsItem::IncrementCounter(bool IsNew) newentries++; char *buffer=NULL; - asprintf(&buffer,"%d\t%d\t%s",totalentries,newentries,name); + if(mysetup.ShowNewRecs) + asprintf(&buffer,"%d\t%d\t%s",totalentries,newentries,name); + else + asprintf(&buffer,"%d\t%s",totalentries,name); + SetText(buffer,false); } @@ -197,9 +218,19 @@ myMenuRecordings::myMenuRecordings(const char *Base,int Level):cOsdMenu(Base?Bas if(mysetup.wasdvd) { char *cmd; - asprintf(&cmd,"dvdarchive.sh umount '%s'",myReplayControl::LastReplayed()); - SystemExec(cmd); + asprintf(&cmd,"dvdarchive.sh umount \"%s\"",myReplayControl::LastReplayed()); + isyslog("[extrecmenu] calling %s to unmount dvd",cmd); + int result=SystemExec(cmd); + if(result) + { + result=result/256; + if(result==1) + Skins.Message(mtError,tr("Error while mounting DVD!")); + } + isyslog("[extrecmenu] dvdarchive.sh returns %d",result); free(cmd); + + mysetup.wasdvd=false; } Open(); } @@ -403,17 +434,24 @@ eOSState myMenuRecordings::Play() free(msg); strcpy(path,recording->FileName()); name=strrchr(path,'/')+1; - asprintf(&msg,"dvdarchive.sh mount '%s' '%s'",path,name); // call the dvdarchive.sh script + asprintf(&msg,"dvdarchive.sh mount \"%s\" \"%s\"",path,name); // call the dvdarchive.sh script + isyslog("[extrecmenu] calling %s to mount dvd",msg); int result=SystemExec(msg); + isyslog("[extrecmenu] dvdarchive.sh returns %d",result); free(msg); if(result) { - if(result==256) + result=result/256; + if(result==1) Skins.Message(mtError,tr("Error while mounting DVD!")); - if(result==512) + if(result==2) + Skins.Message(mtError,tr("No DVD in drive!")); + if(result==3) Skins.Message(mtError,tr("Recording not found on DVD!")); - if(result==32512) + if(result==4) + Skins.Message(mtError,tr("Error while linking [0-9]*.vdr!")); + if(result==127) Skins.Message(mtError,tr("Script 'dvdarchive.sh' not found!")); return osContinue; } diff --git a/mymenurecordings.h b/mymenurecordings.h index 795c48c..ebbf644 100644 --- a/mymenurecordings.h +++ b/mymenurecordings.h @@ -53,6 +53,7 @@ class myMenuRecordings:public cOsdMenu class myMenuRenameRecording:public cOsdMenu { private: + int priority,lifetime; char name[MaxFileName]; char path[MaxFileName]; cRecording *recording; diff --git a/mymenurenamerecording.c b/mymenurenamerecording.c index 5259f3d..646813e 100644 --- a/mymenurenamerecording.c +++ b/mymenurenamerecording.c @@ -12,6 +12,8 @@ myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordings *MenuRecordings):cOsdMenu(tr("Rename recording"),12) { recording=Recording; + priority=recording->priority; + lifetime=recording->lifetime; menurecordings=MenuRecordings; char *p=strrchr(recording->Name(),'~'); @@ -30,13 +32,15 @@ myMenuRenameRecording::myMenuRenameRecording(cRecording *Recording,myMenuRecordi strn0cpy(path,"",sizeof(path)); } Add(new cMenuEditStrItem(tr("Name"),name,sizeof(name),tr(FileNameChars))); - cRemote::Put(kRight); + Add(new cMenuEditIntItem(tr("Priority"),&priority,0,MAXPRIORITY)); + Add(new cMenuEditIntItem(tr("Lifetime"),&lifetime,0,MAXLIFETIME)); +// cRemote::Put(kRight); } eOSState myMenuRenameRecording::ProcessKey(eKeys Key) { eOSState state=cOsdMenu::ProcessKey(Key); - if(state==osContinue) + if(state==osUnknown) // ==osContinue) { if(Key==kOk) { @@ -48,7 +52,18 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) else asprintf(&buffer,"%s",name); - asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); +// asprintf(&newfilename,"%s/%s/%s",VideoDirectory,ExchangeChars(buffer,true),strrchr(recording->FileName(),'/')+1); + struct tm tm_r; + struct tm *t=localtime_r(&recording->start, &tm_r); + asprintf(&newfilename,"%s/%s/%d-%02d-%02d.%02d.%02d.%02d.%02d.rec", + VideoDirectory, + ExchangeChars(buffer,true), + t->tm_year+1900, + t->tm_mon+1, + t->tm_mday, + t->tm_hour, + t->tm_min, + priority,lifetime); if(MoveVideoFile(recording,newfilename)) { @@ -63,8 +78,8 @@ eOSState myMenuRenameRecording::ProcessKey(eKeys Key) free(buffer); free(newfilename); } - if(Key==kBack) - return osBack; +// if(Key==kBack) +// return osBack; } return state; } diff --git a/mymenusetup.c b/mymenusetup.c index 0d038ed..2a3cc18 100644 --- a/mymenusetup.c +++ b/mymenusetup.c @@ -12,15 +12,17 @@ myMenuSetup::myMenuSetup() showrectime=mysetup.ShowRecTime; showreclength=mysetup.ShowRecLength; showdvdnr=mysetup.ShowDvdNr; + shownewrecs=mysetup.ShowNewRecs; 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 \"new recordings column\""),&shownewrecs)); + Add(new cMenuEditBoolItem(tr("Show alternative to new marker"),&patchnew)); Add(new cMenuEditBoolItem(tr("Show alternative dvd marker"),&patchdvd)); Add(new cMenuEditBoolItem(tr("Show dvd number"),&showdvdnr)); + Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&hidemainmenuentry)); + Add(new cMenuEditBoolItem(tr("Replace original recordings menu"),&replaceorgrecmenu)); } void myMenuSetup::Store() @@ -33,4 +35,5 @@ void myMenuSetup::Store() SetupStore("ShowRecDate",mysetup.ShowRecDate=showrecdate); SetupStore("ShowRecTime",mysetup.ShowRecTime=showrectime); SetupStore("ShowRecLength",mysetup.ShowRecLength=showreclength); + SetupStore("ShowNewRecs",mysetup.ShowNewRecs=shownewrecs); } diff --git a/mymenusetup.h b/mymenusetup.h index 138df76..bd6f1a1 100644 --- a/mymenusetup.h +++ b/mymenusetup.h @@ -11,6 +11,7 @@ class mySetup int PatchNew; int PatchDvd; int ShowDvdNr; + int ShowNewRecs; bool wasdvd; // needed for dvdarchive-patch functionality }; @@ -27,6 +28,7 @@ class myMenuSetup:public cMenuSetupPage int patchnew; int patchdvd; int showdvdnr; + int shownewrecs; protected: virtual void Store(); public: diff --git a/patchfont.c b/patchfont.c index 320e036..4f2ad2a 100644 --- a/patchfont.c +++ b/patchfont.c @@ -29,70 +29,65 @@ void PatchFont(eDvbFont DvbFont) font_data[i*num_rows+1] = char_data->height; // new marker - if(num_char==250&&mysetup.PatchNew) + if(num_char==128&&mysetup.PatchNew) { if(DvbFont==fontOsd) { - font_data[i*num_rows+ 0]=16; + font_data[i*num_rows+ 0]=22; 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; // .......#####.... + 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; // .. .... #### #### #### .... + font_data[i*num_rows+ 9]=0x01f0f8; // .. ...# #### .... #### #... + font_data[i*num_rows+10]=0x01c03c; // .. ...# ##.. .... ..## ##.. + font_data[i*num_rows+11]=0x03c01c; // .. ..## ##.. .... ...# ##.. + font_data[i*num_rows+12]=0x03801c; // .. ..## #... .... ...# ##.. + font_data[i*num_rows+13]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+14]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+15]=0x1ff00e; // .#.#### #### .... .... ###. + font_data[i*num_rows+16]=0x0fe00e; // .. #### ###. .... .... ###. + font_data[i*num_rows+17]=0x07c00e; // .. .### ##.. .... .... ###. + font_data[i*num_rows+18]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+19]=0x01001c; // .. ...# .... .... ...# ##.. + font_data[i*num_rows+20]=0x00001c; // .. .... .... .... ...# ##.. + font_data[i*num_rows+21]=0x00003c; // .. .... .... .... ..## ##.. + font_data[i*num_rows+22]=0x0000f8; // .. .... .... .... #### #... + 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]=16; + 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]=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; // .......#####.... + 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; // .. .... #### #### #### .... + font_data[i*num_rows+ 6]=0x01f0f8; // .. ...# #### .... #### #... + font_data[i*num_rows+ 7]=0x01c03c; // .. ...# ##.. .... ..## ##.. + font_data[i*num_rows+ 8]=0x03c01c; // .. ..## ##.. .... ...# ##.. + font_data[i*num_rows+ 9]=0x03801c; // .. ..## #... .... ...# ##.. + font_data[i*num_rows+10]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+11]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+12]=0x1ff00e; // .#.#### #### .... .... ###. + font_data[i*num_rows+13]=0x0fe00e; // .. #### ###. .... .... ###. + font_data[i*num_rows+14]=0x07c00e; // .. .### ##.. .... .... ###. + font_data[i*num_rows+15]=0x03800e; // .. ..## #... .... .... ###. + font_data[i*num_rows+16]=0x01001c; // .. ...# .... .... ...# ##.. + font_data[i*num_rows+17]=0x00001c; // .. .... .... .... ...# ##.. + font_data[i*num_rows+18]=0x00003c; // .. .... .... .... ..## ##.. + font_data[i*num_rows+19]=0x0000f8; // .. .... .... .... #### #... + 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 - else if(num_char==251&&mysetup.PatchDvd) + else if(num_char==129&&mysetup.PatchDvd) { if(DvbFont==fontOsd) { diff --git a/scripts/dvdarchive.sh b/scripts/dvdarchive.sh index 70770ce..dfdee0a 100755 --- a/scripts/dvdarchive.sh +++ b/scripts/dvdarchive.sh @@ -1,49 +1,90 @@ #!/bin/bash +# +# Version 1.1 2006-03-27 +# +# Exitcodes: +# +# exit 0 - no error +# exit 1 - mount/umount error +# exit 2 - no dvd in drive +# exit 3 - wrong dvd in drive / recording not found +# exit 4 - error while linking [0-9]*.vdr +# +# Errorhandling/Symlinking: vejoun@vdr-portal +# +# For dvd-in-drive detection download isodetect.c, compile it and put it into the PATH, +# usually /usr/local/bin/ +# + +#<Configuration> MOUNTCMD="/usr/bin/sudo /bin/mount" UMOUNTCMD="/usr/bin/sudo /bin/umount" MOUNTPOINT="/media/cdrom" # no trailing '/'! -PATH="$2" +#</Configuration> + +DEVICE="$(grep "$MOUNTPOINT" /etc/fstab | head -n1 | awk '{ print $1; }')" # dvd-device, used by isodetect if exists + +REC="$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 + # check if dvd is in drive, only if isodetect exists + if [ -n "$(which isodetect)" -a -n "$DEVICE" ]; then + isodetect -d "$DEVICE" >/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "no dvd in drive" exit 2 fi - else - exit 1 - fi - ;; -umount) - $MOUNTCMD | /bin/grep "$MOUNTPOINT" > /dev/null - if [ $? -eq 0 ] - then - # umount dvd - $UMOUNTCMD "$MOUNTPOINT" + fi + # check if not mounted + $MOUNTCMD | grep "$MOUNTPOINT" >/dev/null && { echo "dvd already mounted"; exit 1; } + # mount dvd + $MOUNTCMD "$MOUNTPOINT" || { echo "dvd mount error"; exit 1; } + # is mounted? + # find recording on dvd + DIR="$(find "${MOUNTPOINT}/" -name "$NAME")" + # if not found, umount + if [ -z "$DIR" ]; then + $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } + echo "wrong dvd in drive / recording not found on dvd" + exit 3 + fi + # link index.vdr if not exist + if [ ! -e "${REC}/index.vdr" ]; then + cp -s "${DIR}/index.vdr" "${REC}/" + fi + # link [0-9]*.vdr files + cp -s "${DIR}/"[0-9]*.vdr "${REC}/" + # error while linking [0-9]*.vdr files? + if [ $? -ne 0 ]; then + # umount dvd bevor unlinking + $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } # unlink broken links - for LINK in "${PATH}/"*.vdr; do + for LINK in "${REC}/"*.vdr; do if [ -L "$LINK" -a ! -s "$LINK" ]; then - /bin/rm "$LINK" + rm "$LINK" fi done + echo "error while linking [0-9]*.vdr" + exit 4 fi ;; +umount) + # check if dvd is mounted + $MOUNTCMD | grep "$MOUNTPOINT" >/dev/null || { echo "dvd not mounted"; exit 1; } + # is mounted? + # umount dvd bevor unlinking + $UMOUNTCMD "$MOUNTPOINT" || { echo "dvd umount error"; exit 1; } + # unlink broken links + for LINK in "${REC}/"*.vdr; do + if [ -L "$LINK" -a ! -s "$LINK" ]; then + rm "$LINK" + fi + done + ;; esac + +exit 0 diff --git a/scripts/dvdarchive.sh.old b/scripts/dvdarchive.sh.old deleted file mode 100755 index ffe1737..0000000 --- a/scripts/dvdarchive.sh.old +++ /dev/null @@ -1,37 +0,0 @@ -#!/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 @@ -7,6 +7,7 @@ bool MoveVideoFile(cRecording *Recording,char *NewName) if(!strcmp(Recording->FileName(),NewName)) return true; + isyslog("[extrecmenu] moving file %s to %s",Recording->FileName(),NewName); int result=MakeDirs(NewName); if(result) { @@ -19,5 +20,6 @@ bool MoveVideoFile(cRecording *Recording,char *NewName) return true; } } + isyslog("[extrecmenu] moving failed"); return false; } diff --git a/tools/getlength.c b/tools/getlength.c new file mode 100644 index 0000000..946e01c --- /dev/null +++ b/tools/getlength.c @@ -0,0 +1,68 @@ +/* + * getlength - a small tool to get the length of a VDR recording by the size + * of the file index.vdr + * + * (c) by Martin Prochnow + * Distributed under the terms of the GPL v2.0 (see COPYING at the root dir of + * this archive). + * + * Compile with: gcc getlength.c -o getlength + * + * Usage: 'getlength' if index.vdr is in the current working directory or + 'getlength /PATH/TO/RECDIR/' else + */ + +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <errno.h> + +int main(int argc,char **argv) +{ + char *filename; + int hasindex,length; + struct stat status; + FILE *out; + + switch(argc) + { + case 1: asprintf(&filename,"./index.vdr");break; + case 2: asprintf(&filename,"%s/index.vdr",argv[1]);break; + default: fprintf(stderr,"Usage:\ngetlength [PATH/TO/index.vdr]\n");exit(-1); + } + + hasindex=!access(filename,R_OK); + if(hasindex) + { + stat(filename,&status); + length=status.st_size/12000; // calculate length if the recording by the size of index.vdr + + free(filename); + switch(argc) + { + case 1: asprintf(&filename,"./length.vdr");break; + case 2: asprintf(&filename,"%s/length.vdr",argv[1]);break; + } + if((out=fopen(filename,"w"))!=NULL) + { + fprintf(out,"%d\n",length); + fclose(out); + } + else + { + perror("Error while open length.vdr"); + free(filename); + exit(-1); + } + } + else + { + perror("Error while accessing index.vdr"); + free(filename); + exit(-1); + } + + free(filename); + return 0; +} diff --git a/tools/isodetect.c b/tools/isodetect.c new file mode 100644 index 0000000..25c4c68 --- /dev/null +++ b/tools/isodetect.c @@ -0,0 +1,150 @@ +/* + isodetect.c + + gcc -O2 -Wall isodetect.c -o isodetect + + Looks in first block of an block-device and checks if there is an ISO9660- + filesystem on it. This is done by checking for a string "CD001". + + Also reads certain information out of the block. + + 14.11.95 T.Niederreiter (based on cdlabel.c by aeb) +*/ + +#include <stdio.h> +#include <ctype.h> +#include <unistd.h> +#include <fcntl.h> +#include <termio.h> + +char buf[1024]; +char devname[80]; + +void printnsp(int begin, int end, char *txt); +void printchar(unsigned char c); + +main(int argc, char **argv) { +FILE * infile; +int c; +int id=0; + + /* Default device to check */ + strcpy(devname,"/dev/cdrom"); + + while ((c = getopt (argc,argv,"hVpPAd:")) != EOF) { + switch(c) { + case 0: + break; + + case 'V': + id=1; + break; + + case 'p': + id=2; + break; + + case 'P': + id=3; + break; + + case 'A': + id=4; + break; + + case 'd': + strcpy(devname,optarg); + break; + + case 'h': + printf("Usage: %s [OPTIONS]\n",argv[0]); + printf("\ + -h show help (this text)\n\ + -V print VOLUME_ID of ISO9660-Image\n\ + -p print PREPARER_ID of ISO9660-Image\n\ + -P print PUBLISHER_ID of ISO9660-Image\n\ + -A print APPLICATION_ID of ISO9660-Image\n\ + -d <device>\n"); + + exit(1); + } + } + + infile = fopen(devname, "rb"); + + if (infile == NULL) { + perror(devname); + exit(1); + } + + if (lseek(fileno(infile), 32768, SEEK_SET) < 0) { + perror("lseek"); + exit(1); + } + + if (read(fileno(infile), buf, sizeof(buf)) != sizeof(buf)) { + perror("read"); + exit(1); + } + + if (strncmp(buf, "\001CD001\001", 8) != 0) { + if (id==0) { + printf("Not ISO9660\n"); + exit(0); + } + } + else { + switch(id) { + case 0: + printf("ISO9660\n"); + exit(0); + break; + + case 1: + printnsp(40,72,"Volume_ID"); /* 32 */ + break; + + case 3: + printnsp(318,446,"Publisher"); /* 128 */ + break; + + case 2: + printnsp(446,574,"Preparer"); /* 128 */ + break; + + case 4: + printnsp(574,702,"Application"); /* 128 */ + break; + } + } + exit(0); +} + +int empty(char c) { + return (c == 0 || c == ' '); +} + +void printnsp(int begin, int end, char *txt) { +int i,j,k; + + for(i=begin; i<end; i++) { + if (empty(buf[i])) + continue; + for(j=i+1; j<end; j++) + if (!buf[j] || (j < end-1 + && empty(buf[j]) && empty(buf[j+1]))) break; + for(k=i; k<j; k++) + printchar(buf[k]); + printf("\n"); + i = j; + } +} + +void printchar(unsigned char c) { + if (isprint(c) || isspace(c)) + putchar(c); + else + printf("\\%03o", c); +} + + |