EOL, unsupported.
Proof of concept:
function SBS_announcement( SBS_ip , -- IP address of SBS
SBS_port , -- CLI Port of SBS (default: 9090)
player_id , -- MAC address of player
message1 , -- line 1
message2 , -- line 2
message_duration, -- in seconds
file , -- audio announcement
file_duration ) -- duration of announcement in seconds
local socket=require('socket')
local client = socket.connect( SBS_ip, SBS_port )
function SBS_CLI( cmd )
client:send( cmd .. '\n' )
return client:receive()
end -- SBS_CLI
if ( message1 ~= '' ) and ( message1 ~= nil )
then
SBS_CLI( player_id .. ' display ' .. tostring(message1) .. ' ' .. tostring(message2) .. ' ' .. tostring( message_duration ) )
luup.sleep( message_duration * 1000 )
end
if ( file ~= '' ) and ( file ~= nil )
then
-- Save current state of player
local cur_power = SBS_CLI( player_id .. ' power ?' )
local cur_track = SBS_CLI( player_id .. ' playlist index ?' )
local cur_offset = SBS_CLI( player_id .. ' time ?' )
local cur_mode = SBS_CLI( player_id .. ' mode ?' )
-- Add announcement file to playlist
local playlist_add = SBS_CLI( player_id .. ' playlist add file://' .. file )
local tracks = SBS_CLI( player_id .. ' playlist tracks ?' )
tracks = tonumber( string.match( tracks, '%s(%d+)' ) )
-- Play announcement
local playlist_set = SBS_CLI( player_id .. ' playlist index ' .. tracks-1 )
luup.sleep( file_duration * 1000 )
-- Restore previous state of player
local playlist_del = SBS_CLI( player_id .. ' playlist delete ' .. tracks-1 )
local playlist_set = SBS_CLI( cur_track )
local time_set = SBS_CLI( cur_offset )
local mode_set = SBS_CLI( cur_mode )
local power_set = SBS_CLI( cur_power )
end
end -- SBS_announcement
SBS_announcement( '192.168.178.22' ,
9090 ,
'00:04:20:XX:XX:XX' ,
'Text%20for%20Line1' ,
'Text%20for%20Line2' ,
3 ,
'/volume1/public/Musik/anr.wav',
5 )
tbc.