Playing back stored WAV files

classic Classic list List threaded Threaded
24 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Playing back stored WAV files

rdwyer
After inserting WAV files into a MySQL table (blob field) using a doc  
type of "audio/x-wav", I want to retrieve them so the user can listen  
to them by clicking a link.


I am not quite sure how to retrieve them though.

Currently, after SELECT the file from the table, I set the file to  
variable as follows:

var:'wavfile'=(decode_base64:(field: 'stored_wav'));

I'm not so sure Base64 is correct here or how to translate that  
variable to a streaming audio file via link click.

Has anybody else tried this before?

Thank,
Rick

--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 10:04 AM:

> After inserting WAV files into a MySQL table (blob field) using a doc
> type of "audio/x-wav", I want to retrieve them so the user can listen to
> them by clicking a link.
>
>
> I am not quite sure how to retrieve them though.
>
> Currently, after SELECT the file from the table, I set the file to
> variable as follows:
>
> var:'wavfile'=(decode_base64:(field: 'stored_wav'));
>
> I'm not so sure Base64 is correct here or how to translate that variable
> to a streaming audio file via link click.
>
> Has anybody else tried this before?
>
> Thank,
> Rick
>


How did you INSERT the wav files?  Did you encode_base64 them?  And what is the column type?  If you're storing them "raw" then the column should be BLOB, if you're storing them as base64 encoded, you can use a TEXT column.

How you serve them is by creating two Lasso pages.  The first one serves the WAV file and will look like:

        [ // wav.lasso
        var('wavID') = 0; // make this a value that won't be found in the table
        protect;
                var('wavID') = lp_var_unpack(action_params->get(1),'mypassword');
        /protect;
        inline(...,'id'=$wavID, -search);
                if(found_count);
                        var('wav') = column('wavdata');
                        var('wavname') = column('wavname');
                else;
                        'Sorry, wav not found.';
                        abort;
                /if;
        /inline;
        file_serve($wavdata,-file=$wavname,-type='audio/x-wav');
        ]


The second one serves the link:

        [ // wavlist.lasso -- list of wavs to play
                inline(...,-findall);
                        'WAVs to listen to:<br>';
                        rows;
                                '<a href="wav.lasso?'+lp_var_pack(column('id'),'mypassword')+'">' + column('wavname') + '</a><br>';
                        /rows;
                /inline;
        ]


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Doug Gentry
In reply to this post by rdwyer
Just curious... wouldn't it be better to save your .wav files in a  
directory, and just store the path and filename in the database? Much  
as we often do for images?

...Doug

On May 27, 2008, at 8:04 AM, Rick Dwyer wrote:

> After inserting WAV files into a MySQL table (blob field) using a  
> doc type of "audio/x-wav", I want to retrieve them so the user can  
> listen to them by clicking a link.
>
>
> I am not quite sure how to retrieve them though.
>
> Currently, after SELECT the file from the table, I set the file to  
> variable as follows:
>
> var:'wavfile'=(decode_base64:(field: 'stored_wav'));
>
> I'm not so sure Base64 is correct here or how to translate that  
> variable to a streaming audio file via link click.
>
> Has anybody else tried this before?
>
> Thank,
> Rick
>


---
Doug Gentry
Dynapolis & Southern Oregon University
p:  541-261-8501 / Toll Free: 866-890-6013
[hidden email]
www.dynapolis.com - blog: www.plain-sense.com



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer
Yes, that is how I am currently doing it.  But was trying the SQL  
storage method to try and keep things "tidier".
Rick
On May 27, 2008, at 11:56 AM, Doug Gentry wrote:

