Server.pm

filter: Statementstmt 77.7% 7 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 83.3% 10 / 12 CC 1 SCAR 0.9
CC
1
Cov
78%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary Server/Image.pm »
1 package Net::DPAP::Server;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶use Net::DPAP::Server::Image;
Subroutine BEGIN: called CC=1 SCAR=2.6
5 use File::Find::Rule;
6 use base qw( Net::DMAP::Server );
7 our $VERSION = '0.02';
8  
9 sub protocol { 'dpap' }
10  
11 sub default_port { 8770 }
12  
13 sub find_tracks {
14 my $self = shift;
15 for my $file ( find name => "*.jpeg", in => $self->path ) {
16 my $track = Net::DPAP::Server::Image->new_from_file( $file );
17 $self->tracks->{ $track->dmap_itemid } = $track;
18 }
19 }
20  
21 sub server_info {
22 my ($self, $request, $response) = @_;
23 $response->content( $self->_dmap_pack(
24 [[ 'dmap.serverinforesponse' => [
25 [ 'dmap.status' => 200 ],
26 [ 'dmap.protocolversion' => 2 ],
27 [ 'dpap.protocolversion' => 1 ],
28 [ 'dmap.itemname' => $self->name ],
29 [ 'dmap.loginrequired' => 0 ],
30 [ 'dmap.timeoutinterval' => 0 ],
31 [ 'dmap.supportsautologout' => 0 ],
32 [ 'dmap.authenticationmethod' => 0 ],
33 [ 'dmap.databasescount' => 1 ],
34 ]]] ));
35 }
36  
37 sub _always_answer {
38 my $self = shift;
39 return qw( dmap.itemid ) if $self->uri =~ /dpap.(thumb|hires)/;
40 return ( $self->SUPER::_always_answer, 'dpap.imagefilename' );
41 }
42  
43 1;
44 __END__
↑ Summary Server/Image.pm »