Changeset 12104 for lang/perl/HTTP-MobileAgent-Flash
- Timestamp:
- 05/21/08 14:48:25 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/HTTP-MobileAgent-Flash/trunk/bin/make_map_flash_lite.pl
r12097 r12104 3 3 use strict; 4 4 use warnings; 5 6 use HTTP::MobileAgent; 5 7 6 8 use WWW::MobileCarrierJP::DoCoMo::Flash; 7 9 use WWW::MobileCarrierJP::EZWeb::DeviceID; 8 10 use WWW::MobileCarrierJP::EZWeb::Model; 11 use WWW::MobileCarrierJP::ThirdForce::UserAgent; 12 use WWW::MobileCarrierJP::ThirdForce::Service; 13 9 14 use Getopt::Long; 10 15 use Pod::Usage; … … 65 70 66 71 my $map; 67 if ($SCRAPE_CARRIER eq 'docomo') { $map = make_map_docomo() } 68 elsif ($SCRAPE_CARRIER eq 'ezweb') { $map = make_map_ezweb() } 72 if ($SCRAPE_CARRIER eq 'docomo') { $map = make_map_docomo() } 73 elsif ($SCRAPE_CARRIER eq 'ezweb') { $map = make_map_ezweb() } 74 elsif ($SCRAPE_CARRIER eq 'softbank') { $map = make_map_softbank() } 69 75 else { pod2usage(2) } 70 76 … … 184 190 } 185 191 192 sub make_map_softbank { 193 194 # - ThirdForce::Service, ThirdForce::UserAgent で取れる model 名が同一 195 # 機種で異なる場合がある。(SoftBankのサイトが異なってる) 196 # Service では 913SH, 913SH G が2レコード 197 # UserAgentでは 913SH/913SH G で1レコード 198 # 199 # - ThirdForce::Service, ThirdForce::UserAgent で取れる model 名が 200 # HTTP::MobileAgent の model と異なる場合が上記以外である。 201 # SoftBankのサイトでは 703SHf 202 # HTTP::MobileAgent では V703SHf 203 # 204 my $flash_map; 205 for my $device (@{WWW::MobileCarrierJP::ThirdForce::Service->scrape()}) { 206 if ( 207 !$device->{flashlite} or 208 $device->{flashlite} !~ /^\d+(\.\d+)/ or 209 $device->{model} !~ /^[\w\-]+$/ 210 ) { 211 next; 212 } 213 214 $flash_map->{$device->{model}} = { 215 version => $device->{flashlite}, 216 217 # メディア編のPDF(P170)から 218 # http://creation.mb.softbank.jp/doc_tool/web_doc_tool.html 219 max_file_size => ($device->{flashlite} eq '1.1') ? 100 : 150, 220 }; 221 } 222 223 for my $device (@{WWW::MobileCarrierJP::ThirdForce::UserAgent->scrape()} ) { 224 $device->{user_agent} =~ s/^\s+//g; 225 $device->{user_agent} =~ s/\s+$//g; 226 my $agent = HTTP::MobileAgent->new($device->{user_agent}); 227 228 my $model = $agent->{model}; 229 my $model_aho = $agent->{model}; 230 $model_aho =~ s/^.//; 231 if ($flash_map->{$model}) { 232 ; 233 } 234 elsif ($flash_map->{$model_aho}) { 235 $flash_map->{$model} = $flash_map->{$model_aho}; 236 delete $flash_map->{$model_aho}; 237 } 238 else { 239 next; 240 } 241 242 $flash_map->{$model}->{width} = $device->{display}->{width}; 243 $flash_map->{$model}->{height} = $device->{display}->{height}; 244 } 245 246 return $flash_map; 247 } 248 186 249 # FIXME: ここまでヤルなら TT 使ったほうがよくね? 187 250 sub output_pm { … … 198 261 $tmpl =~ s/{{MODULE_NAME}}/HTTP::MobileAgent::Flash::EZWebFlashMap/g; 199 262 $tmpl =~ s/{{ENV_FLASH_MAP}}/EZWEB_FLASH_MAP/g; 263 } 264 elsif ($SCRAPE_CARRIER eq 'softbank') { 265 $tmpl =~ s/{{MODULE_NAME}}/HTTP::MobileAgent::Flash::SoftBankFlashMap/g; 266 $tmpl =~ s/{{ENV_FLASH_MAP}}/SOFTBANK_FLASH_MAP/g; 200 267 } 201 268 … … 232 299 =head1 SYNOPSIS 233 300 234 make_map_flash_lite.pl --output=[pm|yaml] --carrier=[docomo|ezweb ]301 make_map_flash_lite.pl --output=[pm|yaml] --carrier=[docomo|ezweb|softbank] 235 302 236 303 =cut
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)