Jump to content

[SOLVED] Streaming sound from other game server


SpecT

Recommended Posts

Posted (edited)

Hello guys!

I want to use other game server as songs storage so I made a resource and added the songs in the meta with attribute "download = false".

Okay and now is the time when the songs should be streamed ..

I don't know how to deal with the spaces. For example: Someone ft. someone - someone's song

In that case the spaces are being replaced with %20 and the storage server can't find such song.

How to deal with this if there is any way ?

Edited by Guest
Posted
Replace the spaces with %20 inside of the Lua script as well? You can use string.gsub for this. :)

Yeah, I know that ... But the problem is that the storage server can't find that name with %20 in it.

Posted
Try using a cloud service such as Kiwi6?

Yeah, but just 2 GB aren't enough .. I used web hosting with 10 GB space but there were streaming problems (the song stops whenever it wants)

Try using string.find

What do you mean with that ?

Thanks for the replies guys!

I appreciate that!

Posted

something like this

myString = "Al3grab - My%20Cool%20Song" 
if string.find(myString,"Al3grab") and string.find(myString,"Cool") then 
    return true 
else 
    return false 
end 

Posted
local songName = "This%20is%20song" 
  
function fixSpaces(string) 
return songName:gsub("%20"," ") 
end 
  
if fixSpaces(songName) == "This is song" then 
return true 
end 

is that what are you trying to do?

Posted

No .. its not. Read what I wrote carefully !

I request a song example "Singer - songName" but when the request goes to the server the song name becomes "Singer%20-%20songName" sooo the server cant find that file "Singer%20-%20songName" (The actual file is "Singer - songName").

That's the problem. In that case all the songs must not have spaces , because otherwise they won't be found.

PS: If you still can't understand tell me so I will try to explain it somehow better ..

Posted
No .. its not. Read what I wrote carefully !

I request a song example "Singer - songName" but when the request goes to the server the song name becomes "Singer%20-%20songName" sooo the server cant find that file "Singer%20-%20songName" (The actual file is "Singer - songName").

That's the problem. In that case all the songs must not have spaces , because otherwise they won't be found.

PS: If you still can't understand tell me so I will try to explain it somehow better ..

What are you using to request the song? are you aware that playSound can play url's directly ?

Posted

Streaming song:

playSound("http://ip.ip.ip.ip:22003/songs/songName - songName.mp3",false) 

That's what I'm using. The problem is that when I try to stream it like that it goes like "http://ip.ip.ip.ip:22003/songs/songName%20-%20songName.mp3" so the storage server can't find that song with these %20 in in. When the song name is like "songName-songName.mp3" (without spaces) it works perfectly .. but how can I rename 1500+ songs ?

I just wanted to know if its possible to deal with that somehow.

Posted

Nevermind guys. I got a solution for that by myself.

1. I got the idea to find out how to rename all the songs -> without spaces

2. Found the script (Power shell)

3. Uploaded the songs on the storage server

4. In the streaming script I used as url the song name with removed spaces

5. Working fine now

Anyway thanks for the replies. I hope that this solution will be helpful for the others.

Here is the renaming powershell script:

dir | 
Where-Object { $_.name.Contains(" ") } | 
Rename-Item -NewName { $_.name -replace " ","" } 

Save it as .ps1

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