Skip to content

Commit

Permalink
added display map updater
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Jan 12, 2010
1 parent 9a90e1c commit 86ef667
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions bin/update_docomo_display_map.pl
@@ -0,0 +1,36 @@
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use WWW::MobileCarrierJP::DoCoMo::Display;
use YAML;
use FindBin;
use File::Spec;
use Data::Dumper;
use Encode;
use File::Slurp;

setup();exit;

sub setup {
my $fname = File::Spec->catfile( $FindBin::Bin, '..', 'assets', 'common',
'docomo-display-map.yaml' );

write_file($fname, YAML::Dump(mkdata()));
}

sub mkdata {
my $dat = WWW::MobileCarrierJP::DoCoMo::Display->scrape;
my %map;
for my $phone (@$dat) {
my $model = uc $phone->{model};
$model =~ s/-//; # $ma->model は - をふくまないものがおくられてきてる
$map{ $model } = +{
width => $phone->{width},
height => $phone->{height},
color => $phone->{is_color},
depth => $phone->{depth},
};
}
\%map;
}

0 comments on commit 86ef667

Please sign in to comment.