> Just curious... wouldn't it be better to save your .wav files in a  
> directory, and just store the path and filename in the database?  
> Much as we often do for images?
>
> ...Doug
>
> On May 27, 2008, at 8:04 AM, Rick Dwyer wrote:
>
>> After inserting WAV files into a MySQL table (blob field) using a  
>> doc type of "audio/x-wav", I want to retrieve them so the user can  
>> listen to them by clicking a link.
>>
>>
>> I am not quite sure how to retrieve them though.
>>
>> Currently, after SELECT the file from the table, I set the file to  
>> variable as follows:
>>
>> var:'wavfile'=(decode_base64:(field: 'stored_wav'));
>>
>> I'm not so sure Base64 is correct here or how to translate that  
>> variable to a streaming audio file via link click.
>>
>> Has anybody else tried this before?
>>
>> Thank,
>> Rick
>>
>
>
> ---
> Doug Gentry
> Dynapolis & Southern Oregon University
> p:  541-261-8501 / Toll Free: 866-890-6013
> [hidden email]
> www.dynapolis.com - blog: www.plain-sense.com
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer
In reply to this post by Doug Gentry
Doug,
I can serve wav files from my web serving root, but how do I do so for  
a wav file outside the root using the method of an a href link below:

<a href="/file.wav">click me</a>

I know Bil, you provide code to "Serve" from a DB, but I want to have  
the file play in the browser instead of download.  The link I have  
above will do that, but only if serving from the web serving root.

So assuming my User, File Path, and Tags are set correctly to allow  
for file access outside the root to a particular directory where my  
wav file is located, how would I specify that value in the link  
example above?
Can't really do:
<a href="///customers/customer1/file.wav">click me</a>

Rick



On May 27, 2008, at 11:56 AM, Doug Gentry wrote:

> Just curious... wouldn't it be better to save your .wav files in a  
> directory, and just store the path and filename in the database?  
> Much as we often do for images?
>
> ...Doug
>
> On May 27, 2008, at 8:04 AM, Rick Dwyer wrote:
>
>> After inserting WAV files into a MySQL table (blob field) using a  
>> doc type of "audio/x-wav", I want to retrieve them so the user can  
>> listen to them by clicking a link.
>>
>>
>> I am not quite sure how to retrieve them though.
>>
>> Currently, after SELECT the file from the table, I set the file to  
>> variable as follows:
>>
>> var:'wavfile'=(decode_base64:(field: 'stored_wav'));
>>
>> I'm not so sure Base64 is correct here or how to translate that  
>> variable to a streaming audio file via link click.
>>
>> Has anybody else tried this before?
>>
>> Thank,
>> Rick
>>
>
>
> ---
> Doug Gentry
> Dynapolis & Southern Oregon University
> p:  541-261-8501 / Toll Free: 866-890-6013
> [hidden email]
> www.dynapolis.com - blog: www.plain-sense.com
>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

dguardiola

Le 27 mai 08 à 20:30, Rick Dwyer a écrit :

> Doug,
> I can serve wav files from my web serving root, but how do I do so  
> for a wav file outside the root using the method of an a href link  
> below:
>
> <a href="/file.wav">click me</a>

Rick, JQuery is your friend, as ever...

This is not really what you asked for but it's a simple and (great  
english word) unobstrusive way to stream sounds :

http://www.sean-o.com/jquery/jmp3/

It uses a mini open-source flash player
Oh right, it's not for WAV... MP3 will save your disk space :)



--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
In reply to this post by rdwyer
Rick Dwyer wrote on 5/27/2008 1:30 PM:
> So assuming my User, File Path, and Tags are set correctly to allow for
> file access outside the root to a particular directory where my wav file
> is located, how would I specify that value in the link example above?
> Can't really do:
> <a href="///customers/customer1/file.wav">click me</a>

The process is identical:


The first one serves the WAV file and will look like:

    [ // wav.lasso
    var('wavName') = '';
    protect;
        var('wavName') = lp_var_unpack(action_params->get(1),'mypassword');
    /protect;
    if($wavName->size == 0);
        'Sorry, wav not found.';
        abort;
    /if;
    var('wavData') = bytes;
    protect;
        $wavData = file_read($wavName);
    /protect;
    file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
    ]


The second one serves the link:

    [ // wavlist.lasso -- list of wavs to play
         '<a href="wav.lasso?'+lp_var_pack('///customers/customer1/file.wav','mypassword')+'">' + 'My Awesome WAV' + '</a><br>';
    ]


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer
Is lp_var_unpack a custom tag?  I have not seen it before.

