Permalink
Browse files

Finished renamespacing

  • Loading branch information...
1 parent 705df81 commit 8afcd0a13984c7bb2e54bbff49bb0e1c5ece0c53 James Laver committed Mar 11, 2010
View
@@ -1,4 +1,4 @@
-package Options;
+package gip::Options;
use Env qw[@PATH];
use Fcntl;
@@ -210,7 +210,7 @@ sub usage {
# Add all the options into supplied hash from specified class
-# Usage: Options->get_class_options( 'Programme:tv' );
+# Usage: Options->get_class_options( 'gip::Programme:tv' );
sub get_class_options {
shift;
my $classname = shift;
View
@@ -1,4 +1,4 @@
-package Pvr;
+package gip::PVR;
use Env qw[@PATH];
use Fcntl;
@@ -39,7 +39,7 @@ sub opt_format {
# Constructor
-# Usage: $pvr = Pvr->new();
+# Usage: $pvr = gip::PVR->new();
sub new {
my $type = shift;
my %params = @_;
@@ -48,27 +48,27 @@ sub new {
$self->{$_} = $params{$_};
}
## Ensure the subclass $opt var is pointing to the Superclass global optref
- $opt = $Pvr::optref;
- $opt_file = $Pvr::opt_fileref;
- $opt_cmdline = $Pvr::opt_cmdlineref;
+ $opt = $gip::PVR::optref;
+ $opt_file = $gip::PVR::opt_fileref;
+ $opt_cmdline = $gip::PVR::opt_cmdlineref;
bless $self, $type;
}
# Use to bind a new options ref to the class global $opt_ref var
sub add_opt_object {
my $self = shift;
- $Pvr::optref = shift;
+ $gip::PVR::optref = shift;
}
# Use to bind a new options ref to the class global $opt_fileref var
sub add_opt_file_object {
my $self = shift;
- $Pvr::opt_fileref = shift;
+ $gip::PVR::opt_fileref = shift;
}
# Use to bind a new options ref to the class global $opt_cmdlineref var
sub add_opt_cmdline_object {
my $self = shift;
- $Pvr::opt_cmdlineref = shift;
+ $gip::PVR::opt_cmdlineref = shift;
}
View
@@ -1,4 +1,4 @@
-package Programme;
+package gip::Programme;
use Env qw[@PATH];
use Fcntl;
@@ -92,7 +92,7 @@ sub expiry {
# Constructor
-# Usage: $prog{$pid} = Programme->new( 'pid' => $pid, 'name' => $name, <and so on> );
+# Usage: $prog{$pid} = gip::Programme->new( 'pid' => $pid, 'name' => $name, <and so on> );
sub new {
my $type = shift;
my %params = @_;
@@ -101,17 +101,17 @@ sub new {
$self->{$_} = $params{$_};
}
## Ensure that all instances reference the same class global $optref var
- # $self->{optref} = $Programme::optref;
+ # $self->{optref} = $gip::Programme::optref;
# Ensure the subclass $opt var is pointing to the Superclass global optref
- $opt = $Programme::optref;
+ $opt = $gip::Programme::optref;
bless $self, $type;
}
# Use to bind a new options ref to the class global $optref var
sub add_opt_object {
my $self = shift;
- $Programme::optref = shift;
+ $gip::Programme::optref = shift;
}
@@ -121,7 +121,7 @@ sub opt {
my $optname = shift;
return $opt->{$optname};
- #return $Programme::optref->{$optname};
+ #return $gip::Programme::optref->{$optname};
#my $opt = $self->{optref};
#return $self->{optref}->{$optname};
}
@@ -808,7 +808,7 @@ sub generate_filenames {
$prog->{fileprefix} = $opt->{fileprefix} || $format;
# get $name, $episode from title
- my ( $name, $episode ) = Programme::bbciplayer::split_title( $prog->{title} ) if $prog->{title};
+ my ( $name, $episode ) = gip::Programme::bbciplayer::split_title( $prog->{title} ) if $prog->{title};
$prog->{name} = $name if $name && ! $prog->{name};
$prog->{episode} = $episode if $episode && ! $prog->{episode};
@@ -1,4 +1,4 @@
-package Programme::bbciplayer;
+package gip::Programme::bbciplayer;
use Env qw[@PATH];
use Fcntl;
@@ -18,7 +18,7 @@ use Time::Local;
use URI;
# Inherit from Programme class
-use base 'Programme';
+use base 'gip::Programme';
# Return hash of version => verpid given a pid
@@ -341,7 +341,7 @@ sub get_metadata {
if ( $entry =~ m{<dcterms:valid>\s*start=.+?;\s*end=(.*?);} ) {
$expiry = $1;
- $prog->{expiryrel} = Programme::get_time_string( $expiry, time() );
+ $prog->{expiryrel} = gip::Programme::get_time_string( $expiry, time() );
}
$available = $1 if $entry =~ m{<dcterms:valid>\s*start=(.+?);\s*end=.*?;};
$prog_type = $1 if $entry =~ m{medium=\"(\w+?)\"};
@@ -371,7 +371,7 @@ sub get_metadata {
}
# Use the default cache thumbnail unless --thumbsize=NNN is used where NNN is either the width or thumbnail index number
$thumbnail = $thumbnails{ $opt->{thumbsize} } if defined $opt->{thumbsize};
- ( $name, $episode ) = Programme::bbciplayer::split_title( $1 ) if $entry =~ m{<title\s+type="text">\s*(.+?)\s*<};
+ ( $name, $episode ) = gip::Programme::bbciplayer::split_title( $1 ) if $entry =~ m{<title\s+type="text">\s*(.+?)\s*<};
$channel = $1 if $entry =~ m{<media:credit\s+role="Publishing Company"\s+scheme="urn:ebu">(.+?)<};
# Get the title from the atom link refs only to determine the episode and series number
@@ -506,7 +506,7 @@ sub get_metadata {
my $epoch;
$timestring = $1 if m{<timeline:start\s+rdf:datatype=".+?">(20\d\d-\d\d-\d\dT\d\d:\d\d:\d\d([+-]\d\d:\d\d|Z))<};
next if ! $timestring;
- $epoch = Programme::get_time_string( $timestring );
+ $epoch = gip::Programme::get_time_string( $timestring );
main::logger "DEBUG: $version: $timestring -> $epoch\n" if $opt->{debug};
if ( $epoch < $first ) {
$first = $epoch;
@@ -521,8 +521,8 @@ sub get_metadata {
if ( $first < 9999999999 && $last > 0 ) {
$prog->{firstbcast}->{$version} = $first_string;
$prog->{lastbcast}->{$version} = $last_string;
- $prog->{firstbcastrel}->{$version} = Programme::get_time_string( $first_string, time() );
- $prog->{lastbcastrel}->{$version} = Programme::get_time_string( $last_string, time() );
+ $prog->{firstbcastrel}->{$version} = gip::Programme::get_time_string( $first_string, time() );
+ $prog->{lastbcastrel}->{$version} = gip::Programme::get_time_string( $last_string, time() );
}
}
@@ -574,7 +574,7 @@ sub get_metadata {
my $thumbnail_prefix = 'http://www.bbc.co.uk/iplayer/images/episode';
# Thumbnail fallback if normal short pid (i.e. not URL)
- $thumbnail = "${thumbnail_prefix}/$prog->{pid}".Programme::bbciplayer->thumb_url_suffixes->{ $thumbsize } if ! ( $thumbnail || $prog->{thumbnail} ) && $prog->{pid} !~ /^http/;
+ $thumbnail = "${thumbnail_prefix}/$prog->{pid}".gip::Programme::bbciplayer->thumb_url_suffixes->{ $thumbsize } if ! ( $thumbnail || $prog->{thumbnail} ) && $prog->{pid} !~ /^http/;
# Fill in from cache if not got from metadata
$prog->{name} = $name || $prog->{name};
@@ -1277,7 +1277,7 @@ sub get_stream_data {
# Do iphone redirect check regardless of an xml entry for iphone (except for EMP/Live) - sometimes the iphone streams exist regardless
# Skip check if the modelist selected excludes iphone
if ( $prog->{pid} !~ /^http/i && $verpid !~ /^\?/ && $verpid !~ /^http:/ && grep /^iphone/, split ',', $prog->modelist() ) {
- if ( my $streamurl = Streamer::iphone->get_url($ua, $prog->{pid}) ) {
+ if ( my $streamurl = gip::Streamer::iphone->get_url($ua, $prog->{pid}) ) {
my $mode = 'iphone1';
if ( $prog->{type} eq 'radio' ) {
$data->{$mode}->{bitrate} = 128;
View
@@ -1,4 +1,4 @@
-package Programme::bbclive;
+package gip::Programme::bbclive;
use Env qw[@PATH];
use Fcntl;
@@ -18,7 +18,7 @@ use Time::Local;
use URI;
# Inherit from Programme class
-use base 'Programme::bbciplayer';
+use base 'gip::Programme::bbciplayer';
# Class vars
sub file_prefix_format { '<name> <episode> <dldate> <dltime>' }
@@ -55,13 +55,13 @@ sub clean_pid {
-# Usage: Programme::liveradio->get_links( \%prog, 'liveradio' );
+# Usage: gip::Programme::liveradio->get_links( \%prog, 'liveradio' );
# Uses: %{ channels() }, \%prog
sub get_links {
shift; # ignore obj ref
my $prog = shift;
my $prog_type = shift;
- # Hack to get correct 'channels' method because this methods is being shared with Programme::radio
+ # Hack to get correct 'channels' method because this methods is being shared with gip::Programme::radio
my %channels = %{ main::progclass($prog_type)->channels_filtered( main::progclass($prog_type)->channels() ) };
for ( sort keys %channels ) {
@@ -96,7 +96,7 @@ sub get_links {
sub download {
- # Delegate to Programme::tv (same function is used)
- return Programme::tv::download(@_);
+ # Delegate to gip::Programme::tv (same function is used)
+ return gip::Programme::tv::download(@_);
}
@@ -1,4 +1,4 @@
-package Programme::liveradio;
+package gip::Programme::liveradio;
use Env qw[@PATH];
use Fcntl;
@@ -18,7 +18,7 @@ use Time::Local;
use URI;
# Inherit from Programme class
-use base 'Programme::bbclive';
+use base 'gip::Programme::bbclive';
# Class vars
sub index_min { return 80100 }
@@ -1,4 +1,4 @@
-package Programme::livetv;
+package gip::Programme::livetv;
use Env qw[@PATH];
use Fcntl;
@@ -18,7 +18,7 @@ use Time::Local;
use URI;
# Inherit from Programme class
-use base 'Programme::bbclive';
+use base 'gip::Programme::bbclive';
# Class vars
sub index_min { return 80000 }
View
@@ -1,4 +1,4 @@
-package Programme::radio;
+package gip::Programme::radio;
use Env qw[@PATH];
use Fcntl;
@@ -18,7 +18,7 @@ use Time::Local;
use URI;
# Inherit from Programme class
-use base 'Programme::bbciplayer';
+use base 'gip::Programme::bbciplayer';
# Class vars
sub index_min { return 10001 }
@@ -79,6 +79,18 @@ sub channels {
'bbc_radio_bristol' => 'BBC Bristol',
'bbc_radio_somerset_sound' => 'BBC Somerset',
'bbc_radio_devon' => 'BBC Devon',
+ 'bbc_radio_cornwall' => 'BBC Cornwall',
+ 'bbc_radio_guernsey' => 'BBC Guernsey',
+ 'bbc_radio_jersey' => 'BBC Jersey',
+ 'popular/radio' => 'Popular',
+ 'highlights/radio' => 'Highlights',
+ };
+}
+
+
+# channel ids be found on http://www.bbc.co.uk/bbcone/programmes/schedules/today
+sub channels_schedule {
+ return {
'1xtra/programmes/schedules' => 'BBC 1Xtra',
'radio1/programmes/schedules/england' => 'BBC Radio 1 England',
'radio1/programmes/schedules/northernireland'=> 'BBC Radio 1 Northern Ireland',
@@ -144,7 +156,6 @@ sub channels {
};
}
-
# Class cmdline Options
sub opt_format {
return {
@@ -255,14 +266,14 @@ sub clean_pid {
sub get_links {
shift;
- # Delegate to Programme::tv (same function is used)
- return Programme::tv->get_links(@_);
+ # Delegate to gip::Programme::tv (same function is used)
+ return gip::Programme::tv->get_links(@_);
}
sub download {
# Delegate to Programme::tv (same function is used)
- return Programme::tv::download(@_);
+ return gip::Programme::tv::download(@_);
}
Oops, something went wrong.

0 comments on commit 8afcd0a

Please sign in to comment.