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

Reply via email to