Net::DVDProfiler - Get the UPC numbers for your DVD collection, located on DVD Profiler.


Net-DVDProfiler documentation Contained in the Net-DVDProfiler distribution.

Index


Code Index:

NAME

Top

Net-DVDProfiler - Get the UPC numbers for your DVD collection, located on DVD Profiler.

DESCRIPTION

Top

This is a module that uses LWP to connect to a remote DVDProfiler collection and acquire all available DVD UPC symbols. Once all the symbols have been acquired, they can then be plugged into another application, such as the module Net::Amazon::DVD2IMDB, to get all the IMDB IDs for the DVDs.

SYNOPSIS

Top

    # Print out the names of all the movies in your DVD Profiler collection.

    use Net::DVDProfiler;

    my $ua = new Net::DVDProfiler( alias => 'YOURALIAS' );

    print map { $_->title() . "\n" } @{$ua->getAll()};

new
    my $ua = new Net::DVDProfiler( alias => 'YOURALIAS' );

Instantiates an object with which to perform further requests. Requires a valid user alias to be provided.

getAll, getOwned, getOrdered, and getWishlist
    $ua-getAll();

Returns an array of Net::DVDProfiler::DVD objects. Each of the objects have a title and upc method, which can be accessed to receive that information.

AUTHOR

Top

<a href="http://ejohn.org/">John Resig</a> <jeresig@gmail.com>

DISCLAIMER

Top

This application utilitizes screen-scraping techniques, which are very fickle and susceptable to changes.

COPYRIGHT

Top


Net-DVDProfiler documentation Contained in the Net-DVDProfiler distribution.

package Net::DVDProfiler;

use LWP::UserAgent;
use Net::DVDProfiler::DVD;

our $VERSION = 0.03;

sub new {
  my $ref = shift;
  my $class = ref( $ref ) || $ref;

  my $self = bless {
    lwp => new LWP::UserAgent( cookie_jar => {} ),
    alias => undef,
    @_
  }, $class;

  die "DVDProfiler requires an alias." unless ( $self->{alias} );

  $self->{lwp}->get( 'http://www.dvdprofiler.com/mycollection.asp?alias=' . $self->{alias} );
  $self->{lwp}->get( 'http://www.dvdprofiler.com/mycollection.asp?acceptadult=true&alias=' . $self->{alias} );

  return $self;
}

sub getAll {
  return $_[0]->getList( 'A' );
}

sub getOwned {
  return $_[0]->getList( 'O' );
}

sub getOrdered {
  return $_[0]->getList( 'P' );
}

sub getWishlist {
  return $_[0]->getList( 'W' );
}

sub getList {
  my ( $self, $type ) = @_;

  my @upcs;
  my $page = $u->get( 'http://www.dvdprofiler.com/dvdpro/mycollection/styles/Default/list.asp?type=' . $type )->content();

  while ( $page =~ /id="([^"]*)".*?entry">(.*?)<\/A>/g ) {
    push( @upcs, new Net::DVDProfiler::DVD( upc => $1, title => $2 ) );
  }

  return @upcs;
}
1;

__END__