MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Functions | Variables
wunderground.pl File Reference

Go to the source code of this file.

Functions

use POSIX qw (strftime)
use Env qw (HOME MYTHCONFDIR)
 our ($opt_v, $opt_t, $opt_T, $opt_l, $opt_u, $opt_d, $opt_D)
 if (defined $MYTHCONFDIR)
 if ((!defined $MYTHCONFDIR)||($conffile &&!-f $conffile))
 if (!-f $conffile)
 binmode (STDOUT,":utf8")
 if (!-d $logdir)
 getopts ('Tvtlu:d:')
 if (!(defined $opt_u &&defined $loc &&!$loc eq""))
 log_print ($logdir,"-u $units -d $dir $loc\n")
foreach my $hashref (@{$forecast})
for my $attr (sort keys%attrib)

Variables

use strict
use warnings
use utf8
use JSON
my $name = 'wunderground'
my $version = 0.2
my $author = 'Gavin Hurlbut'
my $email = 'gjhurlbu@gmail.com'
my $updateTimeout = 15*60
my $retrieveTimeout = 30
my types
my $dir = "/tmp/wunderground"
my $logdir = "/tmp/wunderground"
my images
my $conffile
open IF
chomp $apikey
my $rawloc = shift
my $loc = uri_escape($rawloc)
my attrib
my $units = $opt_u
my $base_url = "http://api.wunderground.com/api/$apikey/geolookup/forecast10day/q/"
my $file = $loc
my $hash
my $location = location($hash->{'location'})
my $now = time
my $forecast = $hash->{'forecast'}->{'simpleforecast'}->{'forecastday'}
my $day = 0
my $time = 0
 exit

Function Documentation

use POSIX qw ( strftime  )
use Env qw ( HOME  MYTHCONFDIR)
our (   $opt_v,
  $opt_t,
  $opt_T,
  $opt_l,
  $opt_u,
  $opt_d,
  $opt_D 
)
if ( defined  $MYTHCONFDIR)

Definition at line 43 of file wunderground.pl.

if ( (!defined $MYTHCONFDIR)||($conffile &&!-f $conffile)  )

Definition at line 47 of file wunderground.pl.

if ( !-f  $conffile)

Definition at line 51 of file wunderground.pl.

binmode ( STDOUT  ,
":utf8"   
)
if ( !-d  $logdir)

Definition at line 66 of file wunderground.pl.

getopts ( 'Tvtlu:d:'  )
if ( defined $opt_u &&defined $loc &&!$loc eq"")

Definition at line 121 of file wunderground.pl.

log_print (   $logdir,
"-u $units -d $dir $loc\n  
)
foreach my $hashref ( )

Definition at line 165 of file wunderground.pl.

for my $attr ( sort keys%  attrib)

Definition at line 189 of file wunderground.pl.

Variable Documentation

use strict

Definition at line 4 of file wunderground.pl.

use warnings

Definition at line 5 of file wunderground.pl.

use encoding utf8

Definition at line 7 of file wunderground.pl.

use JSON

Definition at line 14 of file wunderground.pl.

Definition at line 19 of file wunderground.pl.

my $version = 0.2

Definition at line 20 of file wunderground.pl.

my $author = 'Gavin Hurlbut'

Definition at line 21 of file wunderground.pl.

my $email = 'gjhurlbu@gmail.com'

Definition at line 22 of file wunderground.pl.

my $updateTimeout = 15*60

Definition at line 23 of file wunderground.pl.

my $retrieveTimeout = 30

Definition at line 24 of file wunderground.pl.

my types
Initial value:
( '3dlocation', '6dlocation', 'cclocation', 'copyright',
'date-0', 'date-1', 'date-2', 'date-3', 'date-4', 'date-5',
'high-0', 'high-1', 'high-2', 'high-3', 'high-4', 'high-5',
'low-0', 'low-1', 'low-2', 'low-3', 'low-4', 'low-5',
'icon-0', 'icon-1', 'icon-2', 'icon-3', 'icon-4', 'icon-5',
'observation_time', 'updatetime', 'station_id', 'copyrightlogo' )

Definition at line 25 of file wunderground.pl.

my $dir = "/tmp/wunderground"

Definition at line 31 of file wunderground.pl.

my $logdir = "/tmp/wunderground"

Definition at line 32 of file wunderground.pl.

my images
Initial value:
( "clear" => "fair.png", "cloudy" => "cloudy.png",
"flurries" => "flurries.png", "fog" => "fog.png",
"hazy" => "fog.png", "mostlycloudy" => "mcloudy.png",
"mostlysunny" => "pcloudy.png", "partlycloudy" => "pcloudy.png",
"partlysunny" => "mcloudy.png", "rain" => "showers.png",
"sleet" => "rainsnow.png", "snow" => "flurries.png",
"sunny" => "sunny.png", "tstorms" => "thunshowers.png",
"unknown" => "unknown.png" )

Definition at line 33 of file wunderground.pl.

my $conffile

Definition at line 41 of file wunderground.pl.

open<",$conffileordie"Couldn'tread$conffile:$!\n";my$apikey=<IF> close IF

Definition at line 59 of file wunderground.pl.

chomp $apikey

Definition at line 62 of file wunderground.pl.

my $rawloc = shift

Definition at line 119 of file wunderground.pl.

my $loc = uri_escape($rawloc)

Definition at line 120 of file wunderground.pl.

my attrib

Definition at line 125 of file wunderground.pl.

my $units = $opt_u

Definition at line 126 of file wunderground.pl.

my $base_url = "http://api.wunderground.com/api/$apikey/geolookup/forecast10day/q/"

Definition at line 130 of file wunderground.pl.

my $file = $loc

Definition at line 132 of file wunderground.pl.

my $hash
Initial value:
getCachedJSON($base_url . $loc . ".json", $dir, $file . ".json",

Definition at line 134 of file wunderground.pl.

my $location = location($hash->{'location'})

Definition at line 139 of file wunderground.pl.

my $now = time

Definition at line 147 of file wunderground.pl.

my $forecast = $hash->{'forecast'}->{'simpleforecast'}->{'forecastday'}

Definition at line 152 of file wunderground.pl.

Referenced by $hashref().

my $day = 0

Definition at line 156 of file wunderground.pl.

my $time = 0

Definition at line 157 of file wunderground.pl.

exit

Definition at line 192 of file wunderground.pl.