Permalink
Browse files

added display map updater

  • Loading branch information...
1 parent 9a90e1c commit 86ef6671903bb0b04d8edc26b7bb0e0dfb325ebf @tokuhirom tokuhirom committed Jan 12, 2010
Showing with 36 additions and 0 deletions.
  1. +36 −0 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.