line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GBPVR::CDBI::RecordingSchedule; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
23952
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
65
|
|
4
|
2
|
|
|
2
|
|
14
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
102
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use base 'GBPVR::CDBI'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
757
|
|
9
|
|
|
|
|
|
|
use GBPVR::CDBI::PlaybackPosition; |
10
|
|
|
|
|
|
|
use GBPVR::CDBI::VideoArchive::ArchiveTable; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->table('recording_schedule'); |
13
|
|
|
|
|
|
|
__PACKAGE__->columns(Primary => qw/oid/ ); |
14
|
|
|
|
|
|
|
__PACKAGE__->columns(All => qw/ |
15
|
|
|
|
|
|
|
oid |
16
|
|
|
|
|
|
|
programme_oid |
17
|
|
|
|
|
|
|
capture_source_oid |
18
|
|
|
|
|
|
|
filename |
19
|
|
|
|
|
|
|
status |
20
|
|
|
|
|
|
|
recording_type |
21
|
|
|
|
|
|
|
recording_group |
22
|
|
|
|
|
|
|
manual_start_time |
23
|
|
|
|
|
|
|
manual_end_time |
24
|
|
|
|
|
|
|
manual_channel_oid |
25
|
|
|
|
|
|
|
quality_level |
26
|
|
|
|
|
|
|
pre_pad_minutes |
27
|
|
|
|
|
|
|
post_pad_minutes |
28
|
|
|
|
|
|
|
/, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub parse_manual_time { |
32
|
|
|
|
|
|
|
my $self = shift; |
33
|
|
|
|
|
|
|
my $time = shift; |
34
|
|
|
|
|
|
|
return unless $time =~ /^(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)$/; |
35
|
|
|
|
|
|
|
return ($1, $2, $3, $4, $5, $6); # (Y,M,D, H,M,S) |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub start_time { |
39
|
|
|
|
|
|
|
my $self = shift; |
40
|
|
|
|
|
|
|
my $time = $self->manual_start_time or return; |
41
|
|
|
|
|
|
|
return sprintf( "%02d:%02d", ($self->parse_manual_time($time))[3,4] ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub end_time { |
45
|
|
|
|
|
|
|
my $self = shift; |
46
|
|
|
|
|
|
|
my $time = $self->manual_end_time or return; |
47
|
|
|
|
|
|
|
return sprintf( "%02d:%02d", ($self->parse_manual_time($time))[3,4] ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub start_date { |
51
|
|
|
|
|
|
|
my $self = shift; |
52
|
|
|
|
|
|
|
my $time = $self->manual_start_time or return; |
53
|
|
|
|
|
|
|
return sprintf( "%04d-%02d-%02d", ($self->parse_manual_time($time))[0,1,2] ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub end_date { |
57
|
|
|
|
|
|
|
my $self = shift; |
58
|
|
|
|
|
|
|
my $time = $self->manual_end_time or return; |
59
|
|
|
|
|
|
|
return sprintf( "%04d-%02d-%02d", ($self->parse_manual_time($time))[0,1,2] ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__PACKAGE__->has_a( programme_oid => 'GBPVR::CDBI::Programme'); |
63
|
|
|
|
|
|
|
__PACKAGE__->has_a( capture_source_oid => 'GBPVR::CDBI::CaptureSource'); |
64
|
|
|
|
|
|
|
__PACKAGE__->has_a( manual_channel_oid => 'GBPVR::CDBI::Channel'); |
65
|
|
|
|
|
|
|
__PACKAGE__->columns(Stringify => qw/ programme_oid / ); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub last_position { |
68
|
|
|
|
|
|
|
my $obj = shift; |
69
|
|
|
|
|
|
|
my ($pp) = GBPVR::CDBI::PlaybackPosition->search( filename => $obj->filename ); |
70
|
|
|
|
|
|
|
if( @_ ){ |
71
|
|
|
|
|
|
|
my $pos = shift; |
72
|
|
|
|
|
|
|
if( $pp ){ |
73
|
|
|
|
|
|
|
$pp->last_position( $pos); |
74
|
|
|
|
|
|
|
$pp->update; |
75
|
|
|
|
|
|
|
}else{ |
76
|
|
|
|
|
|
|
$pp = GBPVR::CDBI::PlaybackPosition->create({ filename => $obj->filename, last_position => $pos }); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
return $pp ? $pp->last_position : undef; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub archivetable { |
83
|
|
|
|
|
|
|
my $obj = shift; |
84
|
|
|
|
|
|
|
return unless $obj->programme_oid; |
85
|
|
|
|
|
|
|
my ($at) = GBPVR::CDBI::VideoArchive::ArchiveTable->search( UniqueID => $obj->programme_oid->unique_identifier ); |
86
|
|
|
|
|
|
|
return $at; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub status_string { |
90
|
|
|
|
|
|
|
my $obj = shift; |
91
|
|
|
|
|
|
|
my %mapping = ( |
92
|
|
|
|
|
|
|
0 => 'Pending', |
93
|
|
|
|
|
|
|
2 => 'Completed', |
94
|
|
|
|
|
|
|
3 => 'Number3', |
95
|
|
|
|
|
|
|
4 => 'Number4', |
96
|
|
|
|
|
|
|
); |
97
|
|
|
|
|
|
|
return $mapping{ $obj->status }; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
103
|
|
|
|
|
|
|
__END__ |