Jump to content

How to get the music's name from the radio?


King12

Recommended Posts

as far as i know you can't get title of mp3 file without meta.title unless you write the title by yourself in your own variable(but i wouldnt do that when streaming an online url, only when playing sound which is in your resource folder)

sorry if i didn't correctly understand what you meant.

Link to comment
as far as i know you can't get title of mp3 file without meta.title unless you write the title by yourself in your own variable(but i wouldnt do that when streaming an online url, only when playing sound which is in your resource folder)

sorry if i didn't correctly understand what you meant.

I've made this for now

  
function radiotest() 
    radio = playSound ("http://9aaaaa:29223/listen.pls") 
    local meta = getSoundMetaTags(radio) 
    outputChatBox("Current Music :"..(meta.stream_title).."!", 255, 0, 0, true) 
end 
addCommandHandler("radio", radiotest) 
  

But I still get this error at debugscript

ERROR: stream\draw.lua:4: attempt to concatenate field 'stream_title"(a nil value)

Edited by Guest
Link to comment
  
function radiotest() 
    radio = playSound ("http://listen.HouseTime.fm/dsl.pls") 
    local meta = getSoundMetaTags(radio) 
    outputChatBox("Current Music :"..(meta.stream_title).."!", 255, 0, 0, true) 
end 
addEventHandler("onClientSoundChangedMeta", root, radiotest) 

No error messages.

Link to comment
  
function radiotest() 
    radio = playSound ("http://listen.HouseTime.fm/dsl.pls") 
    local meta = getSoundMetaTags(radio) 
    outputChatBox("Current Music :"..(meta.stream_title).."!", 255, 0, 0, true) 
end 
addEventHandler("onClientSoundChangedMeta", root, radiotest) 

No error messages.

This means that the URL isn't providing any stream_title.

I just want to get this value

oKDqWO3.jpg

It says your stream is private. I also can't hear anything when I play the stream, so I think there's something wrong with your stream...

My friend has just stopped the stream few mins ago.

It was working on my server but I can't extract the music name to the chatbox.

Link to comment
function radiotest() 
    radio = playSound ("http://listen.HouseTime.fm/dsl.pls") 
end 
addCommandHandler("radio", radiotest) 
  
function radioName() 
    local meta = getSoundMetaTags(radio)  
    if meta.stream_title then 
        outputChatBox("Current Music : "..(meta.stream_title).."!", 255, 0, 0, true) 
    else 
        outputChatBox("No song title found!") 
    end   
end 
addEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 

This should work. Just replace the stream URL with your stream URL.

Edited by Guest
Link to comment
function radiotest() 
    radio = playSound ("http://listen.HouseTime.fm/dsl.pls") 
end 
addCommandHandler("radio", radiotest) 
  
function radioName() 
    local meta = getSoundMetaTags(radio)  
    if meta.stream_title then 
        outputChatBox("Current Music : "..(meta.stream_title).."!", 255, 0, 0, true) 
    else 
        outputChatBox("No song title found!") 
    end   
end 
addEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 

This should work. Just replace the stream URL with your stream URL.

Thanks alot mate, this worked for me. ;)

Link to comment
function radiotest() 
    radio = playSound ("http://listen.HouseTime.fm/dsl.pls") 
end 
addCommandHandler("radio", radiotest) 
  
function radioName() 
    local meta = getSoundMetaTags(radio)  
    if meta.stream_title then 
        outputChatBox("Current Music : "..(meta.stream_title).."!", 255, 0, 0, true) 
    else 
        outputChatBox("No song title found!") 
    end   
end 
addEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 

This should work. Just replace the stream URL with your stream URL.

Thanks alot mate, this worked for me. ;)

I've streamed few musics and suddenly it's not getting updated.

J9HXLIU.jpg

How can I update the music name in the server by the time I change it in my virtual dj (streaming) ?

Because it keeps showing the previous musics and the new one.

Also, I've made the same command to turn on/off the radio for clients. but the message keeps showing after turning it off.

8OHVcwb.jpg

Link to comment
Post your whole script please.
  
addCommandHandler("radio", 
function(command) 
    if startedRadio then 
    stopSound(radioSound) 
    startedRadio = false 
    outputChatBox("#D27350[RADIO] #FFFFFFYou have stopped the radio.",176,0,57,true) 
else 
    startedRadio = true 
    radioSound = playSound("http://1111:33341") 
    setSoundVolume(radioSound,1) 
    outputChatBox("#D27350[RADIO] #FFFFFFYou have started the radio.",176,0,57,true) 
end 
end,false) 
  

