Created
March 10, 2012 08:37
-
-
Save redtower/2010864 to your computer and use it in GitHub Desktop.
iTunesライブラリファイルを読み込んで再生回数が0回の曲数をカウントする ref: http://qiita.com/items/3107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Mac::iTunes::Library; | |
use Mac::iTunes::Library::XML; | |
my $library = Mac::iTunes::Library::XML->parse( 'iTunes Library.xml' ); | |
my $count=0; | |
my %items = $library->items(); | |
while (my ($artist, $artistSongs) = each %items) { | |
while (my ($songName, $artistSongItems) = each %$artistSongs) { | |
foreach my $song (@$artistSongItems) { | |
if (!defined($song->playCount())) { | |
$count++; | |
} | |
} | |
} | |
} | |
printf("%5d / %5d\n", $count, $library->num()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment