That was very helpful. I can now hear music! The regex so far has just been working so I haven't messed with it. Thanks for the suggestion, I will look into better ways to manage the XML.
Thanks Leonel! On Wednesday, December 11, 2013 7:08:11 PM UTC-5, Leonel Câmara wrote: > > Heres an example > > def stream(): > """ > Stream an mp3 from an absolute path given as var > WARNING: This is definitely unsafe as it doesn't care what that path > is at all. > WARNING: Seriously this is just an example, don't use it. > """ > import os > if os.path.exists(request.vars.path): > response.headers['Content-Type'] = 'audio/mpeg3' > return response.stream(open(request.vars.path, 'rb'), > chunk_size=4096) > else: > raise HTTP(404) > > > By the way, after looking at your code, I have to say, you really > shouldn't use regexes to parse XML, it's really not their purpose. It's > quite simple to refactor that using cElementTree or any other xml parser. > > Good luck with your project! > > Quarta-feira, 11 de Dezembro de 2013 0:11:46 UTC, Cliff escreveu: >> >> Hello. >> >> I am new to both python and web2py but have been playing with it a bit. I >> have made a simple program to listen to like artists from lastfm's API. I >> store my mp3s in a database: Artist/Track/File. It will go through my mp3s >> and find like songs and play them with jPlayer. I am stuck at playing the >> songs with jPlayer. It is trying to play my songs from >> /media/Music/artist/track.mp3 which is out of web2py's static dir. What >> would be the best way to allow web2py to access these files? If you had any >> examples that would be great. >> >> An example of the error: HTTP load failed with status 404. Load of media >> resource https://IP:8080/media/Music/mp3/Artist/Song.mp3 failed. >> (removed IP and artist/song since they were not important) >> >> This will only be used by me and on my local server so I am not concerned >> with the security issues of accessing files outside of static. >> >> >> Thanks! >> >> Cliff >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

