PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Madman on 10 November, 2004, 19:10:18

Title: Another Requset 4 a Winamp Script
Post by: Madman on 10 November, 2004, 19:10:18
I have search the forum but i cant find a script that does what i want... ;p

What i want is a script that shows what winamp plays...
everybody knows it exits lots of shoutcast sripts out there... but that is not what i want...

i want a script that shows what winamp plays..
but it dont have a shoutcast sever installed...
and it only needs to work in my LAN
Winamp is playing on the hub computer...

i know there is something called aimp
but last time it checked it dont work throu the lan...

beacuse i want to be in at my pc and write !winamp in main and it will show what my server plays...
can this be done?
Title:
Post by: enema on 10 November, 2004, 20:28:35
try sDC or CZDC and for command use /winamp not !winamp, because its "internal" DC cmd, not an "external"
Title:
Post by: Madman on 10 November, 2004, 22:03:42
I use sDC but it can only show what i'm playing on my pc....
I need a script beacuse i want to show what the hub pc is playing..
Title:
Post by: bastya_elvtars on 10 November, 2004, 23:55:06
QuoteOriginally posted by madman
I use sDC but it can only show what i'm playing on my pc....
I need a script beacuse i want to show what the hub pc is playing..

with radio or without?

if without then [URL]http://www.plop.nl/ptokaxbots/RabidWombat/shoutcast.lua[/URL]

else [URL]http://www.plop.nl/ptokaxbots/Mutor/ShoutStats_1.0c.lua[/URL]

end

:P
Title:
Post by: Madman on 11 November, 2004, 00:59:01
The shoucast was a fun thing... but there isnt any commad to show what song it is playing....
its nice to be able to change it throug the hub....
but i want it so i can show what i'm listening to...
Title:
Post by: Psycho_Chihuahua on 11 November, 2004, 01:07:34
I think this is what he was looking for


Btw its called AMIP  :D

http://amip.tools-for.net/

It works on LAN to, you just have to configure it a bit first
Title:
Post by: bastya_elvtars on 11 November, 2004, 01:23:50
QuoteOriginally posted by Psycho_Chihuahua
I think this is what he was looking for


Btw its called AMIP  :D

http://amip.tools-for.net/

It works on LAN to, you just have to configure it a bit first

he asked about the winamp running on the HUB server. I thought it is regardless of if it is his machine. :P
Title:
Post by: Madman on 11 November, 2004, 01:38:17
Well.. lets see shall we...

*edit*
Dont think so...

What i want, is that i can log on to dc on any of my machines on the LAN and type the command, and the bot/or "me" will type what the Server is playing...

exampel...

I logon on to the hub (witch is running on 192.168.0.1) from the pc with ip 192.168.0.5 and type !winamp
Then the script types what winamp is playing...
and it do the same think if i log on from 192.168.0.2
... well u get the point i hope... ;p

If i understood amip right, i have to install it on every machine... and i DO NOT want to do that ;p
And also figuer out how to config it to work on LAN...
Title:
Post by: Madman on 13 November, 2004, 00:14:15
This Is What I Wanted ;p
-- 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
-- [URL]http://www.jukkis.net/clever/clever_2_98.zip[/URL]
-- This is site for all offered versions:
-- [URL]http://www.jukkis.net/[/URL]
--//Modded By Madman
--//Added !sc.song
--//Guide 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"); --//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.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 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
Title:
Post by: Ubikk on 29 December, 2004, 12:29:27
Is it possible to play a certain song from winamp using a command from DC++

e.g: !play Metallica - Fuel :D
or
e.g: !play met  -> and when I press Tab it scrolls trough all songs with name starting with "met"
Title:
Post by: Ubikk on 29 December, 2004, 12:50:39
P.S:
How can I get this function to work in my script?


--   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.
Title:
Post by: Madman on 29 December, 2004, 17:18:11
-- 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
-- [URL]http://www.jukkis.net/clever/clever_2_98.zip[/URL]
-- This is site for all offered versions:
-- [URL]http://www.jukkis.net/[/URL]
--//Modded By Madman
--//Added !sc.song
--//Guide Added
--//More Stuff Added
--//Even More On Ubikk's Request ;p


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

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


sCleverDir = "D:\\Program\\clever\\";
--// If other then C:\CLEVER you have to create C:\CLEVER mannuly...
--It's for the settings file
--Also rember to run the clever.exe fil first... you need to configure it =)
sBotName = "-=Destruction=-";

low = strlower;

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

