2017 © Pedro Peláez
 

library weather-forcast

weather-forcast for Chinese

image

suifengtec/weather-forcast

weather-forcast for Chinese

  • Thursday, January 11, 2018
  • by suifengtec
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

weather

作用

用心知天气免费的API接口,获取天气预报,然后使用百度语音合成语音放入本地文件,然后把天气预报播放出来,播放后删除生成的语音文件。, (*1)

需求

支持的操作系统: Linux(在Ubuntu 和 LinuxMint 上进行了测试) 或 Windows 10; 执行 PHP : PHP 5.3+; 编译命令行可用的 mp3 播放器: Windows 10 操作系统需要确保安装了 go 语言或者 gcc 可用;, (*2)

获取项目代码


git clone https://github.com/suifengtec/weatherforcast

准备

登录百度AI应用控制台,创建个应用,记得点选" 百度语音",然后把应用相关的信息,放进 config.php;, (*3)

心知天气注册个免费账号,使用其免费接口,然后把应用相关信息,放进 config.php;, (*4)

命令行播放语音文件

Linux

以 Ubuntu 和 LinuxMint 为例:, (*5)

sudo apt update
sudo apt upgrade
sudo apt  install sox libsox-fmt-all

Windows 10

需要有支持命令行播放的播放器,虽然可以用 start 命令,但是为了让这篇文章更加丰满,我就加点儿料吧,以下两种播放器方案,任选其一即可:, (*6)

Go 语言的mp3命令行播放器

命令行执行, (*7)

go get github.com/hajimehoshi/go-mp3
go get github.com/hajimehoshi/oto

在项目根目录执行:, (*8)


go build playmp3go.go playmp3go classic.mp3

能听到音乐就说明命令行播放器编译成功., (*9)

C语言的mp3命令行播放器

确保 gcc 可用, 在项目根目录执行:, (*10)

gcc playmp3c.c -lwinmm -o playmp3c.exe
playmp3c classic.mp3

能听到音乐就说明命令行播放器编译成功., (*11)

使用

确保安装了 PHP, 在命令行执行:, (*12)

php -S 127.0.0.1:8080

浏览器打开 http://127.0.0.1:8100/ , 就能听到了。, (*13)

The Versions

11/01 2018

dev-master

9999999-dev

weather-forcast for Chinese

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar suifengtec

ai weather-forcast