Note that there is a colon := before the = in the function.

Nick

On Sun, Mar 24, 2019 at 11:38 AM Nicholas Vrtis <nick.vr...@gmail.com>
wrote:

> I am not sure how you are supplying filenames.  I do all the queuing in a
> node/javascript backend. So when SOAP wants to know which file is next, it
> does an HTTP request and I return the file name and pass along the SQL
> rowid.  That way, when SOAP starts playing it, I have ON-TRACK which picks
> the rowid from the meta and sends it back to the node backend to update.
>
> In looking at your question closer though, it looks like you have a
> different problem.  Assuming line 40 is the CMD= line, 'filename' is local
> to the process_metadata function, which means it isn't defined outside that.
>
> You need to (in the main body)
> filename=ref "*"
>
> and then in process_metadata
>
> filename := metadata["filename"]
>
> Hope this helps.
>
> Nick
>
> On Sun, Mar 24, 2019 at 8:50 AM Ian Bonham <ian.bon...@gmail.com> wrote:
>
>> Thanks Nick,
>>
>> Not sure I get what you mean though?
>>
>> Ian
>>
>> On Sat, 23 Mar 2019 at 22:40, Nicholas Vrtis <nick.vr...@gmail.com>
>> wrote:
>>
>>> Don't have the code with me.. but I do something similar. I use the
>>> annotate: protocol when SOAP asks for the file name, and pass along the SQL
>>> row ID from the db. That puts it in the meta.
>>>
>>> Nick
>>>
>>> On Saturday, March 23, 2019, Ian Bonham <ian.bon...@gmail.com> wrote:
>>>
>>>> Good afternoon all,
>>>>
>>>> I wonder if anyone could offer some advice please?
>>>> I'm building a recipe for 'Soap and it's working rather well. However I
>>>> would like to know if there is a way to grab the currently playing file
>>>> name as it begins?
>>>> Basically I have a MariaDB with all my tracks in, and I want to use a
>>>> system call from my .liq script to push a mysql update via bash to update
>>>> the database with the "Last Played" datetime.
>>>>
>>>> I am trying :
>>>> *#!/usr/bin/liquidsoap -v*
>>>>
>>>> *def process_metadata(metadata)*
>>>> *    file_name = ""*
>>>> *    file_name = metadata["filename"]*
>>>> *#    [("file_name","#{file_name}")]*
>>>> *end*
>>>>
>>>> and then am using :
>>>> *stream = on_track(process_metadata, stream)*
>>>>
>>>> *cmd = "mysql -u suffolksoundadmin -phackme -e \"UPDATE
>>>> \`Music\`.\`Tracks\` SET \`playcount\` = \`playcount\` +1, \`lastplay\` =
>>>> NOW() WHERE \`Music\`.\`Tracks\`.\`filename\` = '#{file_name}';\""*
>>>>
>>>> *system(cmd)*
>>>>
>>>> I just can't get the thing to work though. When I try to call the
>>>> script, it bombs out with:
>>>> *At line 40, char 7-198: the variable filename used here has not been*
>>>> *  previously defined.*
>>>>
>>>> If anyone could offer some guidance I'd be really grateful.
>>>> Many Thanks,
>>>>
>>>> Ian
>>>>
>>>> _______________________________________________
>>> Savonet-users mailing list
>>> Savonet-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>>
>>
>>
>> --
>>
>>
>> Kindest Regards,
>>
>> Ian Bonham
>>
>> ian.bon...@gmail.com
>>
>> Mobile : +44 (0)7396 103 957
>> Skype : ian.bonham
>> _______________________________________________
>> Savonet-users mailing list
>> Savonet-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to