- edited description
After Pi Uploaded music does not work.
I am having a problem playing music that has been uploaded with the web-gui after a pi restart. I have looked around but can not find the cause.
How to recreate
-Upload Song
-Restart Pi with the button in GUI
-Song will not play after restart.
Comments (17)
-
reporter -
repo owner Just wondering. Does the file name have spaces in it?
-
reporter Yes, it does did not even think to test with out spaces.
-
@stephen_burning If you review the link I gave you to review it has a work around for this issue in the Upload classes post method.
f_name = ''.join(os.path.basename(x.filename).split())
This just removes the spaces. -
repo owner i think the real question is why does file names with spaces break things. People should be able to have file names with spaces. I haven't looked at this piece of the code in a while, will have to refresh myself.
-
Well they can have spaces, we just need to escape them to use them. "Deck\ The\ Halls.mp3"
-
repo owner I just looked at my songs and they all have spaces in them, but all work with out changing the code. Is there maybe something else going on?.
-
I upload 3 songs from my wife's window 7 laptop that had spaces in the names and none of them would play used (Chrome browser).
I changed the file names and uploaded them again and they played. -
repo owner Oh OK that's the difference. I transfered them with ftp. So escaping the name on the web upload should fix it.
-
If you escape the character there you will see the backslah in the song list. Escape the file name in synchronized lights, in the play function
song_filename = song_filename.replace(" ", "\ ") -
Well it worked the first time I played the song then broke the second time?
-
found the problem What are valid values for the id attribute in HTML? For HTML 4, the answer is technically:
ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). HTML 5 is even more permissive, saying only that an id must contain at least one character and may not contain any space characters.
-
A hack, in maintest.js getSongs()
temp2=data.songs[i][1].split(' ').join('---')
temp+="<li data-theme='d'><a class='song' href='#' id="+temp2+">"+data.songs[i][0]+"</a></li>";And code.py Ajax/POST() we undo it
elif varariables.option == '1': slc.play_single(varariables.song.replace("---", " "))
of course that is just for playing a single song and it looks hackish at best
-
repo owner I found a much easier solution. just had to update maintest.js on line 63 to have a single quote before and after the id. This was already correct on line 160, but i must have missed it on line 63.
-
repo owner - changed status to resolved
pushed commit that updates maintest.js to have single quotes around the id on line 63
-
See I told you my js was not the greatest. I haven't used js in almost 8 years.
-
@stephen_burning lets make a deal If I touch the js you hit me. :)
- Log in to comment