[Alfred]为Baidu Weather Workflow更新图标
生活随笔
收集整理的這篇文章主要介紹了
[Alfred]为Baidu Weather Workflow更新图标
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Alfred workflow:百度天氣,修改更新圖標(biāo)顯示:
?
下載:https://github.com/BobSte/weather-workflow
?
原始代碼是php腳本,為其增加了一個取圖片的函數(shù)以及一些圖片。增加到weather.php
function getWeatherIcon($weather) {if ($weather == 'icon') {return 'cloudy2.png';} elseif ($weather == 'unknown') {return 'unknown.png';}$map = array('晴' => 'sunny.png', '晴見多云' => 'cloudy1.png','晴轉(zhuǎn)多云' => 'cloudy3.png','多云轉(zhuǎn)晴' => 'cloudy4.png','陰轉(zhuǎn)晴' => 'cloudy4.png','多云' => 'cloudy5.png','陰' => 'overcast.png','雨' => 'light_rain.png','陣雨' => 'shower1.png','小雨' => 'shower1.png','中雨' => 'shower2.png','大雨' => 'shower3.png','暴雨' => 'shower3.png','雷陣雨' => 'tstorm1.png','雷陣雨轉(zhuǎn)中雨' => 'tstorm2.png','雷陣雨轉(zhuǎn)大雨' => 'tstorm3.png','雷陣雨轉(zhuǎn)暴雨' => 'tstorm3.png','雨夾雪' => 'sleet.png','冰雹' => 'hail.png','陣雪' => 'snow1.png','小雪' => 'snow1.png','中雪' => 'snow2.png','大雪' => 'snow3.png','暴雪' => 'snow4.png','大暴雪' => 'snow5.png','霧' => 'mist.png','大霧' => 'fog.png','霾' => 'haze.png','霧霾' => 'haze.png',);foreach ($map as $key => $value) {if ($weather == $key) {return $value;}}foreach (array_reverse($map) as $key => $value) {if (strstr($weather, $key)) {return $value;}}return 'unknown.png'; }?
轉(zhuǎn)載于:https://www.cnblogs.com/Bob-wei/p/5013195.html
總結(jié)
以上是生活随笔為你收集整理的[Alfred]为Baidu Weather Workflow更新图标的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: IntelliJ IDEA 部署Tomc
- 下一篇: C++ 中的问题