C't-VDR - Hooks
Hulk (Diskussion | Beiträge) (→Aufnahmen Schreibrechte zuweisen) |
Hulk (Diskussion | Beiträge) K (→recording-hooks) |
||
Zeile 13: | Zeile 13: | ||
=recording-hooks= | =recording-hooks= | ||
Recording Hooks befinden sich meistens in dem Verzeichnis | Recording Hooks befinden sich meistens in dem Verzeichnis | ||
− | /usr/share/ | + | /usr/share/vdr/recording-hooks |
− | oder | + | oder in der devel-Version unter |
− | /usr/share/ | + | /usr/share/vdrdevel/recording-hooks |
Beschreibung: | Beschreibung: | ||
− | This is a custom Recording Action Hook. It gets called by | + | This is a custom Recording Action Hook. It gets called by vdr |
before a recording starts, after a recording ended and after a | before a recording starts, after a recording ended and after a | ||
− | recording has been edited. It is maintained as a config file in the | + | recording has been edited. It is maintained as a config file in the vdr |
package. All other recording hooks get executed before this one! | package. All other recording hooks get executed before this one! | ||
If you want to create your own recording hook that may get executed | If you want to create your own recording hook that may get executed | ||
− | before any other hook, create it in /usr/share/ | + | before any other hook, create it in /usr/share/vdr/recording-hooks or |
link to this location. All hooks are called in their alphabetical | link to this location. All hooks are called in their alphabetical | ||
order and should follow this naming scheme: | order and should follow this naming scheme: |
Version vom 18. April 2009, 08:39 Uhr
Hooks sind kleine Scripte, die das VDR Hauptprogramm bei einer bestimmten Aktion aufruft. Die einzelnen Hooks werden ähnlich wie die Init-Prozesse in verschiedenen Verzeichnissen gespeichert und alphabetisch aufgerufen. Die Namen beginnen allerdings immer mit einer zweistelligen Zahl, sodass die Reihenfolge immer festliegt.
Es gibt drei Arten von Hooks:
- command-hooks
- recording-hooks
- shutdown-hooks
Inhaltsverzeichnis |
command-hooks
Beispiele
recording-hooks
Recording Hooks befinden sich meistens in dem Verzeichnis
/usr/share/vdr/recording-hooks
oder in der devel-Version unter
/usr/share/vdrdevel/recording-hooks
Beschreibung:
This is a custom Recording Action Hook. It gets called by vdr before a recording starts, after a recording ended and after a recording has been edited. It is maintained as a config file in the vdr package. All other recording hooks get executed before this one!
If you want to create your own recording hook that may get executed before any other hook, create it in /usr/share/vdr/recording-hooks or link to this location. All hooks are called in their alphabetical order and should follow this naming scheme:
R<XX>.<identifier>
Where <XX> is a two digit number, that mainly specifies the execution order and <identifier> is a unique descriptor.
Two parameters are passed:
Parameter 1 can have the values "before", "after" and "edited", depending on whether the recording hook is called before the recording starts, after the recording ends or after the recording has been edited.
Parameter 2 is the directory of the recording. Be aware, that this directory doesn't exist before the recording starts.
case $1 in before) # do here what ever you would like to do right BEFORE # the recording $2 STARTS ;; after) # do here what ever you would like to do right AFTER # the recording $2 ENDED ;; edited) # do here what ever you would like to do right AFTER # the recording $2 has been EDITED ;; esac
Beispiele
Aufnahmen Schreibrechte zuweisen
Dieses kleine Script gibt dem kompletten Aufnahmeverzeichnis Schreibrechte
# # Vergibt Schreibrechte der Gruppe # ---------------------------------- case $1 in after) chmod -R g+w $2/.. ;; esac
Anmerkung: Ab der VDR-Version 1.3.28 kann die gleiche Funktionalität mit der shell-Definition per umask erreicht werden. In älteren Versionen des VDR legt beim Öffnen der Dateien explizit die Zugriffsrechte fest und ignoriert somit die umask Einstellung. Dieses Script stellt damit für diese ältere Versionen eine Alternative zum Verändern des Quelltextes dar.
shutdown-hooks
Here you can place any commands, you want to be executed when VDR wants to shutdown.
- To abort the shutdown, exit with an errorlevel <> 0.
- If you want a message to be displayed on the OSD when aborting a shutdown, then write to stdout:
ABORT_MESSAGE=<message to display>
- If you want to defer the shutdown, write to stdout:
TRY_AGAIN=<minutes to wait before next shutdown request>
- To overwrite the command that will be executed to shutdown the machine after all shutdown hooks have been processed, write to stdout:
SHUTDOWNCMD=<new shutdown command>
i.e.:
echo "ABORT_MESSAGE=\"I do not want to shutdown now!\"" ; exit 1
Beispiele
IMAP Mail
Dieses kleine Script hält den Shutdown Prozess an, falls noch Imap Sessions geöffnet sind. Alternativ können auch andere Prozesse überprüft werden.