line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::DAAP::Server; |
2
|
2
|
|
|
2
|
|
165702
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
884
|
use Net::DAAP::Server::Track; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
17
|
|
5
|
2
|
|
|
2
|
|
2586
|
use File::Find::Rule; |
|
2
|
|
|
|
|
18251
|
|
|
2
|
|
|
|
|
17
|
|
6
|
2
|
|
|
2
|
|
106
|
use base qw( Net::DMAP::Server ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2784
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub protocol { 'daap' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub default_port { 3689 } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub find_tracks { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
for my $file ( find name => "*.mp3", in => $self->path ) { |
16
|
|
|
|
|
|
|
my $track = Net::DAAP::Server::Track->new_from_file( $file ) or next; |
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
|
|
|
|
|
|
|
[ 'daap.protocolversion' => |
28
|
|
|
|
|
|
|
$request->header('Client-DAAP-Version') ], |
29
|
|
|
|
|
|
|
[ 'dmap.itemname' => $self->name ], |
30
|
|
|
|
|
|
|
[ 'dmap.loginrequired' => 0 ], |
31
|
|
|
|
|
|
|
[ 'dmap.timeoutinterval' => 1800 ], |
32
|
|
|
|
|
|
|
[ 'dmap.supportsautologout' => 0 ], |
33
|
|
|
|
|
|
|
[ 'dmap.supportsupdate' => 0 ], |
34
|
|
|
|
|
|
|
[ 'dmap.supportspersistentids' => 0 ], |
35
|
|
|
|
|
|
|
[ 'dmap.supportsextensions' => 0 ], |
36
|
|
|
|
|
|
|
[ 'dmap.supportsbrowse' => 0 ], |
37
|
|
|
|
|
|
|
[ 'dmap.supportsquery' => 0 ], |
38
|
|
|
|
|
|
|
[ 'dmap.supportsindex' => 0 ], |
39
|
|
|
|
|
|
|
[ 'dmap.supportsresolve' => 0 ], |
40
|
|
|
|
|
|
|
[ 'dmap.databasescount' => 1 ], |
41
|
|
|
|
|
|
|
]]] )); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
__END__ |