eggdrop-xmltv – Eggdrop script for XMLTV

eggdrop-xmltv is an eggdrop script written in TCL for eggdrop bots which gives the bot the ability to display whats currently on TV. It uses data from XML files conforming to the DTD XMLTV which is “standard” way of expressing TV listings and associated information.
eggdrop-xmltv should work with ANY TV listing that conforms to the XMLTV DTD. It does it involve itself in how you obtain the data, just feed it with a set of XML files (and keep them up-to-date) and eggdrop-xmltv will happily make your bot know whats on TV.
I’ve had this script running since 2006 (and, as of 2009, still counting) together with a daily updated XML file without any major problems.

Obtaining eggdrop-xmltv

1.1.2 – 20060531
eggdrop-xmltv-1.1.2.tar.gz

Old releases are available for archive and history purposes.

Release history

1.1.2 – 20060531
* The alarm function broke somewhere around the 1.1 release.
1.1.1 – 20060524
* Encoding were not done properly resulting in unicode output to IRC
(testing was preformed with a client capable of both encodings so the bug slipped through).
1.1 – 20060523
* Added per source setting for output encoding.
* Timezone information from XMLTV sources are now obeyed, contributed by Florian Demmer
* Channel name matching has been improved, now regexps can be fully used
to match channel names.* Prefix date on !trigger and !trigger next if needed
* Tcl error [::tv::privparse]: can’t read “olist”: no such variable error when no channels matched on !trigger next.
* Gives an error message when the source is out of date instead of just beeing silent.
* Wildcards was enabled for triggers (ie. * would result in the first configured source).
* !trigger info sent notice to the whole channel instead of private.
* Strings were sometimes not converted properly between local encoding and UTF-8.
* Improved option parsing to !trigger search to make it less error prone.
* Other minor bug and style fixes, improved help text.
1.0 – 20060319
* Initial release

Requirements

  • Eggdrop/TCL, you’ll need TCL with threads enabled as tDOM require this
  • tDOM, http://www.tdom.org/
  • XML files with your TV listing in XMLTV format

Configuration

Configuration is quite easy.
Just unpack it into your scripts/ directory and add the source-line to your bot configuration.
Then there are a few settings that needs to be done in tv.tcl too.

set xmltv(source-name) {
        "path"      "./scripts/xmltv/tv.xml"
        "channels"  "#my_channel"
        "privmsg"  	1
        "trigger"   "!tv"
        "tvchans"   "channel1 channel2"
        "encoding"  "iso8859-1"
    }

source-name should be set to a unique identifier for this source.
channels specifies in which channels this source is allowed, separate multiple channels with a space.
privmsg should be set to either 0 or 1 depending on if you want to allow access via private message.
trigger is the prefix for this source.
tvchans specifies the default TV channels.
encoding specifies the text encoding to be used for text sent to IRC.

Usage/example

!trigger help will give you a list of commands.

Example

<XXX> !tv
<YYY> svt1: 22:10 Dysselecksi - blind, blåst och bortgjord, svt2: 22:05 BAM,
      tv4: 22:00 TV4Nyheterna och vädret
<XXX> !tv next
<YYY> svt1: 22:40 Resan till Mars, svt2: 23:20 Existens, tv4: 22:15 For the money
<XXX> !tv discovery_channel,kanal_5
<YYY> discovery_channel: 22:00 Smash Lab, kanal_5: 22:00 En callgirls dagbok
<XXX> !tv next discovery_channel,kanal_5
<YYY> discovery_channel: 23:00 Syna bluffen, kanal_5: 22:30 CSI
<XXX> !tv list tv4_guld
<YYY> 22:05: Twin Peaks
<YYY> 22:55: Baywatch
<YYY> 23:40: Baywatch
<YYY> 00:25: Riket
<YYY> 01:35: Dallas
<XXX> !tv find CSI
<YYY> kanal_5: 22:30-23:25 CSI

The following commands are available

!tv [chan1,chan2,...] [time]
Displays whats currently on given channels. Your preferred channels will be used if available, otherwise the default channels are shown.

!tv next [chan1,chan2,...] [time]
Displays the next program for given channels. Your preferred channels will be used if available.

!tv chanlist
List of channels available from this source.

!tv list <chan> [day/month|now] [length]
List chart for channel <chan>. Optional starting date and chart length.

!tv info <chan> <time>
Displays verbose information about the program on channel <chan> at the time <time>.

!tv set <chan1> <chan2> <…>
Set your preferred channels. If you don’t specify any channels a list of your currently preferred channels are returned.

!tv unset
Reset your prefered channels to default.

!tv alarm set <chan> <time>
Set a reminder for program starting at time <time> on channel <chan>. You will be alerted before the program starts.

!tv alarm
Returns a list of your currently active reminders

!tv alarm unset <nr>
Removes a previously set reminder.

!tv search [chan=<chan1,chan2,..>] [category=cat1,cat2,...] [desc=yes|no] [title=yes|no] [after=<time>] [before=<time>] keywords …

Search the chart for a specific program.

Obtaining a XMLTV file

If you don’t want to create one yourself, the XMLTV project has several “grabbers” for different countries which you can use. Just keep your XML files updated, eggdrop-xmltv will re-parse the file(s) when it detects a change.

Comments are closed.