I don't have any experience at all in Python, so please excuse me if I'm going about this the totally wrong way, but what I need to do is find the current volume of Alsa's master channel. Here's what I have so far:
Code:
f = os.popen ("amixer -c 0 set Master 0dB+")
counter = 0
for i in f.readlines ():
counter += 1
if counter == 5:
vol_line = i
start_s = vol_line.find ("[", 0, 50)
end_s = vol_line.find ("%", 0, 50)
start_i = int (start_s)
end_i = int (end_s)
real_vol = vol_line [start_i, end_i]
print real_vol
And I get the error
Code:
File "vol.py", line 117, in main
real_vol = vol_line [start_i, end_i]
TypeError: string indices must be integers, not tuple
So I have no idea what I'm doing wrong... as far as I can see, I convert the tuple start_s and end_s into an int with the int () function, but I guess that's not happening?
If you can please help, thanks!
Bookmarks