Just complementing, if I try to add the "imeta" function to insert the metadata 
grabbed from MySQL on the stream, then the script won't compile. Script:

s = myplaylist
s = fallback(track_sensitive = false, [s, security])

# Create a function to insert metadata
ms = insert_metadata(s)
# The function to insert metadata
imeta = fst(ms)
# The source with inserted metadata
s = snd(ms)

# Function to get metadata from MySQL
def update_meta() =

  new_title = list.hd(
  get_process_lines(
    "mysql my_db -u user -ppassword -sNe \"SELECT Title FROM my_table WHERE 
id=1\""
  )
)

  new_artist = list.hd(
  get_process_lines(
    "mysql my_db -u user -ppassword -sNe \"SELECT Artist FROM my_table WHERE 
id=1\""
  )
)

  # Insert the metadata
  imeta([("title",new_title),("artist",new_artist)]) # Compiling points a 
"type" problem here (Line 43)

  #A debug message
  print("Insert metadata title = #{new_title}")
  print("Insert metadata artist = #{new_artist}")

  5.0
end

# Schedule the insert metadata process every 5.0 seconds
add_timeout(fast=false,5.0,update_meta)

output.icecast(%mp3..........


When I try to execute I get this:

At line 43, char 9-51:
  this value has type
    [(_*((default:_)->_))]
  but it should be a subtype of
    [(_*string)]

Maybe I have to change the "list.hd( get_process_lines..." to return the 
correct format?
Note that this was the way I was using in liquidsoap 1.1.1 and it was working.

________________________________
De: Bruno Lima <bruno_nl...@hotmail.com>
Enviado: quinta-feira, 20 de setembro de 2018 15:27
Para: savonet-users@lists.sourceforge.net
Assunto: Re: [Savonet-users] Metadata update function stops

I'm using liquidsoap 1.3.4 now but there seems to be some problem in the way 
I'm getting metadata from MySQL. The function I'm using is the following:

# Function to get metadata from MySQL
def update_meta() =

  new_title = list.hd(
  get_process_lines(
    "mysql my_db -u user -ppassword -sNe \"SELECT Title FROM my_table WHERE 
id=1\""
  )
)

  new_artist = list.hd(
  get_process_lines(
    "mysql my_db -u user -ppassword -sNe \"SELECT Artist FROM my_table WHERE 
id=1\""
  )
)

  #A debug message
  print("Insert metadata title = #{new_title}")
  print("Insert metadata artist = #{new_artist}")

  5.0
end

Problem is, in the log it keeps printing:
Insert metadata title = <fun>
Insert metadata artist = <fun>

Probably it is getting something wrong in that "get_process_lines" requisition 
but I have no idea why..
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to