Ticket #5922: mythfilldatabase_cleanup.sh

File mythfilldatabase_cleanup.sh, 1.3 KB (added by ikke@…, 17 years ago)

script getting xmltv data and removing rerun marks

Line 
1#! /bin/sh
2# gets xmltv stuff from net and removes the Uusinta.* to get re-run
3# marking working. There is 7 days offset, since finnish epg data is
4# for 7 days and epg is more accurate in timings.
5
6FETCH_PROGRAMS=0
7FILL_DB=0
8
9for PARAM
10do
11 case "$PARAM" in
12 --feed)
13 FEED_DB=1
14 ;;
15 --nofeed)
16 FEED_DB=0
17 ;;
18 --fetch)
19 FETCH_PROGRAMS=1
20 ;;
21 --nofetch)
22 FETCH_PROGRAMS=0
23 ;;
24 *)
25 echo "Invalid parameters!"
26 exit 1;
27 ;;
28 esac
29done
30
31mkdir /tmp/channels
32
33if [ "${FETCH_PROGRAMS}" = 1 ]
34then
35 /usr/bin/tv_grab_fi --quiet --config-file /stuff/videot/mythtv/.mythtv/HTV-telkku.xmltv --offset 7 --output /tmp/channels/xmltv_channels.tmp
36 if [ "$?" != 0 ]
37 then
38 echo "Program list grabbing failed!"
39 exit 1;
40 fi
41fi
42
43sed -e '/\<desc lang=.*\>/,/\<\/desc\>/s/\ Uusinta[a-zA-Z ]*\.//' \
44 -e '/\<desc lang=.*\>/,/\<\/desc\>/s/\([uU]\)$//' \
45 -e '/\<desc lang=.*\>/,/\<\/desc\>/s/\ [a-zA-Z ]*\ sarja\.//' \
46 /tmp/channels/xmltv_channels.tmp > /tmp/channels/xmltv_channels.tmp2
47
48if [ "${FEED_DB}" = 1 ]
49then
50 mythfilldatabase --file 1 /tmp/channels/xmltv_channels.tmp2 --update
51fi