Thanks, Massimo! In my controller am I right in thinking I can have something like this:
def soundControl(): sound = db().select(db.sounds.ALL) query = db(db.sounds.id>0).select().first() AudioFile = db.sounds.filename.retrieve(query.filename)[1] soundToPlay = TAG['audio autoplay'](TAG.source(_src=AudioFile)) return dict(sound=soundToPlay) view: {{=sound}} This is what my HTML looks like and its not working: <audio source><source src="<open file 'C:\\web2py_src\\web2py\\applications\\soundplayer\\databases\\..\\uploads\\sounds.filename.a503ee3bea631f2e.646f6d696e6174696e672e776176.wav', mode 'rb' at 0x0000000009F00C90> <http://127.0.0.1:8000/uct6/board/%3Copen%20file%20'C://web2py_src//web2py//applications//uct6//databases//uploads//sounds.filename.a503ee3bea631f2e.646f6d696e6174696e672e776176.wav',%20mode%20'rb'%20at%200x0000000009F00C90%3E> "></source></audio source>' I'm guessing I need to perform one additional step to reference the actual file name in the database? On Monday, November 17, 2014 11:45:59 PM UTC-5, Massimo Di Pierro wrote: > > there is a function db.mytable.myfield.retrieve(row.myfield) > > > On Monday, 10 November 2014 10:51:53 UTC-6, LoveWeb2py wrote: >> >> Here is the code in the link: >> db.define_table('music', Field('name',required=True), >> Field('filename','upload',required=True), auth.signature) " > >> applications/audio/models/db_audio.py echo " response.menu = >> [('Home',0,URL('index'))] # allows to browser, search, and upload new music >> (if logged in) def index(): # tell web2py that links to music files are to >> be # represented as HTML5 audio embedded players from >> gluon.contrib.autolinks import expand_one db.music.filename.represent = >> lambda v,r: \ XML(expand_one(URL('download',args=v),{})) return dict(grid = >> SQLFORM.grid(db.music)) # perform login/logout/registration/etc. def >> user(): return dict(form=auth()) # allow streaming of all files, including >> partial content of music files @cache.action() def download(): return >> response.download(request, db) " > >> applications/audio/controllers/default.py >> After a file is uploaded into the DB. How could I access it via a view or >> controller? I tried using the dal, but it doesn't seem to work. Does my >> question make sense? >> >> On Wednesday, November 5, 2014 11:19:17 PM UTC-5, LoveWeb2py wrote: >>> >>> *Hello,* >>> >>> *I'd like to play an audio file in my view once a certain condition is >>> met.* >>> >>> *I'm using Massimo's audio setup (thank you, Massimo!!) found here:* >>> >>> *https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/ >>> >>> <https://www.reddit.com/r/Python/comments/1r7v23/audio_streaming_app_in_web2py_from_scratch/>* >>> >>> *How could I stream/play the audio from the database where I uploaded >>> the files. I would post my model/controller but its all in the link above.* >>> >> -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.