adjusted Mutor's Version to show the current Title every x minutes in Mainchat :)
Well if someone could help me get the Automated Display to check every x minutes but only show each SongTitel once. As in the first Check that shows a new title its shows the messager and otherwise not
i hope you understand what i'm thinking about
Please help me out on this one
: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
code:------------------------------------------------------------------------------------------------------- [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 this is better that what i did
My Idea was just to have a title check done where apon it saves Songtitle in a txt file or something and then again on checkinterval it rechecks to see if the samesong is still running in which case it neednt show the Title again...i.e 1 Display per Song
But only if its possible
Hey Psycho_Chihuahua
What do i need to do to setup myown shoutcast radio?
for the basics check out Nullsoft Shoutcast Server (http://www.shoutcast.com/download/serve.phtml)
Hi, excellent script!
But i would like it to announce when an Operator is changing song and who the Operator is, (announcing to all in mainchat at the moment the Operator changes song).
Is it also possible to put Nicks in a exception table or similar so when the user changing song it whont announce his nick?
Something like this addy:
(choosed by Operator: [OP]whatever)
Im not good enough to make this on my own X( and i hope its not too much work for any of u guys :)
cheers // Dj_OcTaGoN
There is a bug in the now playing...
<-=Radio=-> Now Playing on http://yourshoucastaddress.com:8000 >>
no track name appears
great script thou!
8)
thnx a lot Mutor just gr8
i'll check it a little later on
i have the same problem, and it refers to this
----------------------- [Now Playing Timer]
function ShoutCastNpTimer()
execute(sCleverDir.."clever.exe songtitle > output.tmp");
readfrom("np.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "\r\n");
SendToAll(sBotName, "\t HELVETIA Hub Radio f?r Winamp User");
SendToAll("\t\t H?rt mal rein >>> "..ShoutcastAddy.." <<<");
SendToAll("\t\t >>> "..line);
end
readfrom();
end
It refers to a np.tmp which is no elsewhere listed in the script. So where is it supposed to come from?
And the context Menu doesnt seem to work either :(
QuoteOriginally posted by Mutor
In my infinite wisdom, I had uploaded the wrong script version?!! DOH!
Updated the script above.
Notice:
The songtitle parameter [Now Playing] is a little flakey.
For what it's worth, it's not even listed in the options for the commandline version. You can see what I mean , by issueing the command several times consecutively.
Anyway this version should work better...
As for the context menu, that bit is fine, bear in mind that not all clients actually support submenus,[< dc++ 0.401] or menus at all [ancient clients].
Ensure you have enabled commands in the script [SendCmdMenu = "yes"] and that your client is set to:
'Accept custom user commands' in DC++ settings -> Advanced.
Lastly, it is only set to appear on the hub tab, if menu is enabled you should get a message at login. ie [with default params]:
<-=Radio=-> SHOUTCast menu enabled, right click hub tab for commands.
post your comments.
I really like this script but...
Syntax error: attempt to call global `ShoutCastNpTimer' (a nil value)
stack traceback:
1: function `OnTimer' at line 18 [file `.\PtoKaX\scripts\shoutcast.lua']
and to the right click context menu - must be my client because i had thesettings right for ages used to have another script with other cmd's
i think shoutcast server should be same as the hub server . Is here a way out that it could be run on a different comp . and let it be linked with hub
Thnx Mutor, i checked the wrong place for the context menu - :rolleyes:
Well i still had a couple of Errors with the script so i did a minor alteration by adding a folder in scripts named "hubradio" and split the output.tmp in the certain cmd's into different files. Well its working now :D
sCleverDir = "C:\\clever\\";
sBotName = "-=Radio=-";
low = strlower;
sHelpOutput = "\r\n\t\t\t"..sBotName..": User Befehle\r\n\t\t=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n";
sOpHelpOutput = "\r\n\t\t\t"..sBotName..": Op Befehle\r\n\t\t=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r\n";
Mins = 30 -- Interval [in minuten] zwischen den anzeigen des Timers.
TimerOn = "1" -- Starte script mit dem Now Playing timer on/off "1"=on "0"=off [automatische wiedergabe auch gleich mit dabei]
ShoutcastAddy = "http://helvetia.ath.cx:8000/listen.pls" -- port nummer nicht vergessen.
SendCmdMenu = "yes" --Sende context menu? (rechts click menu)
SCMenu = "-=Radio=-" --Name f?r context menu (beim hub tab nicht in der Userliste)
RadioStation = "HELVETIA Hub Radio" -- Sender Name
--
--
OpCmds = ""
UserCmds = ""
TrackCmd = ""
function OnTimer()
ShoutCastNpTimer()
end
function Main()
frmHub:RegBot(sBotName);
SetTimer(Mins*60000)
if TimerOn == "1" then
execute(sCleverDir.."clever.exe play");
play="1"
StartTimer()
end
tCommands = {
[low("!SC.next")] = {ShoutCastNext,1,"Spiele n?chstes Lied in der Wiedergabeliste"},
[low("!SC.prev")] = {ShoutCastPrev,1,"Spiele vorheriges Lied in der Wiedergabeliste"},
[low("!SC.rew")] = {ShoutCastRew,1,"Spiele gleiches Lied nochmal von vorne"},
[low("!SC.which")] = {ShoutCastGetTrack,1,"Hole Titelnummer des derzeitigen Liedes"},
[low("!SC.plist")]= {ShoutCastPlayList,0,"Zeige Wiedergabeliste als PM"},
[low("!SC.playn")]= {ShoutCastPlayNumber,2,"Spiele Lied Nummer x in der Wiedergabeliste"},
[low("!SC.play")]= {ShoutCastPlay,1,"Wiedergabe"},
[low("!SC.pause")]= {ShoutCastPause,1,"Pause"},
[low("!SC.stop")]= {ShoutCastStop,1,"Stop"},
[low("!SC.shuff")]= {ShoutCastShuffle,1,"Zufallsschalter. Zeigt Status"},
[low("!SC.np")]= {ShoutCastNp,0,"Anzeige Jetzt spielt"},
[low("!SC.npoff")]= {ShoutCastKillTimer,1,"Stoppe Jetzt spielt Timer"},
[low("!SC.npon")]= {ShoutCastStartTimer,1,"Starte Jetzt spielt Timer"},
[low("!SC.status")]= {ShoutCastStatus,0,"Statusanzeige (Wiedergabe/Stop/Pause)"},
[low("!SC.sprop")]= {ShoutCastSP,0,"Anzeige Song Info. (Zeigt Stream Info im Players)"},
[low("!SC.help")]= {ShoutCastHelp,0,"Hilfe"},
};
for sCmd, tCmd in tCommands do
if(tCmd[2] == 1) then
sOpHelpOutput = sOpHelpOutput.."\t\t"..sCmd.."\t-\t"..tCmd[3].."\r\n";
OpCmds = OpCmds.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." ||"
elseif(tCmd[2] == 2) then
TrackCmd = TrackCmd.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." %[line:Track No.]||"
else
sHelpOutput = sHelpOutput.."\t\t"..sCmd.."\t-\t"..tCmd[3].."\r\n";
UserCmds = UserCmds.."$UserCommand 1 1 "..SCMenu.."\\"..sCmd.." $<%[mynick]> "..sCmd.." ||"
end
end
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 NewUserConnected(curUser,data)
if SendCmdMenu == "yes" then
curUser:SendData(sBotName, SCMenu.." menu aktiv, rechtsclick hub-tab f?r Befehle.")
curUser:SendData (UserCmds)
if curUser.bOperator then
curUser:SendData(OpCmds)
curUser:SendData(TrackCmd)
end
end
end
OpConnected = NewUserConnected
----------------------- [Next command]
function ShoutCastNext(curUser)
execute(sCleverDir.."clever.exe next");
if play=="0" then
execute(sCleverDir.."clever.exe play");
end
execute(sCleverDir.."clever.exe songtitle > hubradio/playlist.tmp");
readfrom("hubradio/playlist.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "N?chste Lied ( "..line.." ) ausgew?hlt von "..curUser.sName);
end
readfrom();
end
----------------------- [Prev command]
function ShoutCastPrev(curUser)
if play=="0" then
execute(sCleverDir.."clever.exe play");
end
execute(sCleverDir.."clever.exe prev");
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitel.tmp");
readfrom("hubradio/songtitel.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "Vorheriges Lied ( "..line.." ) ausgew?hlt von: "..curUser.sName);
end
readfrom();
end
----------------------- [Rewind command]
function ShoutCastRew(curUser)
execute(sCleverDir.."clever.exe stop");
execute(sCleverDir.."clever.exe play");
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitle.tmp");
readfrom("hubradio/songtitle.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "Und nochmal... "..curUser.sName.." m?chte ( "..line.." ) nochmal h?ren!");
end
readfrom();
end
----------------------- [Get Track No. command]
function ShoutCastGetTrack(curUser)
execute(sCleverDir.."clever.exe getplpos > hubradio/getplpos.tmp");
readfrom("hubradio/getplpos.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
curUser:SendData(sBotName, "jetzt l?uft gerade lied nummer : [ "..line.." ]");
end
readfrom();
end
----------------------- [Playlist command]
function ShoutCastPlayList(curUser)
execute(sCleverDir.."clever.exe playlist > hubradio/playlist.tmp");
readfrom("hubradio/playlist.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(curUser)
execute(sCleverDir.."clever.exe play");
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitel.tmp");
readfrom("hubradio/songtitel.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", " ), ");
SendToAll(sBotName, curUser.sName.." hat soeben den Hub Radio Server gestartet. Jetzt l?uft: "..line);
end
readfrom();
play="1"
end
----------------------- [Play Track command]
function ShoutCastPlayNumber(curUser, args)
if(args and tonumber(args)) then
execute(sCleverDir.."clever.exe play "..tonumber(args));
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitle.tmp");
readfrom("hubradio/songtitle.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, curUser.sName.." hat sich track #"..tonumber(args).." ausgesucht: ( "..line.." )");
end
end
readfrom();
end
----------------------- [Pause command]
function ShoutCastPause(curUser)
execute(sCleverDir.."clever.exe pause");
SendToAll(sBotName, curUser.sName.." hat den HubRadio Server pausiert.");
return 1
end
----------------------- [Stop command]
function ShoutCastStop(curUser)
execute(sCleverDir.."clever.exe stop");
SendToAll(sBotName, curUser.sName.." hat den HubRadio Server gestoppt.");
StopTimer()
play="0"
end
----------------------- [Shuffle command]
function ShoutCastShuffle(curUser)
execute(sCleverDir.."clever.exe swshuffle > hubradio/swshuffle.tmp");
readfrom("hubradio/swshuffle.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "Shuffle ist [ "..line.." ]");
end
readfrom();
end
----------------------- [Status command]
function ShoutCastStatus(curUser)
execute(sCleverDir.."clever.exe status > hubradio/status.tmp");
readfrom("hubradio/status.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
curUser:SendData(sBotName, "Hub Radio Status ist: [ "..line.." ] auf "..ShoutcastAddy);
end
readfrom();
end
----------------------- [Song Properties command]
function ShoutCastSP(curUser)
execute(sCleverDir.."clever.exe getinfo > hubradio/getinfo.tmp");
readfrom("hubradio/getinfo.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "\r\n");
curUser:SendData(sBotName, "\r\n Song info >> "..line.." Siehe Stream Info in deinem player");
end
readfrom();
end
----------------------- [Now Playing command]
function ShoutCastNp(curUser)
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitle.tmp");
if play=="0" then
curUser:SendData(sBotName, "Lass zuerst mal was laufen bevor du die Anzeige verwenden willst")
return 1
end
readfrom("hubradio/songtitle.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "\t Jetzt l?uft auf "..RadioStation..":");
SendToAll("\t\t >>> "..line);
end
readfrom();
end
----------------------- [Now Playing Timer]
function ShoutCastNpTimer(curUser)
execute(sCleverDir.."clever.exe songtitle > hubradio/songtitle.tmp");
if play=="0" then
curUser:SendData(sBotName, "Lass zuerst mal was laufen bevor du die Anzeige verwenden willst")
return 1
end
readfrom("hubradio/songtitle.tmp");
local line = read("*a");
if(line) then
line = gsub(line, "\n", "");
SendToAll(sBotName, "\t Jetzt l?uft auf "..RadioStation..":");
SendToAll("\t\t >>> "..line);
SendToAll("\t\t "..ShoutcastAddy.." - h?ng dich rein :D");
end
readfrom();
end
----------------------- [Stop Now Playing Timer]
function ShoutCastKillTimer(curUser)
if(curUser.bOperator) then
StopTimer()
curUser:SendData(sBotName,"Now Playing timer wurde gestoppt.")
end
end
----------------------- [Start Now Playing Timer]
function ShoutCastStartTimer(curUser)
if(curUser.bOperator) then
if play=="0" then
curUser:SendData(sBotName, "Lass zuerst mal was laufen bevor du die Anzeige verwenden willst")
return 1
end
StartTimer()
curUser:SendData(sBotName,"Now Playing timer wurde gestartet.")
end
end
----------------------- [Help command]
function ShoutCastHelp(curUser)
curUser:SendData(sBotName, sHelpOutput);
if(curUser.bOperator) then
curUser:SendData(sBotName, sOpHelpOutput);
end
curUser:SendData("\r\n\r\n\t\tUm den Hub Radio zu Bookmarken mit Winamp,\r\n\t\tdr?cke [Strg] + L und f?ge "..ShoutcastAddy.." ein\r\n")
end
P.s this is the one i'm using now because it doesn't crash my hub (dont know why it did) on hub restart or shutdown. By the way its in german.
Thnx for the script anyway its gr8 and being used/loved and adored *g*.
LOVE IT :D :D
QuoteOriginally posted by _Satan_
i think shoutcast server should be same as the hub server . Is here a way out that it could be run on a different comp . and let it be linked with hub
i think it may be possible since you can configure the shoutcast server to be a relay rather than on same pc, however i would assume the commands would no longer work unless that can be changed to accomodate.
QuoteOriginally posted by Mutor
I am curious to know what erors you had, as I haven't had any. What version of Px are you using. this has been tested on 0.3.3.0 and 0.3.2.6.
.....
i'm using 0.330 build 15.25 atm and i had prob due to ram stacking or something like that not quite sure off hand without looking up the numbers
I still get error messages but not while running. Only when i stop the hub then i end up clickin away 6 to 8 boxes. next time i restarti'll note whats standing there.
But i can live with that, and saving the different parts in seperate files could come in handy sometime later on i guess
Must say u did a great job Mutor! thx on behalf of me hub :D
Alloy again...i got some more requests ^^ Well this is not very necessary but would be a great feature :D
Is it able to put the OP Commands On/Off if i dont want the Operators to use it while im at my computer myself (with like !sc.opoff/!sc.opon or something). It would also be good with a message telling them they are not able to use the cmds. I mean it would be great if i could activate OP Commands when im going away so the others can control my SC server for me.
Another thing is, i would like to be able to give control to one special Operator (meaning he can use OP Commands but noone else except me the hub/serverowner)
I guess to make this work good also need to be able to allow Hubowner to be able to use the OP Commands all the time even with OP Commands off for regular operators
cheers // Dj_OcTaGoN