The problems I'm facing now are these :

- Either I stopped radio by /radio it keeps showing me the information about streamer and music

- It doesn't show the information by the time I turn on the radio /radio

- If I changed the music in my radio the new one and the previous one will keep showing in the chat, it keeps counting the musics.

Edited by Guest
Link to comment
The problems I'm facing now are these :

- Either I stopped radio by /radio it keeps showing me the information about streamer and music

- It doesn't show the information by the time I turn on the radio /radio

- If I changed the music in my radio the new one and the previous one will keep showing in the chat, it keeps counting the musics.

Okay, so let's see:

1. Use the script below and it should be fixed.

2 and 3. That's a problem that can't be fixed within the LUA script. It's something in your radio that isn't working right. Either the internet connection is really slow, so it takes really long to send the meta tags, and the problem with the stream title is also within the stream itself, not the script.

function radiotest() 
    if radioplaying then 
        radioplaying = false 
        destroyElement(radioSound) 
        outputChatBox("#D27350[RADIO] #FFFFFFYou have stopped the radio.",176,0,57,true) 
        removeEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 
    else 
        radioplaying = true 
        radioSound = playSound("http://listen.HouseTime.fm/dsl.pls") 
        setSoundVolume(radioSound,1) 
        outputChatBox("#D27350[RADIO] #FFFFFFYou have started the radio.",176,0,57,true)    
        addEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 
    end     
end 
addCommandHandler("radio", radiotest) 
  
function radioName() 
    local meta = getSoundMetaTags(radioSound)  
    if meta.stream_title then 
        outputChatBox("#D27350[RADIO] #FFFFFFCurrent Music : "..(meta.stream_title).."!", 176, 0, 57, true) 
    else 
        outputChatBox("No song title found!") 
    end   
end 
  
addEventHandler("onClientSoundFinishedDownload", getRootElement(), radioName) 

EDIT: There was an error in the script, fixed it. :)

Link to comment
The problems I'm facing now are these :

- Either I stopped radio by /radio it keeps showing me the information about streamer and music

- It doesn't show the information by the time I turn on the radio /radio

- If I changed the music in my radio the new one and the previous one will keep showing in the chat, it keeps counting the musics.

Okay, so let's see:

1. Use the script below and it should be fixed.

2 and 3. That's a problem that can't be fixed within the LUA script. It's something in your radio that isn't working right. Either the internet connection is really slow, so it takes really long to send the meta tags, and the problem with the stream title is also within the stream itself, not the script.

function radiotest() 
    if radioplaying then 
        radioplaying = false 
        destroyElement(radioSound) 
        outputChatBox("#D27350[RADIO] #FFFFFFYou have stopped the radio.",176,0,57,true) 
        removeEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 
    else 
        radioplaying = true 
        radioSound = playSound("http://listen.HouseTime.fm/dsl.pls") 
        setSoundVolume(radioSound,1) 
        outputChatBox("#D27350[RADIO] #FFFFFFYou have started the radio.",176,0,57,true)    
        addEventHandler("onClientSoundChangedMeta", getRootElement(), radioName) 
    end     
end 
addCommandHandler("radio", radiotest) 
  
function radioName() 
    local meta = getSoundMetaTags(radioSound)  
    if meta.stream_title then 
        outputChatBox("#D27350[RADIO] #FFFFFFCurrent Music : "..(meta.stream_title).."!", 176, 0, 57, true) 
    else 
        outputChatBox("No song title found!") 
    end   
end 
  
addEventHandler("onClientSoundFinishedDownload", getRootElement(), radioName) 

EDIT: There was an error in the script, fixed it. :)

Thanks alot but where is the timer?

Edited by Guest
Link to comment
What timer..?

I want it to time the outputchatbox to output the music every 2mins.

Use

setTimer 

Can you do it to my code, because I've tried it and whenever I write /radio again to turn off the radio the message keeps appearing. Also, the previous musics and the current music keeps showing in the chat

Link to comment

Can you do it to my code, because I've tried it and whenever I write /radio again to turn off the radio the message keeps appearing.

Use this:

function radioset() 
    if radioplaying then 
        ... 
        killTimer(timer) 
    else 
        ... 
        timer = setTimer(function --[[Your code]] end, 2000, 0) 
    end 
end 

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...