/lib/DDG/Spice/SeatGeek.pm
https://github.com/pardocz/zeroclickinfo-spice · Perl · 32 lines · 21 code · 6 blank · 5 comment · 1 complexity · e0041b59fe761e839a6a74d9c931095c MD5 · raw file
- package DDG::Spice::SeatGeek;
- # ABSTRACT: Returns upcoming concerts for a band/artist.
- use DDG::Spice;
- primary_example_queries "live show weezer", "upcoming concerts in flames";
- description "Upcoming concerts from SeatGeek";
- name "SeatGeek";
- code_url "https://github.com/duckduckgo/zeroclickinfo-spice/blob/master/lib/DDG/Spice/SeatGeek.pm";
- category "entertainment";
- topics "entertainment", "music";
- attribution github => ['https://github.com/MariagraziaAlastra','MariagraziaAlastra'];
- triggers startend => 'upcoming concert', 'upcoming concerts', 'concert', 'concerts', 'live', 'live show', 'live shows';
- spice to => 'http://api.seatgeek.com/2/events?performers.slug=$1';
- spice wrap_jsonp_callback => 1;
- handle remainder_lc => sub {
- # Removes triggers from the query
- $_ =~ s/^(:?(upcoming\s*)?(concerts?))|((live)\s*(:?(shows?))?)$//gi;
- # Removes spaces from the beginning of the query
- $_ =~ s/^\s+//;
- # Removes spaces from the end of the query
- $_ =~ s/\s+$//;
- # Replaces spaces between words with dashes, because the API requires it
- $_ =~ s/\s/\-/g;
- return $_ if $_;
- return;
- };
- 1;