PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: D-J Valhala on 22 July, 2004, 14:44:02

Title: standalone script needed :)
Post by: D-J Valhala on 22 July, 2004, 14:44:02
+np
<-PsYiBot-> DJ-Valhala Now Play: shulman_-_in_search_of_a_meaningful_moment-2003-psycz\01-Shulman_-_Inner_Selves-psycz.mp3 [Bitrate/Time/playtime]

it will send to all what the user play in my WinAmp  :D and all users can use this
 :D  :D  :D  :D  :D  :D  :D
for my users :)
Title:
Post by: nErBoS on 22 July, 2004, 15:25:50
Hi,

I beleive that already exist a script that does something like that, search in the finished scripts.

Best regards, nErBoS
Title:
Post by: D-J Valhala on 22 July, 2004, 22:03:52
i can't find one i found some script to control the winamp but not "Now Play: " :]
Title:
Post by: nErBoS on 22 July, 2004, 22:14:06
Hi,

Maybe is this what you are lookink for...

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

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

low = strlower;

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

function Main()
tCommands = {
[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" },
};

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.bOperator)) then
curUser:SendData(sData);
tCommands[cmd][1](curUser, args);
return 1;
end
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 ShoutCastHelp(curUser)
curUser:SendData(sBotName, sHelpOutput);
if(curUser.bOperator) then
curUser:SendData(sBotName, sOpHelpOutput);
end
end

Best regards, nErBoS
Title:
Post by: plop on 22 July, 2004, 23:26:09
QuoteOriginally posted by D-J Valhala
i can't find one i found some script to control the winamp but not "Now Play: " :]
take a look here (http://amip.tools-for.net/index.php?content=download).
or start using bcdc, there you can type /winamp and it'll show the current track winamp is playing.

plop
Title:
Post by: D-J Valhala on 23 July, 2004, 01:53:16
nErBoS i tryed this script b4 and this script is not what i need i need only +np (Now Play: ) and i like it for all the users...
Plop huh? i dont understsnd what i need to do there :P lol :D
Title:
Post by: nErBoS on 23 July, 2004, 01:56:57
Hi,

What plop said was that you need a client script to do that or bcdc++ that haves a command \winamp that already does that.

Best regards, nErBoS
Title:
Post by: D-J Valhala on 23 July, 2004, 03:12:40
ok but if i have the cliend i can use it but i like it for all my hub users not only me :)
Title:
Post by: nErBoS on 23 July, 2004, 03:17:28
Hi,

Try to use the program that plop has gave you, it works for mirc is probaly that it works for dc++ also.

Best regards, nErBoS
Title:
Post by: plop on 23 July, 2004, 11:52:56
QuoteOriginally posted by nErBoS Try to use the program that plop has gave you, it works for mirc is probaly that it works for dc++ also.
it should work everywhere.

@ D-J Valhala: let your users install amip.
all they need 2 so is changing a couple settings 2 adjust it 2 there needs.
next all left 2 do is press the shortcut key and amip types the line for them.
having a script on the hub do this would mean there was a HUUUUUUUUUGE securety leak in dc++.

plop
Title:
Post by: D-J Valhala on 23 July, 2004, 13:18:01
i dont understand... thanks anyway  :D
Title:
Post by: D-J Valhala on 23 July, 2004, 22:00:10
thank you but this script is not work on any user only on the server winamp and i need stand alone script for ALL my users NOT only for me  :D
Title:
Post by: plop on 23 July, 2004, 22:42:08
QuoteOriginally posted by D-J Valhala
thank you but this script is not work on any user only on the server winamp and i need stand alone script for ALL my users NOT only for me  :D
again the same answer as i said before.
thats imposible.

thats why i gave the link 2 amip, it's a tool which add's this kind of feature 2 every dc client.
but the users should install it themself on there compies.

plop
Title:
Post by: D-J Valhala on 23 July, 2004, 23:54:22
ohhhhhhh now i get it lol thanks  :]
Title:
Post by: plop on 24 July, 2004, 03:41:23
QuoteOriginally posted by D-J Valhala
ohhhhhhh now i get it lol thanks  :]
yw

plop
Title:
Post by: Psycho_Chihuahua on 16 September, 2004, 17:34:11
adjusted Mutor's Version to show the current Title every x minutes in Mainchat :)

-- Shoutcast interface through PtokaX script

-- Author:  RabidWombat

-- Modded by: yepyepyep4711, Blackfox

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

-- Small changes by yepyepyep4711:

-- Bot does not appear in user list, line is commented. Uncomment it to see it again

