line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::SetlistFM; |
2
|
1
|
|
|
1
|
|
1728
|
use JSON::XS; |
|
1
|
|
|
|
|
5806
|
|
|
1
|
|
|
|
|
66
|
|
3
|
1
|
|
|
1
|
|
691
|
use Cache::LRU; |
|
1
|
|
|
|
|
639
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
827
|
use Net::DNS::Lite; |
|
1
|
|
|
|
|
26495
|
|
|
1
|
|
|
|
|
49
|
|
5
|
1
|
|
|
1
|
|
806
|
use Furl; |
|
1
|
|
|
|
|
20180
|
|
|
1
|
|
|
|
|
30
|
|
6
|
1
|
|
|
1
|
|
845
|
use URI; |
|
1
|
|
|
|
|
4717
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
696
|
use URI::QueryParam; |
|
1
|
|
|
|
|
685
|
|
|
1
|
|
|
|
|
27
|
|
8
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
9
|
1
|
|
|
1
|
|
19962
|
use Moo; |
|
1
|
|
|
|
|
65344
|
|
|
1
|
|
|
|
|
7
|
|
10
|
1
|
|
|
1
|
|
3172
|
use namespace::clean; |
|
1
|
|
|
|
|
36666
|
|
|
1
|
|
|
|
|
5
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$Net::DNS::Lite::CACHE = Cache::LRU->new( size => 512 ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'http' => ( |
18
|
|
|
|
|
|
|
is => 'rw', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
default => sub { |
21
|
|
|
|
|
|
|
my $http = Furl::HTTP->new( |
22
|
|
|
|
|
|
|
inet_aton => \&Net::DNS::Lite::inet_aton, |
23
|
|
|
|
|
|
|
agent => 'WebService::SetlistFM/' . $VERSION, |
24
|
|
|
|
|
|
|
headers => [ 'Accept-Encoding' => 'gzip',], |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
return $http; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub artist { |
32
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
33
|
0
|
|
|
|
|
|
my $mbid = shift; |
34
|
0
|
|
|
|
|
|
return $self->request("artist/$mbid.json"); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub city { |
38
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
39
|
0
|
|
|
|
|
|
my $geoid = shift; |
40
|
0
|
|
|
|
|
|
return $self->request("city/$geoid.json"); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub search_artists { |
44
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
my $query_param = shift; |
46
|
0
|
|
|
|
|
|
return $self->request("search/artists.json", $query_param); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub search_cities { |
50
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my $query_param = shift; |
52
|
0
|
|
|
|
|
|
return $self->request("search/cities.json", $query_param); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub search_countries { |
56
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
57
|
0
|
|
|
|
|
|
my $query_param = shift; |
58
|
0
|
|
|
|
|
|
return $self->request("search/countries.json", $query_param); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub search_setlists { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
0
|
|
|
|
|
|
my $query_param = shift; |
64
|
0
|
|
|
|
|
|
return $self->request("search/setlists.json", $query_param); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub search_venues { |
68
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
69
|
0
|
|
|
|
|
|
my $query_param = shift; |
70
|
0
|
|
|
|
|
|
return $self->request("search/venues.json", $query_param); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub setlist { |
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
75
|
0
|
|
|
|
|
|
my $setlist_id = shift; |
76
|
0
|
|
|
|
|
|
return $self->request("setlist/$setlist_id.json"); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub user { |
80
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
81
|
0
|
|
|
|
|
|
my $user_id = shift; |
82
|
0
|
|
|
|
|
|
return $self->request("user/$user_id.json"); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub venue { |
86
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
87
|
0
|
|
|
|
|
|
my $venue_id = shift; |
88
|
0
|
|
|
|
|
|
return $self->request("venue/$venue_id.json"); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub artist_setlists { |
92
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
93
|
0
|
|
|
|
|
|
my $mbid = shift; |
94
|
0
|
|
|
|
|
|
my $query_param = shift; |
95
|
0
|
|
|
|
|
|
return $self->request("artist/$mbid/setlists.json", $query_param); |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub setlist_lastfm { |
99
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
100
|
0
|
|
|
|
|
|
my $lastfm_event_id = shift; |
101
|
0
|
|
|
|
|
|
return $self->request("setlist/lastFm/$lastfm_event_id.json"); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub setlist_version { |
105
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
106
|
0
|
|
|
|
|
|
my $version_id = shift; |
107
|
0
|
|
|
|
|
|
return $self->request("setlist/version/$version_id.json"); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub user_attended { |
111
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
112
|
0
|
|
|
|
|
|
my $user_id = shift; |
113
|
0
|
|
|
|
|
|
return $self->request("user/$user_id/attended.json"); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub user_edited { |
117
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
118
|
0
|
|
|
|
|
|
my $user_id = shift; |
119
|
0
|
|
|
|
|
|
return $self->request("user/$user_id/edited.json"); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub venue_setlists { |
123
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
124
|
0
|
|
|
|
|
|
my $venue_id = shift; |
125
|
0
|
|
|
|
|
|
return $self->request("venue/$venue_id/setlists.json"); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub artist_tour { |
129
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
130
|
0
|
|
|
|
|
|
my $mbid = shift; |
131
|
0
|
|
|
|
|
|
my $tour = shift; |
132
|
0
|
|
|
|
|
|
return $self->request("artist/$mbid/tour/$tour.json"); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
sub request { |
137
|
0
|
|
|
0
|
0
|
|
my ( $self, $path, $query_param ) = @_; |
138
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
my $query = URI->new; |
140
|
0
|
|
|
|
|
|
map { $query->query_param( $_, $query_param->{$_} ) } keys %$query_param; |
|
0
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
|
my ($minor_version, $status_code, $message, $headers, $content) = |
143
|
|
|
|
|
|
|
$self->http->request( |
144
|
|
|
|
|
|
|
scheme => 'http', |
145
|
|
|
|
|
|
|
host => 'api.setlist.fm', |
146
|
|
|
|
|
|
|
path_query => "rest/0.1/$path$query", |
147
|
|
|
|
|
|
|
method => 'GET', |
148
|
|
|
|
|
|
|
); |
149
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
|
return decode_json( $content ); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |
156
|
|
|
|
|
|
|
__END__ |