diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-05-01 19:11:40 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-05-01 19:11:40 -0500 |
commit | dc9fbe99acb2f6f29924d961c4b94692b84d60a4 (patch) | |
tree | 15d557d36ea60ce2a68af52fcea870bb73a6e900 /bin/lastfm_export | |
parent | 3d7019fb00889710bccb53018026fbb6ec6b6bcc (diff) | |
download | lastfm-export-dc9fbe99acb2f6f29924d961c4b94692b84d60a4.tar.gz lastfm-export-dc9fbe99acb2f6f29924d961c4b94692b84d60a4.zip |
currently playing songs don't have timestamps
Diffstat (limited to 'bin/lastfm_export')
-rw-r--r-- | bin/lastfm_export | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/bin/lastfm_export b/bin/lastfm_export index eb721da..b40f7c7 100644 --- a/bin/lastfm_export +++ b/bin/lastfm_export @@ -58,13 +58,20 @@ my $count = 1; my $s = $exporter->tracks(from => $from); while (my $block = $s->next) { for my $item (@$block) { - $sth->execute( - $item->{artist}{'#text'}, - $item->{album}{'#text'}, - $item->{name}, - $item->{date}{uts}, - ); - $progress->update($count++) unless $quiet; + if ($item->{date}{uts}) { + $sth->execute( + $item->{artist}{'#text'}, + $item->{album}{'#text'}, + $item->{name}, + $item->{date}{uts}, + ); + $progress->update($count++) unless $quiet; + } + else { + $progress->message("skipping currently playing song: " + . "$item->{artist}{'#text'} - $item->{name}") + unless $quiet; + } } $dbh->commit; sleep 1; |