Resource icon

CLEO Release Search YouTube, Convert and Stream

CLEO related
Status
Not open for further replies.

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
With this mod you can search YouTube from SA:MP and begin an audio stream (all files convert to 128kbps .ogg). Example: "/fvrad martin garrix - animals" (without the quotes). This will find the closest matching song name, convert and stream very quickly.

Alternatively, if the wrong song is selected or not found, you can enter a direct YouTube link. See the usage for better understanding.

Usage:
Code:
(These will convert to .ogg and stream from YouTube links)
/rad <Link> (Types /radio)
/vrad <Link> (Types /vradio)
/vrm <Link> (Types /vrmusic)
/vwa <Link> (Types /vwaudio)

(These will search the words you typed on YouTube, get the nearest match, convert to .ogg and stream)
/frad <Song Name> (Types /radio)
/fvrad <Song Name> (Types /vradio)
/fvrm <Song Name> (Types /vrmusic)
/fvwa <Song Name> (Types /vwaudio)


Source:
Code:
{$CLEO .cs}
 
//-------------MAIN---------------
0000: NOP
0B34: samp register_client_command "rad" to_label @cmd1
0B34: samp register_client_command "vrad" to_label @cmd2
0B34: samp register_client_command "vrm" to_label @cmd3
0B34: samp register_client_command "vwa" to_label @cmd4
0B34: samp register_client_command "frad" to_label @cmd5
0B34: samp register_client_command "fvrad" to_label @cmd6
0B34: samp register_client_command "fvwa" to_label @cmd7
0B34: samp register_client_command "fvrm" to_label @cmd8
30@ = 0
 
:Label
wait 0
if or
30@ == 1
30@ == 2
30@ == 3
30@ == 4
30@ == 5
30@ == 6
30@ == 7
30@ == 8  
else_jump @Label
SAMP.IsCommandTyped(1@)
   
   if
   0AD4: 2@ = scan_string 1@ format "%s" 3@v  
   then
       if 30@ == 1
       then  
       say "/radio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0            
       end
       
       if 30@ == 2
       then
       say "/vradio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 3
       then
       say "/vrmusic https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 4
       then
       say "/vwaudio https:%c%c6t.pe%c?%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 5
       then
       say "/radio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 6
       then
       say "/vradio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end
       
       if 30@ == 7
       then
       say "/vwaudio https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end    
       
       if 30@ == 8
       then
       say "/vrmusic https:%c%c6t.pe%c?song=%s" 47 47 47 1@
       30@ = 0
       end        
   else
   chatmsg "USAGE: /rad <URL>, /vrad <URL>, /vrm <URL>, /vwa <URL>" 6356832
   chatmsg "SEARCH YOUTUBE AND CONVERT: /frad (song name), /fvrad (song name), /fvrm (song name), /fvwa (song name)" 16736352
   30@ = 0
   end
jump @Label  
 
:cmd1
30@ = 1
SAMP.CmdRet
 
:cmd2
30@ = 2
SAMP.CmdRet
 
:cmd3
30@ = 3
SAMP.CmdRet
 
:cmd4
30@ = 4
SAMP.CmdRet
 
:cmd5
30@ = 5
SAMP.CmdRet
 
:cmd6
30@ = 6
SAMP.CmdRet
 
:cmd7
30@ = 7
SAMP.CmdRet
 
:cmd8
30@ = 8
SAMP.CmdRet

Known bugs:
- Typing a song name will not always play the song you wanted, but will 99% of the time it will
- For songs longer than 10 minutes you will likely need to send the command again as the SA:MP timeout for redirect headers is too low

Hopefully you find use out of this mod, it's my first release. I'm new to cleo so thanks to Monday for some help.
 

Attachments

  • convert.cs
    1 KB · Views: 245

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
10
This cleo seems awesome, but for some reason, it won't execute any command, it just says unknown command :(

