Jump to content

IceCast Metatags - Not recognized?


.:HyPeX:.

Recommended Posts

So, hello everyone, so far i'm working on a streaming system, but the function "getSoundMetaTags" is returning empty, when it should work - VLC Player recognizes the song name and changes its title constantly.

http://i.imgur.com/xF54Msw.png

  
function table.size(tab) 
    local length = 0 
    for _ in pairs(tab) do length = length + 1 end 
    return length 
end 
  
  
local song = playSound("http://giss.tv:8000/EPGLiveRadio.mp3") 
setSoundVolume(song,0) 
local info = getSoundMetaTags(song) 
  
outputChatBox(type(info)) 
outputChatBox(table.size(info)) 
  
for i,v in pairs(info) do 
outputChatBox(i.." "..v) 
end 
  

Am i doing something wrong? i simply cant get any meta tags..

Link to comment
  • Moderators

- Did you test it with other sounds and formats?

- Try it to play it at 'onClientResourceStart' just to be sure.

- Try it as local file, because the lua code doesn't wait for it to load from the url.

etc.

There are a lot of conditions why it might not work. The only thing you can do is by check them all, till you find the solution/problem.

Link to comment

Rescripted it.

function table.size(tab) 
    local length = 0 
    for _ in pairs(tab) do length = length + 1 end 
    return length 
end 
  
addEventHandler('onClientResourceStart',resourceRoot,function() 
local song = playSound("http://giss.tv:8000/EPGLiveRadio.mp3") 
setSoundVolume(song,1) 
local info = getSoundMetaTags(song) 
  
outputChatBox(type(info)) 
outputChatBox(table.size(info)) 
  
for i,v in pairs(info) do 
outputChatBox(i.." "..v) 
end 
handl = song 
sx,sy = guiGetScreenSize() 
colors = { tocolor(255,0,0),tocolor(0,255,0) } 
  
start = getTickCount() 
 addEventHandler('onClientRender',root,clientRenderFunc) 
 end) 
  
  
function clientRenderFunc() 
local now = getTickCount() 
if now-start >= 4000 then 
start = getTickCount() 
end 
local px = (now-start)/4000 
local p = interpolateBetween(0,0,0,360,0,0,px,"Linear") 
    if(handl) then 
    local bt = getSoundFFTData(handl,2048,9) 
    if not bt then return end 
    if(not bt[1]) then return end 
    local i = 1 
    local scale = (sx/42.5)*0.75 
    local base = (sx*0.029411)*0.75 
            bt[i] = (bt[i]^0.5)*scale --scale it (sqrt to make low values more visible) 
            if not tonumber(bt[i]) then return end 
            dxDrawRectangle(sx*0.3, sy - sy*0.1,sx*0.4,sy*0.1,tocolor(0,0,0,150)) 
             
            dxDrawImage(sx/2 - (bt[i]+base)/2,sy/2 - (bt[i]+base)/2, base+bt[i],base+bt[i],"images/cd.png",p) 
    end 
end 
  

Tried things, apparently it worked, it was becouse the songs i was playing via the stream were without meta tags at all, however when i edited the meta tags and got a response at the local playing, i tried playing the same exact file via the stream and it came empty..

Tried again setting a timer and guess what, you were right, lua wasnt waiting for the meta tags to load.

Thanks a lot

HyPeX

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...