On May 27, 2008, at 2:51 PM, Bil Corry wrote:

> Rick Dwyer wrote on 5/27/2008 1:30 PM:
>> So assuming my User, File Path, and Tags are set correctly to allow  
>> for file access outside the root to a particular directory where my  
>> wav file is located, how would I specify that value in the link  
>> example above?
>> Can't really do:
>> <a href="///customers/customer1/file.wav">click me</a>
>
> The process is identical:
>
>
> The first one serves the WAV file and will look like:
>
>   [ // wav.lasso
>   var('wavName') = '';
>   protect;
>       var('wavName') = lp_var_unpack(action_params-
> >get(1),'mypassword');
>   /protect;
>   if($wavName->size == 0);
>       'Sorry, wav not found.';
>       abort;
>   /if;
>   var('wavData') = bytes;
>   protect;
>       $wavData = file_read($wavName);
>   /protect;
>   file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
>   ]
>
>
> The second one serves the link:
>
>   [ // wavlist.lasso -- list of wavs to play
>        '<a href="wav.lasso?'+lp_var_pack('///customers/customer1/
> file.wav','mypassword')+'">' + 'My Awesome WAV' + '</a><br>';
>   ]
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer

On May 27, 2008, at 2:59 PM, Rick Dwyer wrote:
> Is lp_var_unpack a custom tag?  I have not seen it before.

Please disregard, I found it on tagswap.


>
>
> On May 27, 2008, at 2:51 PM, Bil Corry wrote:
>> Rick Dwyer wrote on 5/27/2008 1:30 PM:
>>> So assuming my User, File Path, and Tags are set correctly to  
>>> allow for file access outside the root to a particular directory  
>>> where my wav file is located, how would I specify that value in  
>>> the link example above?
>>> Can't really do:
>>> <a href="///customers/customer1/file.wav">click me</a>
>>
>> The process is identical:
>>
>>
>> The first one serves the WAV file and will look like:
>>
>>  [ // wav.lasso
>>  var('wavName') = '';
>>  protect;
>>      var('wavName') = lp_var_unpack(action_params-
>> >get(1),'mypassword');
>>  /protect;
>>  if($wavName->size == 0);
>>      'Sorry, wav not found.';
>>      abort;
>>  /if;
>>  var('wavData') = bytes;
>>  protect;
>>      $wavData = file_read($wavName);
>>  /protect;
>>  file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
>>  ]
>>
>>
>> The second one serves the link:
>>
>>  [ // wavlist.lasso -- list of wavs to play
>>       '<a href="wav.lasso?'+lp_var_pack('///customers/customer1/
>> file.wav','mypassword')+'">' + 'My Awesome WAV' + '</a><br>';
>>  ]
>>
>> - Bil
>>
>>
>> --
>> This list is a free service of LassoSoft: http://www.LassoSoft.com/
>> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
>> Manage your subscription: http://www.ListSearch.com/Lasso/
>>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 2:05 PM:
>
> On May 27, 2008, at 2:59 PM, Rick Dwyer wrote:
>> Is lp_var_unpack a custom tag?  I have not seen it before.
>
> Please disregard, I found it on tagswap.

It's just a handy way to encrypt/decrypt values.  One thing I forgot though, it works for forms, but not URLs, so you have to url_encode it:


   [ // wavlist.lasso -- list of wavs to play
        '<a href="wav.lasso?'+encode_url(lp_var_pack('///customers/customer1/file.wav','mypassword'))+'">' + 'My Awesome WAV' + '</a><br>';
   ]


I have it on my to-do list to offer a URL-safe option (thanks Brett Harvey! :).



- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer

On May 27, 2008, at 3:14 PM, Bil Corry wrote:
> Rick Dwyer wrote on 5/27/2008 2:05 PM:
>> On May 27, 2008, at 2:59 PM, Rick Dwyer wrote:
>>> Is lp_var_unpack a custom tag?  I have not seen it before.
>> Please disregard, I found it on tagswap.
>
> It's just a handy way to encrypt/decrypt values.  One thing I forgot  
> though, it works for forms, but not URLs, so you have to url_encode  
> it:

It's just not working for me.  The browser downloads a file, but the  
it is empty... even if I forgo the link and hardcode the path of the  
wav file.

Even if I get it to download the wav file, it's not quite  
accomplishing what I wanted to do with the simple  
<...href="file.wav">click me</a>.  This method will play the way file  
(via the QT translator) right in the browser window without a download.

Essentially, I am trying to achieve the same thing with a file outside  
the webserving root by playing it in the browser and not downloading it.

Rick











>
>
>
>  [ // wavlist.lasso -- list of wavs to play
>       '<a href="wav.lasso?'+encode_url(lp_var_pack('///customers/
> customer1/file.wav','mypassword'))+'">' + 'My Awesome WAV' + '</
> a><br>';
>  ]
>
> I have it on my to-do list to offer a URL-safe option (thanks Brett  
> Harvey! :).
>
>
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 2:56 PM:
> It's just not working for me.  The browser downloads a file, but the it
> is empty... even if I forgo the link and hardcode the path of the wav file.

Here's a simple demo:

<http://corry.biz/wavtest.lasso>

Code is below.  Be sure to assign appropriate permissions.


- Bil



[
if(client_getparams->size);
        var('wavName') = '';
        protect;
                var('wavName') = lp_var_unpack(client_getparams->get(1),'secretpassword');
        /protect;
        if($wavName->size == 0);
                'Sorry, wav not found.';
                abort;
        /if;
        var('wavData') = bytes;
        protect;
                $wavData = file_read($wavName);
        /protect;
        if($wavData->size == 0);
                'Sorry, wav not found.';
                abort;
        /if;
        file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
/if;
]

<a href="wavtest.lasso?[encode_url(lp_var_pack('wavtest.wav','secretpassword'))]">My Awesome WAV</a><br>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer
Thanks for the example Bil.  I think my problem is how I am trying to  
send the wav file in the link.  Below is my code on the Link page.  
Essentially, I am reading the wav file to a variable and sending it in  
the link.  But my target page returns the error: Request-URI Too Large  
because it's loading the wav as binary (I think) data... ex.

/wavtest.lasso?NreNGo8Z6URJxqfvyEf4zGm/5O5ehrmH/nf%2BbIFOKVKfq
%2BFjHSaOsohMVappqJ1NBwv3xm0AOb9EaExOWtM2mSZgm6CNfSUvCTyjFCn5XMfe0bPEa9CNN89AlsyhPT1YTPDZlSvKvf37cnmlAEaXmUIRS/QNsk%2Br5bscYZKsij9rulj2SUIigZ60VLLlI1Ir98bGwLnxw7WWQM8vZvRJjr9LNglBSoaot5VHSK/oBWMtfqUjqCtUpbKCPPjfRO10ehtGq3QN28/eIdn6twuCwluPWIzlXv%2BSphbfEoM0uwpV8tIOvgLuyAu30KH/xkpxptr1B54FhPyzZ2BmZY9j4F77q0jZLAfLpXevx0mE0dk9Q/2m3sS2Y7srf7PsM/0mUbz4GNSSiZd7Cxb7hwgd7zoZigg4dtRvOnrmDjD8G0d2IGo0DQyLpwE

I apologize in advance for the level of "hand holding" here, but I am  
not clear on how to pass the wav.




[



Inline:
        -Username = 'my_username',
        -Password = 'my_pass';
       
Variable: 'FilePathNewDirectory' = '///VPD/1/confirm.wav';
Var: 'wav_file' = (String);
Var: 'V_FileTemp' = (File: (Variable: 'FilePathNewDirectory'),  
File_OpenRead, File_ModeChar);
Var: 'V_DocType' = 'audio/x-wav';
Var: 'wav_filename' = 'confirm.wav';
Var: 'wav_file' = '';

(var:'wav_fileSize')=($V_FileTemp)->Size;
Var: 'wav_file' = ($V_FileTemp->(Read:($wav_fileSize)));
$V_FileTemp->Close;

/inline;

]
<a href="wavtest.lasso?
[encode_url(lp_var_pack($wav_file,'secretpassword'))]">My Awesome WAV</
a><br>





On May 27, 2008, at 7:35 PM, Bil Corry wrote:

> Rick Dwyer wrote on 5/27/2008 2:56 PM:
>> It's just not working for me.  The browser downloads a file, but  
>> the it is empty... even if I forgo the link and hardcode the path  
>> of the wav file.
>
> Here's a simple demo:
>
> <http://corry.biz/wavtest.lasso>
>
> Code is below.  Be sure to assign appropriate permissions.
>
>
> - Bil
>
>
>
> [
> if(client_getparams->size);
> var('wavName') = '';
> protect;
> var('wavName') = lp_var_unpack(client_getparams-
> >get(1),'secretpassword');
> /protect;
> if($wavName->size == 0);
> 'Sorry, wav not found.';
> abort;
> /if;
> var('wavData') = bytes;
> protect;
> $wavData = file_read($wavName);
> /protect;
> if($wavData->size == 0);
> 'Sorry, wav not found.';
> abort;
> /if;
> file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
> /if;
> ]
>
> <a href="wavtest.lasso?
> [encode_url(lp_var_pack('wavtest.wav','secretpassword'))]">My  
> Awesome WAV</a><br>
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 7:41 PM:
 > I apologize in advance for the level of "hand holding" here, but I am
> not clear on how to pass the wav.

The idea is to pass the name of the wav, including the path, so "///clients/clientA/wav1.wav", not the content of the wav.  Then on the other side, you use the filename to retrieve the wav data and serve it.

So the code you posted would become this instead:

        [Variable: 'FilePathNewDirectory' = '///VPD/1/confirm.wav']
        <a href="wavtest.lasso?[encode_url(lp_var_pack($FilePathNewDirectory,'secretpassword'))]">My Awesome WAV</a><br>

Then wavtest.lasso needs to extract the filename, file_read the contents, and serve it.  Just be sure that the user never gets to specify the file name, otherwise they can have your code serve up password files, etc.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer

On May 27, 2008, at 11:31 PM, Bil Corry wrote:
> Rick Dwyer wrote on 5/27/2008 7:41 PM: > I apologize in advance for  
> the level of "hand holding" here, but I am
>> not clear on how to pass the wav.
>
> The idea is to pass the name of the wav, including the path, so "///
> clients/clientA/wav1.wav", not the content of the wav.  Then on the  
> other side, you use the filename to retrieve the wav data and serve  
> it.
>

Yes, after examining your example closing I realized that to be the  
case.  However, the below example, which I believe is what you  
describe does not work.

My page called by the link:
[

        inline: -Username='myusername',
                        -Password='mypassword';
                       
   var('wavName') = '';
   protect;
       var('wavName') = lp_var_unpack(action_params-
 >get(1),'mypassword');
   /protect;
   if($wavName->size == 0);
       'Sorry, wav not found.';
       abort;
   /if;
   var('wavData') = bytes;
   protect;
       $wavData = file_read($wavName);
   /protect;
   file_serve($wavData,-file=$wavname,-type='audio/x-wav');
        /inline;
   ]



My page containing the link:

<a href="wavtarget.htm?[encode_url(lp_var_pack('///
OutsideRootDirectory/1/mywavfile.wav','secretpassword'))]">My Wave  
File Link</a><br>


I simply get the "Sorry, wav not found."

Rick





> So the code you posted would become this instead:
>
> [Variable: 'FilePathNewDirectory' = '///VPD/1/confirm.wav']
> <a href="wavtest.lasso?
> [encode_url
> (lp_var_pack($FilePathNewDirectory,'secretpassword'))]">My Awesome  
> WAV</a><br>
> Then wavtest.lasso needs to extract the filename, file_read the  
> contents, and serve it.  Just be sure that the user never gets to  
> specify the file name, otherwise they can have your code serve up  
> password files, etc.
>
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 10:41 PM:
> I simply get the "Sorry, wav not found."

Passwords don't match, one is "mypassword" and the other is "secretpassword" -- they must match to work.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer

On May 27, 2008, at 11:49 PM, Bil Corry wrote:
> Rick Dwyer wrote on 5/27/2008 10:41 PM:
>> I simply get the "Sorry, wav not found."
>
> Passwords don't match, one is "mypassword" and the other is  
> "secretpassword" -- they must match to work.

My bad.  That was just a typo when copying and pasting between  
copies.  They both use the same password.
When I display [action_params] at the top of the target page I get the  
following:

array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:  
(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),  
(pair: (NrfwPY8Z1xBseAgdTrmmiR2rzlKxVRdo01FSUwgAcEESDdN1yaa2VHhUcR
+3QxinIYNPjZbmdx2/XCUVOAbLsIP4pw)=())

Is the -Nothing value causing the problem?
Rick


>
>
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 11:08 PM:
> Is the -Nothing value causing the problem?

Ah, yes, I discovered the code I originally posted didn't work (it was untested).  When I created the sample page, I rewrote it to correct a couple of deficiencies, so you should probably rewrite yours around the newer code.

For example, instead of:

        action_params->get(1)

It should be:

        client_getparams->get(1)

And I added in an additional check to prevent serving an empty wav file.  There may have been other changes as well...


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

rdwyer

On May 28, 2008, at 12:24 AM, Bil Corry wrote:

> Rick Dwyer wrote on 5/27/2008 11:08 PM:
>> Is the -Nothing value causing the problem?
>
> Ah, yes, I discovered the code I originally posted didn't work (it  
> was untested).  When I created the sample page, I rewrote it to  
> correct a couple of deficiencies, so you should probably rewrite  
> yours around the newer code.
>
> For example, instead of:
>
> action_params->get(1)
>
> It should be:
>
> client_getparams->get(1)
>
> And I added in an additional check to prevent serving an empty wav  
> file.  There may have been other changes as well...


With the following:

[

inline: -Username='usern',
                        -Password='pass';
                       
if(client_getparams->size);
        var('wavName') = '';
        protect;
                var('wavName') = lp_var_unpack(client_getparams-
 >get(1),'secretpassword');
        /protect;
        $wavName;
        if($wavName->size == 0);
                'Sorry, wav not found.';
                abort;
        /if;
       
        var('wavData') = bytes;
        protect;
                $wavData = file_read($wavName);
        /protect;
        if($wavData->size == 0);
                'Sorry, wav not found.';
                abort;
        /if;
        file_serve($wavData,-file=$wavname,-type='audio/x-wav',-inline);
/if;
/inline;
]

I still get "Sorry, wav not found".  When I remove the first set of  
protect tags, the lp_var_unpack returns "No tag, type or constant was  
defined under the name "lp_error_clearError".
The lp_error_clearError is not a tag I use.

Rick





>
>
>
> - Bil
>
>
> --
> This list is a free service of LassoSoft: http://www.LassoSoft.com/
> Search the list archives: http://www.ListSearch.com/Lasso/Browse/
> Manage your subscription: http://www.ListSearch.com/Lasso/
>


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

Reply | Threaded
Open this post in threaded view
|

Re: Playing back stored WAV files

Bil Corry-3
Rick Dwyer wrote on 5/27/2008 11:44 PM:
> "No tag, type or constant was
> defined under the name "lp_error_clearError".
> The lp_error_clearError is not a tag I use.

You'll find it here (these are all the lp_ ctags):

        <http://tagswap.net/bil_corry>

On the next rewrite of the entire library, [lp_error_clearError] will go away as there's now a built-in tag [error_reset] which does the same thing.


- Bil


--
This list is a free service of LassoSoft: http://www.LassoSoft.com/
Search the list archives: http://www.ListSearch.com/Lasso/Browse/
Manage your subscription: http://www.ListSearch.com/Lasso/

12