P.S: I have sampfuncs 5.3.1 :urtheman:
 

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
Fu$10N said:
This cleo seems awesome, but for some reason, it won't execute any command, it just says unknown command :(

P.S: I have sampfuncs 5.3.1  :urtheman:

Does the server you play support any of these commands?
/rad or /frad for /radio
/vrad or /fvrad for /vradio
/vwa or /fvwa for /vwaudio
/vrm or /fvrm for /vrmusic
If it doesn't you could quickly edit the commands from the source provided, otherwise I can if you want.

If so I'm not sure what the problem could be since this should be compatible with most Sampfuncs versions. Thanks for feedback
 

Bugman

Active member
Joined
Aug 14, 2014
Messages
68
Reaction score
0
guy, that works only for servers that have these commands xxxxx
 

Cinaro

Well-known member
Joined
Jun 30, 2015
Messages
277
Reaction score
5
i think you stole this from a user knows as "skillascii" or "skilla" anything to say?
 

bobesin

Active member
Joined
Feb 20, 2013
Messages
166
Reaction score
1
SugoiiiiI~ but no seriously, it's awesome. Kudos to you, bro.
 

Higuys14

Active member
Joined
Jan 19, 2014
Messages
115
Reaction score
0
Does it require sampfuncs, my game crashes while im trying to log in
 

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
Higuys14 said:
Does it require sampfuncs, my game crashes while im trying to log in

It does. I'm going to try and make a version that doesn't need sampfuncs but I've seen how difficult that can be.
 

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
Shakira said:
Can search google from samp?

Good idea tbh, but most of the code for this was done in PHP on a server I own. The PHP gets the song name as a variable, scans YouTube with the search API, finds the closest matching song, converts, generates a filename based on the title and redirects to said filename at uif.sexy. Cleo just sends a small request, but I don't know how I'd get it to receive data other than an audio stream.
 

rottentwinkie

Moderator
Moderator
Joined
Apr 4, 2014
Messages
608
Reaction score
3
More like an ease of access rather than a hack (especially on UIF server).
Good job.
 

Higuys14

Active member
Joined
Jan 19, 2014
Messages
115
Reaction score
0
cuntstuble said:
Higuys14 said:
Does it require sampfuncs, my game crashes while im trying to log in

It does. I'm going to try and make a version that doesn't need sampfuncs but I've seen how difficult that can be.

If you manage to do such thing you'll be my idol
 

GrandSamson

Member
Joined
May 5, 2015
Messages
13
Reaction score
0
I joined to RP server but it gave me "You are not authorized to use a command."
 

Shakira

Active member
Joined
Jul 11, 2014
Messages
191
Reaction score
0
cuntstuble said:
Shakira said:
Can search google from samp?

Good idea tbh, but most of the code for this was done in PHP on a server I own. The PHP gets the song name as a variable, scans YouTube with the search API, finds the closest matching song, converts, generates a filename based on the title and redirects to said filename at uif.sexy. Cleo just sends a small request, but I don't know how I'd get it to receive data other than an audio stream.

You can make search google?
 

wavelengthzero

Active member
Joined
Feb 18, 2014
Messages
45
Reaction score
0
GrandSamson said:
I joined to RP server but it gave me "You are not authorized to use a command."

It sends commands like /radio but with the link you provided on the end of "https://6t.pe/?song=song name you typed". If you can't use commands like /radio in-game it won't work. I'd like to make a version that will work for people without access to streaming commands, but my cleo knowledge is limited and I can't get streaming from URLs in cleo to work properly.


Shakira said:
cuntstuble said:
Shakira said:
Can search google from samp?

Good idea tbh, but most of the code for this was done in PHP on a server I own. The PHP gets the song name as a variable, scans YouTube with the search API, finds the closest matching song, converts, generates a filename based on the title and redirects to said filename at uif.sexy. Cleo just sends a small request, but I don't know how I'd get it to receive data other than an audio stream.

You can make search google?

It's surely possible, but I'm not the best at coding in cleo.
 
Status
Not open for further replies.
Top