summaryrefslogtreecommitdiffstats
path: root/abs/core/linhes-scripts/shootscreens.sh
blob: bb45252655a64fdecf10c3e6a824e377fdc5d394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash

# Written by Bob Igo from the MythTV Store at http://MythiC.TV
# Email: bob@stormlogic.com
#
# If you run into problems with this script, please send me email

# This code generates screenshots (cover files) for all videos in
# MythTV's videometadata table that do not have covers associated with them.

if [ "$1" == "1" ]; then
    OSD=1
    . /etc/osd_cat.cfg || {
        color=yellow
        outline=2
        outlinecolour=black
        shadow=0
        shadowcolour=black
        font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*"
    }
else
    OSD=0
fi

> /tmp/shooter.log
{
    percentage=0
    # Change IFS to be a newline so that filenames with spaces will be handled properly.
    IFS=$'\n'
    vidcount=`mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\";" | wc -l`
    increment=$(expr 100 / $vidcount)
    for vid in `mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\";" | grep -v -e "^filename$"`
    do
    	if [ $OSD == 1 ]; then
            osd_cat --barmode=percentage --percentage=$percentage --pos=middle --align=center --text="Generating Video Thumbnails..." --delay=0 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
            percentage=$(expr $percentage + $increment)
        fi
        screenshooter.sh -v $vid
    done
    if [ $OSD == 1 ]; then
        killall -9 osd_cat
        osd_cat --barmode=percentage --percentage=100 --pos=middle --align=center --text="Video Thumbnails Generated!" --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
    fi
}