ShoutCastCleverScript - Need help...
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

ShoutCastCleverScript - Need help...

Started by Madman, 20 November, 2004, 05:31:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Madman

-- Shoutcast interface through PtokaX script
-- Author: RabidWombat
-- Requirements: the winamp source of the shoutcast server
-- is running on the hub server where this script is AND
-- you have installed Clever (a GREAT utility)
-- This is the version I downloaded for testing purposes
-- http://www.jukkis.net/clever/clever_2_98.zip
-- This is site for all offered versions:
-- http://www.jukkis.net/
--//Modded By Madman
--//Added !sc.song
--//Guide Added
--//Volump Ctrl Added


--	Guide So You Can Add The Commands You Wish
--------------------------------------------------------------------------------------
--	execute(sCleverDir.."clever.exe prev"); --//Play Previous Song
--	execute(sCleverDir.."clever.exe alwaysontop"); --//Toggle Always On Top
--	execute(sCleverDir.."clever.exe pause"); --//Pauses
--	execute(sCleverDir.."clever.exe stop"); --//Stops
--	execute(sCleverDir.."clever.exe next"); --//Play Next Song
--	execute(sCleverDir.."clever.exe volup"); --//Increase The Volume
--	execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume
--	execute(sCleverDir.."clever.exe swshuffle"); --//Sets Shuffle On Off
--	execute(sCleverDir.."clever.exe swrepeat"); --//Sets Repet On Off
--	execute(sCleverDir.."clever.exe getshuffle > output.tmp"); --//Get Status on Shuffle
--	execute(sCleverDir.."clever.exe getrepeat > output.tmp"); --//Get Staus on Repeat
--------------------------------------------------------------------------------------
--	execute(sCleverDir.."clever.exe getinfo > output.tmp"); --//shows Info about the song
--	Example...
--	44kHz      128kbps      Channels:2
--------------------------------------------------------------------------------------
--	execute(sCleverDir.."clever.exe GETINFO > output.tmp"); --//shows Info about the song
-- Example...
--	044,128,2
--------------------------------------------------------------------------------------
--	execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song
--	Example..
--	Songname:	Ramp - The Logical Song (Original Mix)
--	Time:    	04:22 of 06:57 (02:35 left)
--	Status:  	Playing
--	Shuffle: 	On
--	Repeat:  	On
--	Playlist position 2 of 7 songs.
--------------------------------------------------------------------------------------
--	execute(sCleverDir.."clever.exe staus > output.tmp"); --//Shows Staus Of Winamp Ex. Play
--	execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song
--	execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft

--	execute(sCleverDir.."clever.exe songtitle > output.tmp"); --//Shows The Song Title
--	execute(sCleverDir.."clever.exe visual"); --//Visualtion On Off
--	execute(sCleverDir.."clever.exe clear"); --//Clears The Playlist
--	execute(sCleverDir.."clever.exe playlist > output.tmp"); --//Show Playlist
--	execute(sCleverDir.."clever.exe play");	 --//Start Play

sCleverDir = "C:\\clever\\";
sBotName = "ShoutCastBot";

low = strlower;

sHelpOutput = "Commands\r\n";
sOpHelpOutput = "Op Commands\r\n";

Msg = "The HubServer Is Playing"

function Main()
	tCommands = {
	--// 1 = Ops only...
	--// 0 = All
		[low("!SC.next")] 	= { ShoutCastNext,	1,	"Play next song in playlist" },
		[low("!SC.prev")] 	= { ShoutCastPrev,	1,	"Play prev song in playlist" },
		[low("!SC.playlist")]	= { ShoutCastPlayList,	0,	"Display Playlist" },
		[low("!SC.play")]	= { ShoutCastPlay,	1,	"Play" },
		[low("!SC.pause")]	= { ShoutCastPause,	1,	"Pause" },
		[low("!SC.stop")]	= { ShoutCastStop,	1,	"Stop" },
		[low("!SC.status")]	= { ShoutCastStatus,	0,	"Display Status" },
		[low("!SC.help")]	= { ShoutCastHelp,	0,	"Help Message" },
		[low("!SC.song")]	= { ShoutCastSong,	0, 	 "SongTitle"},
		[low("!SC.volup")]	= { ShoutCastVolUp,	1,	"Volume Up"},
		[low("!SC.voldn")]	= { ShoutCastVolDn,	1,	"Volume Down"},
		--[low("!SC.test")]	= { ShoutCastTest,	1, 	 "Test"},
		--[low("!SC.test2")]	= { ShoutCastTest2,	1, 	 "Test With Output.tmp"},
	};

	for sCmd, tCmd in tCommands do
		if(tCmd[2] == 1) then
			sOpHelpOutput = sOpHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";
		else
			sHelpOutput = sHelpOutput..sCmd.."-\t"..tCmd[3].."\r\n";
		end
	end

	frmHub:RegBot(sBotName);
