Hi Martin,
Thank you for the suggestion -- when I do that, I get a different error:
> At sparetire.liq, line 21, char 84-89:
> Error 5: this value has type
> unit (inferred at sparetire.liq, line 19, char 8-37)
> but it should be a subtype of
> source(_)
Is it complaining about the signature of my callback? I'm not sure how to adapt
it.
Thanks very much for your help!
Erik
On Thu, Jun 9, 2022, at 2:09 PM, Martin Kirchgessner wrote:
> Hello Erik,
>
> Have you tried radio.on_track(post_metadata) ?
>
>
> Martin
>
> Erik Schoster a écrit le 09/06/2022 à 18:01 :
>> Hi all,
>>
>> Happy liquidsoap user here, thank you for a wonderful system!
>>
>> I'm trying out upgrading from 1.x to 2.x and am running into a problem with
>> a call to on_track in my old script.
>>
>> Under liquidsoap 2.0.5 running my script results in:
>>
>>> At sparetire.liq, line 19, char 8-17:
>>> Error 4: Undefined variable on_track
>>
>> Removing the call to on_track allows the script to run. I'm using it to pass
>> the metadata from the most recently played track to a python script which
>> relays it elsewhere for display on a website.
>>
>> I looked through the documentation and upgrade notes and couldn't seem to
>> find info about this, my apologies if it's already documented somewhere!
>>
>> My complete script looks like (with some things removed):
>>
>>> #!/usr/bin/liquidsoap
>>>
>>> set('encoder.encoder.export', ['artist', 'title', 'album', 'composer',
>>> 'comment'])
>>> set('log.file.path', '')
>>> set('log.stdout', false)
>>> set('harbor.bind_addr', '127.0.0.1')
>>>
>>> url = '
>>> streamuser = ''
>>> streampass = ''
>>>
>>> sparetirerandom = nrj(playlist('playlist.m3u', mode='normal',
>>> reload_mode='watch'))
>>> radio = mksafe(sparetirerandom)
>>>
>>> def post_metadata(m) =
>>> system("/usr/bin/python3 sparetire_info.py "^quote(m['artist'])^"
>>> "^quote(m['title'])^" "^quote(m['album'])^" "^quote(m['composer'])^"
>>> "^quote(m['comment']))
>>> end
>>>
>>> radio = on_track(post_metadata(), radio)
>>>
>>> output.icecast(%mp3(bitrate=256, samplerate=44100, internal_quality=0,
>>> id3v2=true), radio,
>>> host='localhost', port=8000, user=streamuser, password=streampass,
>>> description='SPARETIRE radio', url=url, genre='Freeform',
>>> mount='sparetire', name='SPARETIRE radio')
>>
>> Is there another way I can accomplish passing metadata to my python script?
>> Thank you!
>>
>> Erik
>>
>>
>> _______________________________________________
>> Savonet-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>
>
>
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users