summaryrefslogtreecommitdiff
path: root/contrib/getlength.c
diff options
context:
space:
mode:
authorMartin Prochnow <nordlicht@martins-kabuff.de>2006-04-11 19:12:01 +0200
committerAndreas Mair <andreas@vdr-developer.org>2006-04-11 19:12:01 +0200
commit82bfd4c15949019ede37b2b04be79659c5c65dbe (patch)
tree5deb5bf0d98cbee6c5ee17bb9323d0748ed567a7 /contrib/getlength.c
parentc849f2898257df19fddb97ac99c392c410f120d1 (diff)
downloadvdr-plugin-extrecmenu-82bfd4c15949019ede37b2b04be79659c5c65dbe.tar.gz
vdr-plugin-extrecmenu-82bfd4c15949019ede37b2b04be79659c5c65dbe.tar.bz2
Version 0.9v0.9
- removed myDvbPlayer, use VDR's cDvbPlayer instead - made adjustments to work with BigPatch-VDRs (JumpPlay-patch) - added option for sort recordings - moved editing of priority and lifetime to its own submenu - removed option to select alternative dvd marker, the icon is now default - added default values for setup options - moved content of patches/ and tools/ to contrib/ and added a small README - new version of 'dvdarchive.sh'; thanks to vejoun from vdr-portal.de - fixed problem with archive dvd recordings at the base dir; thanks to Mase from vdr-portal.de for reporting
Diffstat (limited to 'contrib/getlength.c')
-rw-r--r--contrib/getlength.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/contrib/getlength.c b/contrib/getlength.c
new file mode 100644
index 0000000..946e01c
--- /dev/null
+++ b/contrib/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;
+}