Thanks to your help I could make it work.
Create the two following files :
/usr/local/bin/postprocess.sh:
#!/bin/bash
DURATION=$(ffprobe -loglevel quiet -show_entries format=duration -of default=nokey=1:noprint_wrappers=1 "$1")
MIDDLE=$(bc -l <<< "$DURATION*0.5")
POSTER_PATH="${1%%.*}.jpg"
ffmpeg -y -ss $MIDDLE -skip_frame nokey -noaccurate_seek -i "$1" -frames:v 1 -q:v 2 "$POSTER_PATH"
tvhmeta --uuid "$2" --artwork-url "file://$POSTER_PATH" --fanart-url "" --debug --user YOUR_USERNAME --password YOUR_PASSWORD
/usr/local/bin/postremove.sh:
#!/bin/bash
rm -f "${1%%.*}.jpg"
echo "Removing recording image ${1%%.*}.jpg"
REC_PATH="${1%/*}"
REC_BASE="${REC_PATH##*/}"
while [[ $REC_BASE != 'recordings' && -n $REC_BASE && -d $REC_PATH && -z $( ls -A "$REC_PATH" ) ]]; do
rm -rf "$REC_PATH"
REC_PATH="${REC_PATH%/*}"
REC_BASE="${REC_PATH##*/}";
done;
Make sure tvheadend has the rights to execute both scripts.
Plain authentication needs to be enabled in Configuration > General > Authentication type: "Both plain and digest".
Add the scripts to the recording profile: Configuration > Recording > Default profile:
Post-processor comand: /usr/local/bin/postprocess.sh "%f" "%U"
Post-remove command: /usr/local/bin/postremove.sh "%f"
Kodi now shows recordings with thumbnails:
