App-Scrobble
view release on metacpan or search on metacpan
lib/App/Scrobble/Service/Mixcloud.pm view on Meta::CPAN
# ABSTRACT: Mixcloud plugin
package App::Scrobble::Service::Mixcloud;
use Moose;
use namespace::autoclean;
with 'App::Scrobble::Role::WithService';
use WWW::Mixcloud;
our $VERSION = '0.03'; # VERSION
sub is_plugin_for {
my $class = shift;
my $url = shift;
return unless $url =~ /mixcloud\.com/;
return 1;
}
sub get_tracks {
my $self = shift;
my $cloudcast = WWW::Mixcloud->new->get_cloudcast( $self->url );
foreach my $section ( @{$cloudcast->sections} ) {
$self->add_track({
title => $section->track->name,
artist => $section->track->artist->name,
}) if $section->has_track;
}
return $self->tracks;
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
App::Scrobble::Service::Mixcloud - Mixcloud plugin
=head1 VERSION
version 0.03
=head1 DESCRIPTION
L<App::Scrobble> plugin for L<Mixcloud|http://www.mixcloud.com>. Will scrobble
all the tracks in any cloudcast passed to the command line client.
=head1 METHODS
=head2 C<is_plugin_for>
Returns a boolean if the URL passed in is a mixcloud URL.
=head2 C<get_tracks>
( run in 0.640 second using v1.01-cache-2.11-cpan-39bf76dae61 )