-- Playlist now comes as a PM. Handy when it's big ; )

-- Incorporated "Play track number x of the playlist" command. ALL credit to RabidWombat : )

-- Minor help layout and text changes

-- Added "Now Playing" command. Don't forget to change the station or link in the code---> Blackfox

-- Commented code. ---> Blackfox

-- Add Automated Display of whats running with Link by Psycho_Chihuahua requested by Laura_Gruft

sCleverDir = "C:\\clever\\"; --// Path to Clever.exe

sBotName = "-=HubRadio=-";  --// Name of Bot comes here

TimeSpanInMinutes = 1 --// Define Timespan between Messagesl in minutes

low = strlower;


sHelpOutput = "Commands\r\n";

sOpHelpOutput = "Op Commands\r\n";

function Main()

tCommands = {

[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 as PM" },

[low("!SC.playn")]= { ShoutCastPlayNumber,1,"Play track number x of the playlist" },

[low("!SC.play")]= { ShoutCastPlay,1,"Play" },

[low("!SC.pause")]= { ShoutCastPause,1,"Pause" },

[low("!SC.stop")]= { ShoutCastStop,1,"Stop" },

[low("!SC.np")]= { ShoutCastNp,1,"Display Now Playing" },

[low("!SC.status")]= { ShoutCastStatus,0,"Display status (Play/Stop/Pause)" },

[low("!SC.help")]= { ShoutCastHelp,0,"Help message" },

};


for sCmd, tCmd in tCommands do

if(tCmd[2] == 1) then

sOpHelpOutput = sOpHelpOutput..sCmd.."\t\t-\t"..tCmd[3].."\r\n";

else

sHelpOutput = sHelpOutput..sCmd.."\t-\t"..tCmd[3].."\r\n";

end

end
SetTimer(TimeSpanInMinutes*60000)
StartTimer()
end

-- frmHub:RegBot(sBotName); -- uncomment to see bot in user list



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.bOperator)) then

curUser:SendData(sData);

tCommands[cmd][1](curUser, args);

return 1;

end

end
----------------------- [Next command]

function ShoutCastNext()

execute(sCleverDir.."clever.exe next");

end
----------------------- [Prev command]

function ShoutCastPrev()

execute(sCleverDir.."clever.exe prev");

end
----------------------- [Playlist command]

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:SendPM(sBotName, "\r\n"..line);

end


readfrom();

end
----------------------- [Play command]

function ShoutCastPlay()

execute(sCleverDir.."clever.exe play");

end
----------------------- [Play Track command]

function ShoutCastPlayNumber(curUser, args)

if(args and tonumber(args)) then

execute(sCleverDir.."clever.exe play "..tonumber(args));

end

end
----------------------- [Pause command]

function ShoutCastPause()

execute(sCleverDir.."clever.exe pause");

end
----------------------- [Stop command]

function ShoutCastStop()

execute(sCleverDir.."clever.exe stop");

end
----------------------- [Status command]

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
----------------------- [Automated Display]

function OnTimer()

execute(sCleverDir.."clever.exe songtitle > output.tmp");


readfrom("output.tmp");


local line = read("*a");


if(line) then

line = gsub(line, "\n", "\r\n");

SendToAll(sBotName, "\r\n NowPlaying on [URL]http://transistorhijack.no-ip.org:8080:[/URL] "..line);  --// Change to your Shoutcast Address

end


readfrom();

end
----------------------- [Now Playing command]

function ShoutCastNp(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 NowPlaying on [URL]http://transistorhijack.no-ip.org:8080:[/URL] "..line);  --// Change to your Shoutcast Address

end


readfrom();

end
----------------------- [Help command]

function ShoutCastHelp(curUser)

curUser:SendData(sBotName, sHelpOutput);

if(curUser.bOperator) then

curUser:SendData(sBotName, sOpHelpOutput);

end

end

It's working fine, but is there a way of shortening the code without losing the functions? Or do i have to use ----------------------- [Automated Display]

function OnTimer()

execute(sCleverDir.."clever.exe songtitle > output.tmp");


readfrom("output.tmp");


local line = read("*a");


if(line) then

line = gsub(line, "\n", "\r\n");

SendToAll(sBotName, "\r\n NowPlaying on [URL]http://transistorhijack.no-ip.org:8080:[/URL] "..line);  --// Change to your Shoutcast Address

end


readfrom();

end

Well if someone could help me get the Automated Display to check say every minute if Songtitel has changed. If yes the it should show a message in Mainchat. if not then it shouldnt display the message as it has been shown already at start.
i hope you understand what i'm thinking about