SpecT Posted October 13, 2015 Share Posted October 13, 2015 (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 October 16, 2015 by Guest Link to comment
Dealman Posted October 13, 2015 Share Posted October 13, 2015 Replace the spaces with %20 inside of the Lua script as well? You can use string.gsub for this. Link to comment
SpecT Posted October 13, 2015 Author Share Posted October 13, 2015 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. Link to comment
Dealman Posted October 13, 2015 Share Posted October 13, 2015 Try using a cloud service such as Kiwi6? Link to comment
SpecT Posted October 14, 2015 Author Share Posted October 14, 2015 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! Link to comment
Al3grab Posted October 14, 2015 Share Posted October 14, 2015 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 Link to comment
ALw7sH Posted October 15, 2015 Share Posted October 15, 2015 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? Link to comment
SpecT Posted October 15, 2015 Author Share Posted October 15, 2015 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 .. Link to comment
ALw7sH Posted October 15, 2015 Share Posted October 15, 2015 Which server? It would be better if you can show us your code, just the part where you are doing your thing Link to comment
Al3grab Posted October 16, 2015 Share Posted October 16, 2015 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 ? Link to comment
SpecT Posted October 16, 2015 Author Share Posted October 16, 2015 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. Link to comment
SpecT Posted October 16, 2015 Author Share Posted October 16, 2015 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 Link to comment
Addlibs Posted October 16, 2015 Share Posted October 16, 2015 In URLs, %20 is a space, so the server should have returned the files correctly, but I'm glad you found a solution to your problem. 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