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

Go to the source code of this file.

Functions

use lib dirname (abs_path($0 or $PROGRAM_NAME))
use Date::Calc qw (Day_of_Week)
use lib dirname ($0)
use MetOffCommon qw (:DEFAULT $apikey)
 our ($opt_v, $opt_t, $opt_T, $opt_l, $opt_u, $opt_d, $opt_D)
 binmode (STDOUT,":utf8")
 if (!-d $logdir)
 getopts ('Tvtlu:d:')
 if (defined $opt_v)
 if (!(defined $locid &&!$locid eq""))
 if (DateTime->now()->hour() >=18)
$end_date add (days=> 5)
 if ($locid=~s/^(\d *)/$1/)
 if (!$xml)
printf updatetime:: localtime ()."\n"
foreach $period (@{$xml->{DV}->{Location}->{Period}})

Variables

use strict
use warnings
use utf8
use English
use Cwd abs_path
use lib usr share mythtv
mythweather scripts 
uk_metoffice
use Switch
use DateTime
my $name = 'MetOffice-Forecast-API'
my $version = 0.3
my $author = 'Stuart Morgan'
my $email = 'smorgan@mythtv.org'
my $updateInterval = 3*60*60
my $retrieveTimeout = 30
my types
my $dir = "/tmp/uk_metoffice"
my $logdir = "/tmp/uk_metoffice"
my $units = "SI"
my $locid = shift
my $base_args = '?res=daily&key=' . $MetOffCommon::api_key
my $start_date = DateTime->now()->set_hour(0)->set_minute(0)->set_second(0)
my $end_date = $start_date->clone()
my $url = ""
die unless defined $response
my $xml = XMLin($response)
printf
copyright::$MetOffCommon::copyright_str 
n
my $location = $xml->{DV}->{Location}->{name}
my $i = 0
my $period

Function Documentation

use lib dirname ( abs_path($0 or $PROGRAM_NAME)  )
use Date::Calc qw ( Day_of_Week  )
use lib dirname (   $0)
use MetOffCommon qw ( :DEFAULT  $apikey)
our (   $opt_v,
  $opt_t,
  $opt_T,
  $opt_l,
  $opt_u,
  $opt_d,
  $opt_D 
)
binmode ( STDOUT  ,
":utf8"   
)
if ( !-d  $logdir)

Definition at line 52 of file metoffice_fivedayapi.pl.

getopts ( 'Tvtlu:d:'  )
if ( defined  $opt_v)

Definition at line 58 of file metoffice_fivedayapi.pl.

if ( defined $locid &&!$locid eq"")

Definition at line 104 of file metoffice_fivedayapi.pl.

if ( DateTime->now()->hour() >=  18)

Definition at line 114 of file metoffice_fivedayapi.pl.

$end_date add ( days  ,
 
)
if (   $locid = ~ s/^(\d*)/$1/)

Definition at line 124 of file metoffice_fivedayapi.pl.

if ( $xml)

Definition at line 139 of file metoffice_fivedayapi.pl.

printf updatetime:: localtime ( )

Referenced by localtime_r().

foreach $period ( )

Definition at line 154 of file metoffice_fivedayapi.pl.

Variable Documentation

use strict

Definition at line 4 of file metoffice_fivedayapi.pl.

use warnings

Definition at line 5 of file metoffice_fivedayapi.pl.

use encoding utf8

Definition at line 7 of file metoffice_fivedayapi.pl.

use English

Definition at line 9 of file metoffice_fivedayapi.pl.

use Cwd abs_path

Definition at line 12 of file metoffice_fivedayapi.pl.

use lib usr share mythtv mythweather scripts usr local share mythtv mythweather scripts uk_metoffice

Definition at line 14 of file metoffice_fivedayapi.pl.

use Switch

Definition at line 21 of file metoffice_fivedayapi.pl.

use DateTime
my $name = 'MetOffice-Forecast-API'

Definition at line 32 of file metoffice_fivedayapi.pl.

my $version = 0.3

Definition at line 33 of file metoffice_fivedayapi.pl.

my $author = 'Stuart Morgan'

Definition at line 34 of file metoffice_fivedayapi.pl.

my $email = 'smorgan@mythtv.org'

Definition at line 35 of file metoffice_fivedayapi.pl.

my $updateInterval = 3*60*60

Definition at line 37 of file metoffice_fivedayapi.pl.

my $retrieveTimeout = 30

Definition at line 38 of file metoffice_fivedayapi.pl.

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

Definition at line 39 of file metoffice_fivedayapi.pl.

my $dir = "/tmp/uk_metoffice"

Definition at line 47 of file metoffice_fivedayapi.pl.

my $logdir = "/tmp/uk_metoffice"

Definition at line 48 of file metoffice_fivedayapi.pl.

my $units = "SI"

Definition at line 96 of file metoffice_fivedayapi.pl.

my $locid = shift

Definition at line 101 of file metoffice_fivedayapi.pl.

$base_args = '?res=daily&key=' . $MetOffCommon::api_key

Definition at line 108 of file metoffice_fivedayapi.pl.

Referenced by if().

my $start_date = DateTime->now()->set_hour(0)->set_minute(0)->set_second(0)

Definition at line 113 of file metoffice_fivedayapi.pl.

my $end_date = $start_date->clone()

Definition at line 117 of file metoffice_fivedayapi.pl.

my $url = ""

Definition at line 122 of file metoffice_fivedayapi.pl.

Referenced by $contenturl(), and elsif().

die unless defined $response

Definition at line 134 of file metoffice_fivedayapi.pl.

my $xml = XMLin($response)

Definition at line 137 of file metoffice_fivedayapi.pl.

printf:: $location n

Definition at line 143 of file metoffice_fivedayapi.pl.

my $location = $xml->{DV}->{Location}->{name}

Definition at line 146 of file metoffice_fivedayapi.pl.

my $i = 0

Definition at line 151 of file metoffice_fivedayapi.pl.

my $period

Definition at line 152 of file metoffice_fivedayapi.pl.