Hi,

Your code is equivalent to

if '$(if $(display_title),"$(display_title)","blank")' == "blank" then
source2 = drop_metadata(source)
end

and you don't use source2 in the following. In your script, the name
"source2" just happens to be "source" but the orginial source isn't
changed: a new source, without metadata is createad, and you don't use
it. Thus the (justified) error.

So, I don't think that your approach can be made to work. In your
case, I would use map_metadata with something like (untested):

def drop_blank_title(m) =
  if m["title"] == "" then [] else m
end

source = map_metadata(drop_blank_title, source)

The metadata are always mapped. They just happend not to be changed
when the title is not "".

++

Sam.


2011/10/30 KJ Koning <[email protected]>:
> In my Liquidsoap script, I am using map_metadata to send the title and
> artist from annotate instead of ID3 tags. An issue has come up where there
> are times I want to play a file, but I don't want to send any metadata. When
> I pass nothing or a blank "display_title" annotate, Shoutcast records the
> song as " - ". I believe this is because Liquidsoap is sending a blank
> artist and title. This is with insert_missing=false or insert_missing=true
> set for map_metadata. When I add strip=true to map_metadata, Liquidsoap
> seems to send "Unknown" to the Shoutcast server.
> I've even tried something like this at the end of my script before the
> output:
> if '$(if $(display_title),"$(display_title)","blank")' == "blank" then
> source = drop_metadata(source)
> end
> But I get this error:
> At line 159, character 9: The variable source defined here is not used
>   anywhere in its scope. Use ignore(...) instead of source = ... if you
> meant
>   to not use it. Otherwise, this may be a typo or a sign that your script
>   does not do what you intend.
> Line 159 is:  source = drop_metadata(source)
> Is there a better way to handle the times when I don't want to send metadata
> for specific tracks?
> Thanks!
> ------------------------------------------------------------------------------
> Get your Android app more play: Bring it to the BlackBerry PlayBook
> in minutes. BlackBerry App World&#153; now supports Android&#153; Apps
> for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple
> it is! http://p.sf.net/sfu/android-dev2dev
>
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
>

------------------------------------------------------------------------------
Get your Android app more play: Bring it to the BlackBerry PlayBook 
in minutes. BlackBerry App World&#153; now supports Android&#153; Apps 
for the BlackBerry&reg; PlayBook&#153;. Discover just how easy and simple 
it is! http://p.sf.net/sfu/android-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to