--For ShoutCastSong
Msg = "The HubServer Is Playing" --Will show  "Msg songname"

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.playnr")] = { ShoutCastPlayNr,1, "Play nr X track"},
[low("!SC.tracknr")]= { ShoutCastGetTrack,1,"Get current song's track number"},
[low("!SC.vol")] = { ShoutCastVol, 1, "Set Volume 0-255"},
[low("!SC.volhelp")] = { ShoutCastVolHelp, 1, "Volume Help"},
[low("!SC.pretty")] = { ShoutCastPretty, 1, "Display Pretty info"},
-- [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 ShoutCastPretty(curUser)
execute(sCleverDir.."clever.exe prettyinfo > output.tmp"); --//Shows Pretty Info About The Song
readfrom("output.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "\r\n");
--curUser:SendData(sBotName, "\r\n"..line);
SendToAll(sBotName, "\r\n"..line);
end
readfrom();
end

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

function ShoutCastVol(curUser, args)
if(args and tonumber(args)) then
execute(sCleverDir.."clever.exe volume "..tonumber(args));
curUser:SendData(sBotName, "Volume Set To " ..args)
end
end

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

function ShoutCastVolHelp(curUser) --//Volume Help
if(curUser.iProfile == 0) then
curUser:SendPM(sBotName,"\r\nVolume Help\r\n"..
"Write !sc.vol X\tX = Some Nr\n"..
"The Text Bellow Show What A Nr Is In Volume %\r\n"..
"10 = 3 %\r\n"..
"20 = 7 %\r\n"..
"30 = 11 %\r\n"..
"40 = 15 %\r\n"..
"50 = 19 %\r\n"..
"60 = 23 %\r\n"..
"70 = 27 %\r\n"..
"80 = 31 %\r\n"..
"90 = 35 %\r\n"..
"100 = 39 %\r\n"..
"110 = 43 %\r\n"..
"120 = 47 %\r\n"..
"130 = 50 %\r\n"..
"140 = 54 %\r\n"..
"150 = 58 %\r\n"..
"160 = 62 %\r\n"..
"170 = 66 %\r\n"..
"180 = 70 %\r\n"..
"190 = 74 %\r\n"..
"200 = 78 %\r\n"..
"210 = 82 %\r\n"..
"220 = 86 %\r\n"..
"230 = 90 %\r\n"..
"240 = 94 %\r\n"..
"250 = 98 %\r\n"..
"255 = 100 %\r\n");
end
end

function ShoutCastTest(curUser, args) --//For Testing
if(args and tonumber(args)) then
execute(sCleverDir.."clever.exe play "..tonumber(args));
end
end

function ShoutCastTest2(curUser) --//For Testing
execute(sCleverDir.."clever.exe -h > 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(curUser) --//Play Next Song
execute(sCleverDir.."clever.exe next");
end

function ShoutCastPrev()
execute(sCleverDir.."clever.exe prev"); --//Play Prev Song
end

function ShoutCastPlayNr(curUser, args)
if(args and tonumber(args)) then
execute(sCleverDir.."clever.exe play")
execute(sCleverDir.."clever.exe play "..tonumber(args));
execute(sCleverDir.."clever.exe songtitle > output.tmp");
readfrom("output.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToOps(sBotName, curUser.sName.." has selected track "..tonumber(args).." [ "..line.." ]");
end
end
readfrom();
end

function ShoutCastPlayList(curUser) --//Show Playlist
execute(sCleverDir.."clever.exe playlist > output.tmp");
readfrom("output.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "\r\n");
curUser:SendPM(sBotName, "\r\n"..line);
end
readfrom();
end


function ShoutCastGetTrack(curUser) --//Get Track nr
execute(sCleverDir.."clever.exe getplpos > output.tmp");
readfrom("output.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
curUser:SendData(sBotName, "Current song's track number is: [ "..line.." ]");
end
readfrom();
end

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

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

function ShoutCastStop()
execute(sCleverDir.."clever.exe stop"); --//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) --//Playing Song
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 ShoutCastSongLength(curUser)
execute(sCleverDir.."clever.exe songlength > output.tmp"); --//Total Length Of Song
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 ShoutCastTimeLeft(curUser)
execute(sCleverDir.."clever.exe timeleft > output.tmp"); --//Shows Timeleft
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 ShoutCastHelp(curUser) --//Help
curUser:SendData(sBotName, sHelpOutput);
if(curUser.bOperator) then
--if(curUser.iProfile == 0) then
curUser:SendData(sBotName, sOpHelpOutput);
end
end

Good morning =)

I added what you wanted.. if you want more...

copy the line from the guide Ex.
--   execute(sCleverDir.."clever.exe visual"); --//Visualtion On Off
then write
function visual(curUser)
execute(sCleverDir.."clever.exe visual"); --//Visualtion On Off
end
Thats the function.. now the command... add it under the other commands.. ;p
[low("!SC.visual")] = { visual, 1, "Toggel visual"},
If 1 op only.. if 0 then all

If it says > output.tmp in the execute line then do like this
function GetInfo(curUser)
execute(sCleverDir.."clever.exe GETINFO > output.tmp"); --//shows Info about the song
--------------------------------------------------------
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

Hope it helps... =)