Roll your own Arbitron system

jjohn on 2003-08-23T19:13:43

It's a beautiful day in Boston, but I'm stuck inside nursing a head cold. To entertain myself, I started grepping through taskboy's web access logs. Once again, I focused the sifting on my music. I was curious to see the popularity of my tunes. So as not to skew the results too much, I've removed my DSL's IP address. The dates covered by this log are from August 30, 2001 to August 23, 2003. Of course, this report is generated by this perl/shell one-liner:

bash-2.03$ perl -MData::Dumper -MFile::Basename -lane 'next unless $F[6] =~ /\.mp3$/; next if $F[0] eq "151.203.46.214"; push @{$s{basename($F[6])}},$F[0]; END {for my $song (sort {scalar @{$s{$b}} <=> scalar @{$s{$a}}} keys %s) { printf "%30s: %4d downloads\n", $song, (scalar @{$s{$song}}); }}' access.log  | head -10

The results surprised me. Here's the top 10 list of my most popular songs:

  1. monkey_vs_robot_jjohn.mp3: 317 downloads
  2. make_the_pie_higher.mp3: 273 downloads
  3. 08_without_you.mp3: 189 downloads
  4. plug_nickle.mp3: 171 downloads
  5. careful.mp3: 137 downloads
  6. doubt.mp3: 105 downloads
  7. immigrant_song.mp3: 101 downloads
  8. 01_careful.mp3: 98 downloads
  9. m_vs_r_jjohn.mp3: 95 downloads
  10. 05_letting_go_remix.mp3: 92 downloads

Why people are downloading my crappy cover of Immigrant Song is way beyond me (maybe it's kitchy in Canada?). I am pleased that Monkey vs. Robot seems to amuse folks. It should be noted that I changed the filename of careful.mp3 to 01_careful.mp3 a while ago. Perhaps I can turn down the suck knob on that song if I remaster it with my new pro-audio gear. The Soundblaster Live card really just doesn't cut it.

With more time to kill, I thought find those song with the most diverse support. That is, songs that were downloaded by the greatest number of unique IP addresses. That list is as follows:

  1. make_the_pie_higher.mp3: 157 unique IPs
  2. monkey_vs_robot_jjohn.mp3: 151 unique IPs
  3. 08_without_you.mp3: 96 unique IPs
  4. m_vs_r_jjohn.mp3: 64 unique IPs
  5. doubt.mp3: 64 unique IPs
  6. immigrant_song.mp3: 55 unique IPs
  7. careful.mp3: 53 unique IPs
  8. plug_nickle.mp3: 51 unique IPs
  9. 05_letting_go_remix.mp3: 49 unique IPs
  10. goodnight.mp3: 46 unique IPs

Ah! So the worm turns! It appears that some of my songs get at least a second listen. That's pretty cool. Some, like Plug Nickle, even get a remarkable third listen.

That's all for now. My head is filling with cotton again.


We don't need no stinkin' END blocks

vsergu on 2003-08-24T00:01:39

Real one-liner writers don't use
-ne'foo; END { bar; }'
It's shorter, and more fun, to do
-ne'foo}{bar'

Re:We don't need no stinkin' END blocks

jjohn on 2003-08-24T01:10:29

Yes, I know that a while loop is inserted into -e specified code with the -n flag. However, I feel dirty using the those about facing braces. Besides, I don't use END blocks except for these one-liners. I'm a prud.