All pastes #976575 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-04-08 08:40 UTC
rendered paste body
#!/bin/sh

# (C) 2008 Michael Haas
# Licensed under the GPL Version 3

# warning: the file generated by this script cannot span multiple days.

# how many shows to generate
AMOUNT=100

# difference in minutes
DIFF=3

# xmltv channel id
XMLTV_ID="foo.de"

# your timezone
TZ="+0200"


Y=`date +%Y`
M=`date +%m`
D=`date +%d`
H=`date +%H`
MIN=`date +%M`
S="00"

echo '<?xml version="1.0" encoding="ISO-8859-1"?>'
echo '<!DOCTYPE tv SYSTEM "xmltv.dtd">'

echo '<tv generator-info-name="xmltvgen">'
echo "<channel id=\"$XMLTV_ID\">"
echo "<display-name>xmltv gen</display-name>"
echo "</channel>"


for i in `seq 1 $AMOUNT`; do
    if [ $MIN -ge 60 ]; then
        H=$((H + 1))
        MIN=$((MIN - 60))
    fi

    if [ $H -gt 23 ]; then
        echo 'Warning! Data cannot span multiple days, please adjust $AMOUNT!' > /dev/stderr
        echo "</tv>"
        exit 1
    fi

    echo "<programme start=\"${Y}${M}${D}${H}${MIN}${S} $TZ\" channel=\"$XMLTV_ID\">"
    echo "<title>xmltv gen: # $i</title>"
    echo "</programme>"
    MIN=$((MIN + DIFF))
done

echo "</tv>"