King12 Posted August 25, 2014 Share Posted August 25, 2014 Hello there, I'm wondering for a way to get the music's name from the radio and bring it to the server as message or dx draw whatever. This is an example for a radio : http://stream.dubbase.fm:7002/ I want to get the music name, what's the needed functions for it? Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 getSoundMetaTags How can I connect this with SHOUTcast script? I mean how can I get the name of "Current Song" instead of using "..(meta.title).." for .mp3 files? Link to comment
John Smith Posted August 25, 2014 Share Posted August 25, 2014 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
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 (edited) 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 August 25, 2014 by Guest Link to comment
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 This means that the URL isn't providing any stream_title. Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 This means that the URL isn't providing any stream_title. I just want to get this value Link to comment
arezu Posted August 25, 2014 Share Posted August 25, 2014 You may need to use this instead: https://wiki.multitheftauto.com/wiki/OnClientSoundChangedMeta or https://wiki.multitheftauto.com/wiki/OnClientSoundStream Link to comment
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 This means that the URL isn't providing any stream_title. I just want to get this value 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... Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 You may need to use this instead:https://wiki.multitheftauto.com/wiki/OnClientSoundChangedMeta or https://wiki.multitheftauto.com/wiki/OnClientSoundStream 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
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 You may need to use this instead:https://wiki.multitheftauto.com/wiki/OnClientSoundChangedMeta or https://wiki.multitheftauto.com/wiki/OnClientSoundStream 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 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
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 (edited) 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 August 25, 2014 by Guest Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 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
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 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. 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. Link to comment
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 Post your whole script please. Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 (edited) 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 August 25, 2014 by Guest Link to comment
Karuzo Posted August 25, 2014 Share Posted August 25, 2014 (edited) cancelEvent(meta) There are no arguments clientside for cancelEvent. Edited August 25, 2014 by Guest Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 cancelEvent(meta) There is no arguments clientside for cancelEvent. So how am I supposed to cancel the meta event? Link to comment
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 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
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 (edited) 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 August 25, 2014 by Guest Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 What timer..? I want it to time the outputchatbox to output the music every 2mins. Link to comment
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 What timer..? I want it to time the outputchatbox to output the music every 2mins. Use setTimer Link to comment
King12 Posted August 25, 2014 Author Share Posted August 25, 2014 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
koeno100 Posted August 25, 2014 Share Posted August 25, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now