I am trying to write a python script to help some deaf people. They have a list of sign language songs which are in m4v format.
I have a raspberry pi and a monitor which I can give them.
My intention is to provide a gui with all the song numbers on buttons so they just click the mouse on one and the video plays then returns.
I know that I can launch omxplayer with the file as a parameter.
I am trying to develop the code on my linux laptop and then transfer it to the raspberry pi along with all the songs >>> There are 152 of them <<<
That is where my problem comes from.
I have the following code ( just the relevant snippets):
I have tried various ways of passing the correct song number to the function but whatever I try I get the same problem or lots of errors with other versions I have tried.
I get the same file name generated:
snnw_152_r480P. m4v
whichever button I click. Can it be done this way or do I have to create the buttons some other way
I have a raspberry pi and a monitor which I can give them.
My intention is to provide a gui with all the song numbers on buttons so they just click the mouse on one and the video plays then returns.
I know that I can launch omxplayer with the file as a parameter.
I am trying to develop the code on my linux laptop and then transfer it to the raspberry pi along with all the songs >>> There are 152 of them <<<
That is where my problem comes from.
I have the following code ( just the relevant snippets):
Code:
def play_song(p):
i=p; k=int(i)
if k>0:
if k<136:
starter="home/norman//Downloads/bsl/sn_"
else:
starter="snnw_"
if k<156:
stp=str(k)
if len(stp)<2:
stp="0"+stp
if len(stp)<3:
stp=" " + stp
song2play=starter+ stp +"_r480P.m4v"
print song2play
# generate the buttons
for x in range(1,9):
for y in range(1,20):
txt=str(q)
j=int(txt)
myname="button" + str(x*y)
myname = Button(frame2,text=txt, font=TF, width=3, command = lambda: play_song(txt))
myname.grid(row = x+2, column=y+1)
q+=1
I get the same file name generated:
snnw_152_r480P. m4v
whichever button I click. Can it be done this way or do I have to create the buttons some other way
Comment