Overview
Is your channel known for random YouTube URLs in mid conversation?
Have you ever wished that these people actually tell what the video is about before you go there and
find out that the subject doesn't interest you? This little feature is for you!
12:51 * IceDragon watches http://www.youtube.com/watch?v=-xEzGIuY7kw
12:51 <@StarWolf> YouTube> IceDragon: http://www.youtube.com/watch?v=-xEzGIuY7kw - "Weird Al" Yankovic - White & Nerdy
As you can see, the bot automatically detects a YouTube link in speech or action, retrieves the video
title from YouTube for the link in question, then displays it in the channel so everybody knows what
the video is most likely about from the title. This can save you spare travels to YouTube in order to
figure out what was that video - the title would tell you more about it and help you decide on whether
you want to check it out or disregard it.
The service is available for any channel interested on the
QuickFox IRC network.
Configuration
The script allows a relatively easy way to tune certain things - the configuration for that can be
found in the youtube.tcl file under the Configuration comment. Here is a brief overview
on what each variable there does:
-
sys_debug - Enables or disables debug mode. Debug mode merely shows some more information
on the terminal or the bot's logfile. It is there to help obtain more information on a failure and
assist in solving it. Default value is 0 (off).
-
debug_target - You can change the destination where the debug messages will be sent. If the
setting is on {}, it will use the bot logfile and the terminal. Otherwise, it will use an IRC channel
or nickname(s) specified and send debug information there. To use multiple nicknames, comma-separate
them (i.e.: variable debug_target {IceDragon,Ash-Fox}). Default value is {} (log/terminal).
-
max_polls - The bot can form multiple requests at a given time in order to fetch the titles
faster in case of multiple URLs. This setting would limit how many requests at a given time can the
bot send. It is good to set it to something like 3 in order to avoid hammering youtube servers or
the bot itself. If a youtube URL comes through and the maximal amount of requests was already reached,
no further requests will be made until the results for the running ones are obtained. This effectively
prevents floods as well. Default value is 3. To disable this functionality, set it to 0, but be
careful!
-
poll_timeout - In case and a response from the youtube server doesn't come back in a specific
amount of seconds, the bot should abandon the request and allow new requests to be sent - requests
which might actually succeed. This setting is there to set the timeout - how many seconds should the
bot wait before giving up on a request. Default value is 15 and no, 0 doesn't disable it!
-
cache_timeout - In case and the youtube URL brought up in several channels or repeated in a
short while, the bot will be able to provide the channel with a video title without the need to
request it again from youtube. This saves time and bandwith, as well as making the bot more
responsive. This settings controls how many minutes should a URL be remembered like that. Default
value is 5.
-
cmd - This setting controls what the youtube support toggling command will be like. That
command should be said in the channel by an operator to enable, disable, or check the state of
youtube announcements support. Default value is "!youtube".
-
op_ctrl - This settings determines whether to let channel operator use the !youtube command
in the channel to enable or disable support, or only allow the bot administrator to use it. The
shutdown subcommand will only be available to bot admins still, as it affects the bot and
all the channels it supports, rather than a specific channel in particular. Default value is 1
(allow chanop access).
Other variables and values in the script should not be touched unless you really know what you are
doing. To stay on the safe side, it's best to make a backup of the script in its working state
before any source-level modifications are done to it.
Control and Commands
The service can be controlled with just the !youtube command (modifiable). That command can
be used by channel operators and/or bot masters (depending on the op_ctrl setting) to enable or
disable youtube announcements in that specific channel. By default, the support is disabled, but
if unsure, you can simply type !youtube and the bot will show the current state.
These are all the available commands, accessible through !youtube:
- !youtube - shows the state of the youtube announcement system for the current channel.
- !youtube on - enables youtube announcement system for the channel this was said in.
- !youtube off - disables youtube announcement system for the channel this was said in.
-
!youtube shutdown - shuts down the announcement system and self-removes the script components
from the bot's memory. This command is limited to bot masters regardless of the op_ctrl setting.
Please note that shutting the script down is not enough! In order to prevent its reactivation, you
must make sure that the youtube script will not load again when you rehash the bot! Failure to do
so will re-activate the script as soon as you rehash the bot and it will be active once again.