Twitter recording status

From MythTV Official Wiki
Revision as of 17:42, 29 April 2009 by Iamlindoro (talk | contribs)

Jump to: navigation, search

It's fairly simple to set up a user job to send out recording status updates via Twitter. Paste the following code into a file (for example,

use LWP::UserAgent;
my $output = shift @ARGV;
my $browser = LWP::UserAgent->new;
my $url = '';
$browser->credentials('', 'Twitter API', 'username', 'password');
$response = $browser->get("");
my $response = $browser->post($url, {status => $output});

Edit the username and password to match your twitter user and password. Save the file, make it executable, and put it somewhere in your path. In this example we'll put the file in /usr/bin.

chmod +x
cp /usr/bin/

Stop your backend and run mythtv-setup. In step 1, General, you must adjust two options. First, you must allow the new user job to be run on this backend. For example, if your new User Job is the first one, tick the "Allow User Job #1 on this backend." On the User Job setup page, give your job a name, such as "Post-record Twitter." Then you can use something like the following command line:

/usr/bin/ "Finished recording %TITLE% (%SUBTITLE%) on %CHANID% at %ENDTIMEISO%.  Backend was %HOSTNAME%."

You can insert information as you wish, using any of the variables from User Jobs. Complete the setup and you will now have a user job which you can set to run at the end of individual or all recording rules. you can now edit your recording rules and set the user job to run at the end of each recording to update your twitter status.