line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ex:ts=4:sw=4:sts=4:et |
2
|
|
|
|
|
|
|
package Transmission::Torrent::File; |
3
|
|
|
|
|
|
|
# See Transmission::Client for copyright statement. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Transmission::Torrent::File - file within a Transmission torrent |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
|
|
|
|
|
|
|
11
|
4
|
|
|
4
|
|
27
|
use Moose; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
28
|
|
12
|
4
|
|
|
4
|
|
28662
|
use Transmission::Types ':all'; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
21
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Transmission::AttributeRole'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 id |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$int = $self->id; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
This file index in the files list. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has id => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => 'Int', |
29
|
|
|
|
|
|
|
default => -1, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 length |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$num = $self->length; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
File size in bytes. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 name |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$str = $self->name; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 bytes_completed |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$num = $self->bytes_completed; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Bytes downloaded. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 wanted |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$bool = $self->wanted; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Flag which decides if this file will be downloaded or not. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has wanted => ( |
57
|
|
|
|
|
|
|
is => 'rw', |
58
|
|
|
|
|
|
|
isa => boolean, |
59
|
|
|
|
|
|
|
coerce => 1, |
60
|
|
|
|
|
|
|
default => 1, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 priority |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$int = $self->priority; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Low, Normal or High, with the respectable values: -1, 0 and 1. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has priority => ( |
72
|
|
|
|
|
|
|
is => 'rw', |
73
|
|
|
|
|
|
|
isa => number, |
74
|
|
|
|
|
|
|
coerce => 1, |
75
|
|
|
|
|
|
|
default => 0, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
my %read = ( |
80
|
|
|
|
|
|
|
key => string, |
81
|
|
|
|
|
|
|
length => number, |
82
|
|
|
|
|
|
|
name => string, |
83
|
|
|
|
|
|
|
bytesCompleted => number, |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
for my $camel (keys %read) { |
87
|
|
|
|
|
|
|
my $name = __PACKAGE__->_camel2Normal($camel); |
88
|
|
|
|
|
|
|
has $name => ( |
89
|
|
|
|
|
|
|
is => 'ro', |
90
|
|
|
|
|
|
|
isa => $read{$camel}, |
91
|
|
|
|
|
|
|
coerce => 1, |
92
|
|
|
|
|
|
|
writer => "_set_$name", |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 METHODS |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 BUILDARGS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$hash_ref = $class->BUILDARGS(\%args); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Convert keys in C<%args> from "CamelCase" to "camel_case". |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub BUILDARGS { |
108
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
109
|
0
|
|
|
|
|
|
my $args = $self->SUPER::BUILDARGS(@_); |
110
|
|
|
|
|
|
|
|
111
|
0
|
|
|
|
|
|
for my $camel (keys %$args) { |
112
|
0
|
|
|
|
|
|
my $key = __PACKAGE__->_camel2Normal($camel); |
113
|
0
|
|
|
|
|
|
$args->{$key} = delete $args->{$camel}; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
return $args; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 LICENSE |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
See L<Transmission::Client> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
1; |