WWW::CDBaby

WWW::CDBaby is a Perl module that can automate interaction with cdbaby.com!
Download

WWW::CDBaby Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Grant Grueninger
  • Publisher web site:
  • http://search.cpan.org/~grantg/WWW-Sitebase-0.5/lib/WWW/Sitebase/Poster.pm

WWW::CDBaby Tags


WWW::CDBaby Description

WWW::CDBaby is a Perl module that can automate interaction with cdbaby.com! WWW::CDBaby is a Perl module that can automate interaction with cdbaby.com!SYNOPSIS my $cdbaby = new WWW::CDBaby( "$account_name", "$password" ); # Print the name of the first person who bought your CD my ( @sales ) $cdbaby->get_cd_sales( $album_id ); print $sales->{'name'};METHODSget_cd_sales( album_id )Pass this method the URL of your album. If you can see your album at "cdbaby.com/amberg", your album_id is "amberg".It returns an array of hashrefs containing all your physical album sales. Digital sales are tracked separately.This method gets the text-delimited file you get if you log into members.cdbaby.com, click "Accounting", click the "$ sold" amount next to the album name, and click the "download your sales in a tab-delimited text file" link. See how much easier this method is? use WWW::CDBaby; my $cdbaby = new WWW::CDBaby; my ( @sales ) = $cdbaby->get_cd_sales( $album_id ); my $total=0; foreach $sale ( @sales ) { $total += $sale->{'paid_to_you'}; } print "Total profits: $$totaln";get_dd_sales( album_id )Pass this method the URL of your album. If you can see your album at "cdbaby.com/amberg", your album_id is "amberg".It returns an array of hashrefs containing your digital distribution sales and plays for that album.This method gets the HTML table you get if you Go to the "Digital" tab and click the amount next to INCOME for one of your albums. It parses the HTML into one hash for each row. The keys to the hash are taken directly from the headers at the top of the table and modified to make them program-friendly: Leading and trailing whitespace is stripped white space is replaced by "_" # by itself is turned into "quantity" caps are made lower case. Any remaining characters that aren't letters, numbers, or _ are strippedThe current keys returned (as of 8/1/2007) are: company sales_date report_date song price quantity subtotalAs these keys are taken directly from the headers at the top of the table, if rows are added or removed or the headers are changed by CD Baby, the keys to your hash will change accordingly.Also, the dollar sign ("$") from the price fields is removed so you can do things like the example below: use WWW::CDBaby; my $cdbaby = new WWW::CDBaby; my ( @sales ) = $cdbaby->get_dd_sales( $album_id ); my $total=0; foreach $sale ( @sales ) { $total += $sale->{'subtotal'}; } print "Total profits: $$totaln";(Note: when I run this script, I get a number slightly lower than the total shown on the DD page. This is probably either CD Baby rounding the numbers (probably up :) or some floating point issue.)Requirements:· Perl Requirements: · Perl


WWW::CDBaby Related Software