end

function DataArrival(curUser, sData)
	local s, e, cmd, args = strfind(sData, "%b<>%s+(%S+)%s*([^%|]*)%|$");

	if(cmd == nil) then return 0; end
	cmd = strlower(cmd);

	--if(tCommands[cmd] and (tCommands[cmd][2] == 0 or (curUser.iProfile == 0))) then --//Masters Only
	if(tCommands[cmd] and (tCommands[cmd][2] == 0 or curUser.bOperator)) then --//Ops And Above
		curUser:SendData(sData);
		tCommands[cmd][1](curUser, args);
		return 1;
	end
end

function ShoutCastVolUp(curUser)
	execute(sCleverDir.."clever.exe volup"); --//Increase The Volume
	curUser:SendData(sBotName, "Volume Increased")
end

function ShoutCastVolDn(curUser)
	execute(sCleverDir.."clever.exe voldn"); --//Decrease The Volume
	curUser:SendData(sBotName, "Volume Decreased")
end

function ShoutCastTest() --//For Testing
	execute(sCleverDir.."clever.exe alwaysontop");
end

function ShoutCastTest2(curUser) --//For Testing
	execute(sCleverDir.."clever.exe prettyinfo > output.tmp");
	readfrom("output.tmp");

	local line = read("*a");

	if(line) then
		line = gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end

	readfrom();
end

function ShoutCastNext()
	execute(sCleverDir.."clever.exe next");
end

function ShoutCastPrev()
	execute(sCleverDir.."clever.exe prev");
end

function ShoutCastPlayList(curUser)
	execute(sCleverDir.."clever.exe playlist > output.tmp");
	readfrom("output.tmp");

	local line = read("*a");

	if(line) then
		line = gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end

	readfrom();
end

function ShoutCastPlay()
	execute(sCleverDir.."clever.exe play");	
end

function ShoutCastPause()
	execute(sCleverDir.."clever.exe pause");
end

function ShoutCastStop()
	execute(sCleverDir.."clever.exe stop");
end

function ShoutCastStatus(curUser)
	execute(sCleverDir.."clever.exe status > output.tmp");
	readfrom("output.tmp");

	local line = read("*a");

	if(line) then
		line = gsub(line, "\n", "\r\n");
		curUser:SendData(sBotName, "\r\n"..line);
	end

	readfrom();
end

function ShoutCastSong(curUser)
	execute(sCleverDir.."clever.exe songtitle > output.tmp")
	readfrom("output.tmp");

	local line = read("*a");
	if(line) then
		line = gsub(line, "\n", "\r\n");
		--curUser:SendData(sBotName, "\r\n" ..Msg.." "..line);
		SendToAll(sBotName, "\r\n" ..Msg.." "..line);
	end

	readfrom();
end


function ShoutCastHelp(curUser)
	curUser:SendData(sBotName, sHelpOutput);
	if(curUser.bOperator) then
	--if(curUser.iProfile == 0) then
		curUser:SendData(sBotName, sOpHelpOutput);
	end
end

hi, i need some help...
i want a to be able to choose what song to play....
if i write !sc.play now it just start playing current song
i want to write some thing like
!sc.playsong 102
and then it will play song 102 =)

and i also want to be able to set the volume...

Some extra info that might be use full...
taken from the source and also the help text....
if (strcmp(command, "play")==0) singleOpt(C_PLAY);
	play         Play the song in playlist position 
	if (strcmp(command, "volume"	 )==0) singleParam(C_SET_VOLUME);
	volume       Set volume (0-255)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Madman

We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk