Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voice volume adjustment with interactive command line does not work with Raspberry pi #26

Closed
royjiang opened this issue Jan 15, 2015 · 1 comment
Labels

Comments

@royjiang
Copy link

hi, installed douban.fm in my rpi , everything works fine except the volume adjustment using "=" and "-" does not work , here is the fix i verified.

the reason is in the douban.py there is a line of code to associated to amixer "Master", but RPi does not use "Master" , it use "PCM" instead

获取音量

def get_volume(self):
    if self.platform == 'Linux':
        volume = subprocess.check_output('amixer get Master | grep Mono: | cut -d " " -f 6', 

shell=True)
volume = volume[1:-3]
elif self.platform == 'Darwin':
volume = subprocess.check_output('osascript -e "output volume of (get volume setti
ngs)"', shell=True)
else:
volume = ''
self.volume = volume

# 调整音量大小
def change_volume(self, increment):
    if increment == 1:
        volume = int(self.volume) + 5
    else:
        volume = int(self.volume) - 5
    if self.platform == 'Linux':
        subprocess.Popen('amixer set Master ' + str(volume) + '% >/dev/null 2>&1', shell=True

)

the way to fix it is just to replace the two words of "Master" in the code with "PCM"

in my system , i got the path of the douban.py
/usr/local/lib/python2.7/dist-packages/douban/douban.py

use an text editor to modify it, and restart your douban.fm, that's all.

after the fix , i got following, noted that i have "vol: 90% →" now

 Douban Fm \ retjiang   >>  64kbps  01:38  rate: ★ ★ ★ ★ ★   vol: 90%  →

红心兆赫 ♥ Hotel California • Hotel California • Eagles 1976
私人兆赫
华语
欧美
七零
八零
九零
粤语
摇滚
民谣
轻音乐
原声
爵士
电子
说唱
R&B
日语
韩语
女声
法语
古典
动漫
咖啡馆
圣诞
Sonos 乐满人家
豆瓣好歌曲
世界音乐
布鲁斯
新歌
雷鬼

@taizilongxu
Copy link
Owner

OK!Thanks very much,I will update in next version!:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants