树莓派播放网络磁盘MP3文件
- 树莓派映射网络磁盘
sudo mount -t cifs -o username=jerry.huang,password=Hello2014 //10.10.0.1/Public/ESLPod.com /home/pi/t/ESLPod.com/
树莓派分区参考:
http://bbs.ickey.cn/group-topic-id-35428.html - 树莓派使用 sudo nano 编辑保存文件
修改静态IP,需要修改/etc/network/interfaces文件
原文件内容
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
修改为静态IP
auto lo iface lo inet loopback iface eth0 inet static address 10.10.0.91 netmask 255.255.255.0 gateway 10.10.0.254 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
编辑自动定时任务/etc/crontab
8,38 8-12,14-17 * * 1-5 root /home/pi/playESLPod.sh 30 8-12,14-17 * * 1-5 root /home/pi/playNews.sh 0 14 * * 1-5 root /home/pi/playNews.sh 5 13 * * 1-5 root /home/pi/stopMplayer.sh 20 18 * * 1-5 root /home/pi/stopMplayer.sh 0 0 * * 6-7 root /home/pi/stopMplayer.sh 30 18 * * 1-5 root /home/pi/playMusic.sh 0 20 * * 1-5 root /home/pi/stopMplayer.sh
- 播放MP3、网络广播的脚本
播放本地音乐playESLPod.sh
#!/bin/sh sudo pkill -f mplayer; sudo mplayer -shuffle /home/pi/t/ESLPod.com/* < /dev/null > /dev/null 2>1&
播放网络playNews.sh
#!/bin/sh sudo pkill -f mplayer; sudo mplayer -loop 0 -playlist "http://rthk.hk/live2.m3u" < /dev/null > /dev/null 2>1&
播放runMplayer.sh
#!/bin/sh if (ps -A|grep "mplayer");then sudo pkill -f mplayer; fi sudo mplayer -loop 0 -playlist "http://rthk.hk/live$1.m3u" < /dev/null > /dev/null 2>1&
停止stopMplayer.sh
#!/bin/sh sudo pkill -f mplayer;
Learn how to learn~~