taizilongxu / douban.fm

:radio: douban.fm based on Python
MIT License
787 stars 190 forks source link

douban.fm run on raspberry pi getting error #44

Closed r00t8ug83 closed 9 years ago

r00t8ug83 commented 9 years ago

Traceback (most recent call last): File "/usr/local/bin/douban.fm", line 9, in load_entry_point('douban.fm==0.2.15', 'console_scripts', 'douban.fm')() File "/usr/local/lib/python2.7/dist-packages/douban.fm-0.2.15-py2.7.egg/douban/douban.py", line 666, in main Win(douban) File "/usr/local/lib/python2.7/dist-packages/douban.fm-0.2.15-py2.7.egg/douban/douban.py", line 111, in init self.play() File "/usr/local/lib/python2.7/dist-packages/douban.fm-0.2.15-py2.7.egg/douban/douban.py", line 256, in play self.douban.get_song() File "/usr/local/lib/python2.7/dist-packages/douban.fm-0.2.15-py2.7.egg/douban/douban_token.py", line 255, in get_song self.playingsong = self.playlist.pop(0) IndexError: pop from empty list

Hexcles commented 9 years ago

是不是没装 mplayer ?( #38 )

r00t8ug83 commented 9 years ago

@Hexcles 装了。

Hexcles commented 9 years ago

能不能试试看github上最新的版本?

不过原因我猜是歌曲列表空了,没装 mplayer 的话更容易出现,因为一首歌立即就“结束”了,一下就放完整个列表,来不及获取新歌曲。装了 mplayer 的话在网络不好或者其他状况下可能也会出现。

我实验一下。

r00t8ug83 commented 9 years ago

@Hexcles 我的是github最新版本的。

Hexcles commented 9 years ago

@R00t8ug 最近一段时间做了不少调整,有可能不经意间影响了这个bug,能否再试试看?

这个异常是播放列表空了,但我仔细读了一遍源代码,每次获取下一首歌之前我们都检查了播放列表,如果是空的就去抓新的,但只尝试一次并且没有再检查。一般情况下是不会有问题的,但如果和豆瓣的连接质量较差,就可能导致抓不到播放列表。你的树莓派 ping www.douban.com 通畅么?

我会考虑对这个地方处理一下,但由于获取列表已经是相对较快的 API 了,出错机率也很低,如果这儿都失败的话后面其他地方可能也要卡很久甚至出错。最好情况就是让它 fail loudly and gracefully 了。

Angdo commented 9 years ago

启动 Traceback (most recent call last): File "/usr/lib/python2.7/threading.py", line 810, in *bootstrap_inner self.run() File "/usr/lib/python2.7/threading.py", line 763, in run self.__target(_self.__args, _self.kwargs) File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 270, in play self.player.spawn(song['url'], volume) File "/usr/local/lib/python2.7/dist-packages/douban/mplayer.py", line 37, in spawn stderr=subprocess.STDOUT) File "/usr/lib/python2.7/subprocess.py", line 710, in init** errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

切换频道 Traceback (most recent call last): File "/usr/local/bin/douban.fm", line 9, in load_entry_point('douban.fm==0.3.0', 'console_scripts', 'douban.fm')() File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 740, in main Win(douban) File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 114, in init self.run() File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 324, in run self.set_play() File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 354, in _func func(self) File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 435, in set_play self.play() File "/usr/local/lib/python2.7/dist-packages/douban/douban.py", line 270, in play self.player.spawn(song['url'], volume) File "/usr/local/lib/python2.7/dist-packages/douban/mplayer.py", line 37, in spawn stderr=subprocess.STDOUT) File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

taizilongxu commented 9 years ago

@Angdo mplayer装了吗?