summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranbr <vdr07@deltab.de>2010-12-26 17:24:16 (GMT)
committeranbr <vdr07@deltab.de>2010-12-26 17:24:16 (GMT)
commitc1d1893712af186e2c5c1c2e9ce87d28b346f85a (patch)
tree3e0a3b08c94441dda089614efc41f7bb46a2bc1f
parentfa36276705a42018cb1432b2485e090abdc045e0 (diff)
downloadvdr-plugin-dvdswitch-c1d1893712af186e2c5c1c2e9ce87d28b346f85a.tar.gz
vdr-plugin-dvdswitch-c1d1893712af186e2c5c1c2e9ce87d28b346f85a.tar.bz2
Read name of volume to fill OSD with filename
-rw-r--r--Makefile5
-rw-r--r--commands.c27
-rw-r--r--po/de_DE.po25
-rw-r--r--po/fr_FR.po33
-rw-r--r--volname.c53
-rw-r--r--volname.h19
6 files changed, 114 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index a552d3d..8429425 100644
--- a/Makefile
+++ b/Makefile
@@ -49,8 +49,9 @@ DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
### The object files (add further files here):
-OBJS = $(PLUGIN).o helpers.o tools.o imagelist-item.o imagelist.o dvdlist-item.o \
- dvdlist.o dvdplugin.o menu-item.o menu.o setup.o setup-itypes.o commands.o
+OBJS = $(PLUGIN).o helpers.o tools.o imagelist-item.o imagelist.o \
+ dvdlist-item.o dvdlist.o dvdplugin.o menu-item.o menu.o setup.o \
+ setup-itypes.o commands.o volname.o
### Implicit rules:
diff --git a/commands.c b/commands.c
index 347d3c5..d617f71 100644
--- a/commands.c
+++ b/commands.c
@@ -7,7 +7,7 @@
#include "menu-item.h"
#include "dvdplugin.h"
#include "setup-itypes.h"
-
+#include "volname.h"
// --- cCMD ----------------------------------------------------------
eOSState cCMD::Play(cMainMenuItem *item)
@@ -686,7 +686,7 @@ eOSState cCMDImage::Burn(const char *file)
{
esyslog("dvdswitch: Can't execute script to write dvd");
DELETENULL(info);
- OsdMsg(mtError,tr("Cannot execute Writescript!"));
+ OsdMsg(mtError,tr("Can't execute Writescript!"));
return osContinue;
}
@@ -712,33 +712,34 @@ cCMDImageRead::cCMDImageRead(cImageList &imagelist)
{
dsyslog("dvdswitch: Read DVD Image");
- cFileInfo *info = new cFileInfo(DVDSwitchSetup.DVDReadScript);
+ cFileInfo info(DVDSwitchSetup.DVDReadScript);
- if(!info->isExists())
+ if(!info.isExists())
{
esyslog("dvdswitch: Missing script to read dvd");
- DELETENULL(info);
OsdMsg(mtError,tr("Specified Readscript not exist!"));
cRemote::Put(kBack);
}
- else if(!info->isExecutable())
+ else if(!info.isExecutable())
{
esyslog("dvdswitch: Can't execute script to write dvd");
- DELETENULL(info);
- OsdMsg(mtError,tr("Cannot execute Readscript!"));
+ OsdMsg(mtError,tr("Can't execute Readscript!"));
cRemote::Put(kBack);
}
else
{
- DELETENULL(info);
- strcpy(File, "\0");
+ int err = volname(DVDSwitchSetup.DVDLinkOrg, File,sizeof(File));
+ if(0 != err) {
+ OSDErrorNumMsg(err, tr("Can't query name of volume!"));
+ strcpy(File, "\0");
+ }
strcpy(Dir, "\0");
strcpy(ImgTypeTxt, "\0");
ImgType = -1;
- Add(new cMenuEditStrItem(tr("Name:"), File, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
- Add(new cMenuEditStrItem(tr("Directory:"), Dir, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
- Add(new cMenuEditStrItem(tr("Imagetype:"), ImgTypeTxt, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
+ Add(new cMenuEditStrItem(tr("Name"), File, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
+ Add(new cMenuEditStrItem(tr("Directory"), Dir, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
+ Add(new cMenuEditStrItem(tr("Imagetype"), ImgTypeTxt, MaxFileName, tr(" abcdefghijklmnopqrstuvwxyz0123456789-_.#~")));
SetHelp();
Display();
diff --git a/po/de_DE.po b/po/de_DE.po
index bdfe6de..2baeeb9 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-dvdswitch-plugin 0.1.6\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-12-23 20:45+0100\n"
+"POT-Creation-Date: 2010-12-26 17:07+0100\n"
"PO-Revision-Date: 2009-10-03 14:03+0200\n"
"Last-Translator:\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -101,7 +101,7 @@ msgstr "Einfügen"
msgid "Specified Writescript not exist!"
msgstr "Angegebenes Writescript existiert nicht!"
-msgid "Cannot execute Writescript!"
+msgid "Can't execute Writescript!"
msgstr "Kann Writescript nicht ausführen!"
msgid "Burn Now?"
@@ -113,17 +113,20 @@ msgstr "Lies DVD"
msgid "Specified Readscript not exist!"
msgstr "Angegebenes Readscript existiert nicht!"
-msgid "Cannot execute Readscript!"
+msgid "Can't execute Readscript!"
msgstr "Kann Readscript nicht ausführen!"
-msgid "Name:"
-msgstr "Name:"
+msgid "Can't query name of volume!"
+msgstr "Konnte Name des Volume nicht abfragen"
-msgid "Directory:"
-msgstr "Verzeichnis:"
+msgid "Name"
+msgstr "Name"
-msgid "Imagetype:"
-msgstr "ImageTyp:"
+msgid "Directory"
+msgstr "Verzeichnis"
+
+msgid "Imagetype"
+msgstr "ImageTyp"
msgid "read in"
msgstr "Einlesen"
@@ -152,9 +155,6 @@ msgstr "DVD Plugin nicht gefunden! Funktion deaktiviert!"
msgid "Directory with 'VIDEO_TS' Folder"
msgstr "Verzeichnis mit 'VIDEO_TS' Ordner"
-msgid "Directory"
-msgstr "Verzeichnis"
-
msgid "File with '.iso' Extension"
msgstr "Datei mit '.iso' Extension"
@@ -403,3 +403,4 @@ msgstr "Operation fehlgeschlagen"
msgid "No rights to move image"
msgstr "Keine Berechtigung zum Verschieben des Images"
+
diff --git a/po/fr_FR.po b/po/fr_FR.po
index 429c776..26b1246 100644
--- a/po/fr_FR.po
+++ b/po/fr_FR.po
@@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-dvdswitch-plugin 0.1.6\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2010-12-23 20:45+0100\n"
+"POT-Creation-Date: 2010-12-26 17:07+0100\n"
"PO-Revision-Date: 2010-12-21 12:59+0100\n"
"Last-Translator: Nicolas Huillard <nhuillard@e-dition.fr>\n"
"Language-Team: <vdr@linuxtv.org>\n"
@@ -73,15 +73,12 @@ msgstr "Editer le dossier"
msgid "No rights to change inside this directory!"
msgstr ""
-#, fuzzy
msgid "Really delete?"
msgstr "Vraiment effacer?"
-#, fuzzy
msgid "Directory not empty! However delete?"
msgstr "Le dossier n'est pas vide. L'effacer quand même?"
-#, fuzzy
msgid "Missing rights to create directory!"
msgstr "pas d'autorisation de création"
@@ -94,7 +91,6 @@ msgstr " aàbcçdeéèfghijklmnopqrstuvwxyz0123456789-.#~"
msgid "Directory exists"
msgstr "Le dossier existe déjà"
-#, fuzzy
msgid "Missing rights to rename!"
msgstr "pas d'autorisation d'écriture"
@@ -110,7 +106,7 @@ msgstr "Introduire"
msgid "Specified Writescript not exist!"
msgstr "Le Writescript indiqué n'existe pas!"
-msgid "Cannot execute Writescript!"
+msgid "Can't execute Writescript!"
msgstr "Le Writescript ne peut pas être effectué!"
msgid "Burn Now?"
@@ -122,17 +118,20 @@ msgstr "Lire le DVD"
msgid "Specified Readscript not exist!"
msgstr "Le Readscript indiqué n'existe pas!"
-msgid "Cannot execute Readscript!"
+msgid "Can't execute Readscript!"
msgstr "Le Readscript ne peut pas être effectué!"
-msgid "Name:"
-msgstr "Nom:"
+msgid "Can't query name of volume!"
+msgstr ""
+
+msgid "Name"
+msgstr "Nom"
-msgid "Directory:"
-msgstr "Dossier:"
+msgid "Directory"
+msgstr "Dossier"
-msgid "Imagetype:"
-msgstr "Type d'image:"
+msgid "Imagetype"
+msgstr "Type d'image"
msgid "read in"
msgstr "Lire"
@@ -161,9 +160,6 @@ msgstr "Le DVD plugin n'est pas disponible! La fonction est déactivée!"
msgid "Directory with 'VIDEO_TS' Folder"
msgstr "Dossier avec dossier 'VIDEO_TS'"
-msgid "Directory"
-msgstr "Dossier"
-
msgid "File with '.iso' Extension"
msgstr "Fichier avec extension '.iso'"
@@ -182,7 +178,6 @@ msgstr "Changer"
msgid "File exists in Directory"
msgstr "Le fichier existe déjà dans le dossier"
-#, fuzzy
msgid "without category"
msgstr "sans catégorie"
@@ -405,16 +400,12 @@ msgstr "Le dossier 'contient' ne peut pas être vide!"
msgid "'File Extension' must not empty!"
msgstr "'Le suffix de ficher' ne doit pas être vide!"
-#, fuzzy
msgid "No rights to delete image"
msgstr "pas d'autorisation de création"
msgid "Operation failed"
msgstr ""
-#, fuzzy
msgid "No rights to move image"
msgstr "pas d'autorisation de création"
-#~ msgid "no Rights!"
-#~ msgstr "pas d'autorisation!"
diff --git a/volname.c b/volname.c
new file mode 100644
index 0000000..a8de754
--- /dev/null
+++ b/volname.c
@@ -0,0 +1,53 @@
+/*
+ * dvdswitch plugin for VDR (C++)
+ *
+ * (C) 2010 Andreas Brachold <vdr07 AT deltab de>
+ *
+ * This dvdswitch plugin is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, version 2 of the License.
+ *
+ * See the files README and COPYING for details.
+ *
+ */
+
+#include <unistd.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+int volname(const char* device, char* volname, size_t volsize)
+{
+ int fd;
+ int status;
+ char buffer[PATH_MAX];
+
+ if(!realpath(device, buffer)) {
+ return errno;
+ }
+
+ fd = open(device, O_RDONLY);
+ if (fd == -1) {
+ return errno;
+ }
+
+ status = lseek(fd, 32808, SEEK_SET);
+ if (status == -1) {
+ status = errno;
+ close(fd);
+ return status;
+ }
+
+ status = read(fd, volname, volsize > 32 ? 32 : volsize);
+ if (status == -1) {
+ status = errno;
+ close(fd);
+ return status;
+ }
+
+ close(fd);
+ return 0;
+}
diff --git a/volname.h b/volname.h
new file mode 100644
index 0000000..01d81b1
--- /dev/null
+++ b/volname.h
@@ -0,0 +1,19 @@
+/*
+ * dvdswitch plugin for VDR (C++)
+ *
+ * (C) 2010 Andreas Brachold <vdr07 AT deltab de>
+ *
+ * This dvdswitch plugin is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation, version 2 of the License.
+ *
+ * See the files README and COPYING for details.
+ *
+ */
+
+#ifndef __VOLNAME_DVDSWITCH_H
+#define __VOLNAME_DVDSWITCH_H
+
+int volname(const char* device, char* volname, size_t volsize);
+
+#endif // __VOLNAME_DVDSWITCH_H