Skip to content

Commit

Permalink
add add-album script for adding new albums
Browse files Browse the repository at this point in the history
  • Loading branch information
catalyst-donovan-jones committed Jun 5, 2010
1 parent f2846cf commit e1dbe6e
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions last-fm-submitter/add-album.pl
@@ -0,0 +1,40 @@
#!/usr/bin/perl

# usage ./add-album.pl artist album hash

use warnings;
use strict;

use Data::Dumper;
use Storable;

my $store = 'tracks.db';

my $artist = shift;
my $album = shift;
my $hash = shift;

my $data = retrieve($store);

print Dumper($data);

if ($artist and $album and $hash) {

print "adding $album by $artist with mb hash = $hash\n";

my $index;
my $count = 1;

# get the next free index
until ($index) {
$index = $count unless $data->{$count};
$count++;
}

$data->{$index}{hash} = $hash;
$data->{$index}{artist} = $artist;
$data->{$index}{name} = $album;

store($data, $store) or die "Can't store data in $store\n";

}

0 comments on commit e1dbe6e

Please sign in to comment.