on *:start: {
if ($exists($itconfig) == $true) {
if ($ini($itconfig,settings,theme) == 0) { itsettings theme [DESCRIBE] is listening to $!chr(2) $!+ ' $!+ $!itunesinfo(track) $!+ ' $!+ $!chr(15) by $!chr(2) $!+ $!itunesinfo(artist) $!+ $!chr(15) [ $!+ $!asctime($itunesinfo(seclength),n:ss) $!+ / $!+ $!itunesinfo(size) $!+ mb/ $!+ $!itunesinfo(bitrate) $!+ kbps] }
if ($itsettings(autoconn) == true) { .comopen irctunes iTunes.Application }
if ($itsettings(checkupdate) == true) { .timerupd 1 5 itunes checkupdate }
}
else {
writeini -n $itconfig script n0 on *:START: $chr(123)
writeini -n $itconfig script n1 .unload -rs $!shortfn($script)
writeini -n $itconfig script n2 echo -a Error: irctunes.ini may NOT be loaded
writeini -n $itconfig script n3 $chr(125)
itsettings theme [DESCRIBE] is listening to $!chr(2) $!+ ' $!+ $!itunesinfo(track) $!+ ' $!+ $!chr(15) by $!chr(2) $!+ $!itunesinfo(artist) $!+ $!chr(15) [ $!+ $!asctime($itunesinfo(seclength),n:ss) $!+ / $!+ $!itunesinfo(size) $!+ mb/ $!+ $!itunesinfo(bitrate) $!+ kbps]
itsettings checkupdate true
itsettings autoconn true
itsettings demand false
itsettings dcc false
itsettings demand false
itsettings support false
.comopen irctunes iTunes.Application
}
if ($exists($scriptdiritplugins\) != $true) mkdir $scriptdiritplugins\
if ($findfile($scriptdiritplugins\,it_*.mrc,0) > 0) {
var %it.pluginload 1
while (%it.pluginload <= $findfile($scriptdiritplugins\,it_*.mrc,0)) {
if (!$script($findfile($scriptdiritplugins\,it_*.mrc,%it.pluginload).shortfn)) {
.load -rs $+(",$findfile($scriptdiritplugins\,it_*.mrc,%it.pluginload),")
}
inc %it.pluginload
}
}
echo -a iRCTunes $itversion for mIRC has been loaded - to view a list of commands type /itunes help :)
}
on *:unload: {
if ($com(irctunes)) { .comclose irctunes }
if ($exists($itconfig)) { .rename $itconfig $+($shortfn($scriptdir),irctunes-old-,$ctime,.ini) }
echo -a iRCTunes $itversion for mIRC unloaded :(
}
on *:exit: {
remini $itconfig temp
}
on *:text:!itunes*:#: {
if ($1 == !itunes) {
if ($itsettings(demand) == true) {
if (!$com(irctunes)) { .notice $nick [iRCTunes] iTunes is currently disconnected }
else { .notice $nick [iRCTunes] I am listening to $chr(2) $+ ' $+ $itunesinfo(track) $+ ' $+ $chr(15) by $chr(2) $+ $itunesinfo(artist) $+ $chr(15) from the album $chr(2) $+ $itunesinfo(album) $+ $chr(15) }
}
else { .notice $nick [iRCTunes] iRCTunes on demand is currently disabled }
}
}
on *:text:!getsong*:#: {
if ($1 == !getsong) {
if ($itsettings(dcc) == true) { .notice $nick iRCTunes DCC request accepted - preparing to send file $nopath($itunesinfo(location)) | .timerdcc $+ $rand(1,100) 1 $rand(2,7) .dcc send $nick $itunesinfo(shortlocation) }
}
}
on *:join:#thegeeklord: {
if ($network == freenode) && ($itsettings(support) == true) {
describe $chan requires help with iRCTunes for mIRC $itversion running on Windows $os with mIRC $version
itsettings support false
}
}
ctcp *:irctunes: {
.notice $nick I use iRCTunes $itversion for mIRC by Peter Powell (irctunes.sf.net)
}
ctcp *:getsong: {
if ($itsettings(dcc) == true) { .notice $nick iRCTunes DCC request accepted - preparing to send file $nopath($itunesinfo(location)) | .timerdcc $+ $rand(1,100) 1 $rand(2,7) .dcc send $nick $itunesinfo(shortlocation) }
else { .notice $nick [iRCTunes] I currently have my iRCTunes DCC Server disabled }
}
ctcp *:itunes: {
if ($itsettings(demand) == true) {
if (!$com(irctunes)) { .notice $nick [iRCTunes] iTunes is currently disconnected }
else { .notice $nick [iRCTunes] I am listening to $chr(2) $+ ' $+ $itunesinfo(track) $+ ' $+ $chr(15) by $chr(2) $+ $itunesinfo(artist) $+ $chr(15) from the album $chr(2) $+ $itunesinfo(album) $+ $chr(15) }
}
else { .notice $nick [iRCTunes] iRCTunes on Demand is currently disabled }
}
alias itunes {
if (!$1) { echo -a 03Error: you need to enter a command - See "/itunes help" for all of the commands }
elseif ($1 == help) {
echo -a == iRCTunes $itversion for mIRC Help ==
echo -a /itunes about - Displays an information dialog showing information about iRCTunes
echo -a /itunes acheckupdate - Toggles checking for iRCTunes updates when mIRC starts on and off
echo -a /itunes advertise - Messages information about your iRCTunes versions to the active channel
echo -a /itunes autobroadcast - Toggles automatically broadcasting the current tracks information on and off
echo -a /itunes autoconn - Toggles automatically connecting to iTunes when mIRC starts on and off
echo -a /itunes autoshowto - Toggles automatically sending your current tracks info to a target on and off
echo -a /itunes broadcast - Messages your current track's information to all channels on all networks
echo -a /itunes checkupdate - Connects to the iRCTunes update server and checks if a newer version exists
echo -a /itunes clipboard - Sends information about your current playing track to the windows clipboard
echo -a /itunes comstatus - Shows information about whether iRCTunes is connected to iTunes or not
echo -a /itunes dcc - Toggles the iRCTunes' DCC Server on and off allowing you to share your music
echo -a /itunes demand - Toggles iTunes on Demand on and off allowing the querying mIRC for your track
echo -a /itunes editbox - Sends information about your current playing track to your active window's editbox
echo -a /itunes help - Displays a list of commands which can be used with iRCTunes and it's plugins
echo -a /itunes info - Displays a dialog containing various information about the current playing track
echo -a /itunes next - Sends a request to iTunes to change the playing track to the next in the playlist
echo -a /itunes pause - Sends a request to iTunes to temporarily pause the playing of the current track
echo -a /itunes popup - Displays an information dialog allowing use of iRCTunes via the press of a button
echo -a /itunes play - Sends a request to iTunes to start play or continue the currently selected track
echo -a /itunes prev - Sends a request to iTunes to change the playing track to the previous in the playlist
echo -a /itunes plugins - Displays a list of plugins which exist in the plugins directory and their status
echo -a /itunes restart - Closes iRCTunes' connection to iTunes (if it exists) and reconnects after a delay
echo -a /itunes rewind - Sends a request to iTunes to rewind the currently playing track until paused
echo -a /itunes sendtrack - Sends the currently playing track to a specified user over IRC using DCC send
echo -a /itunes show - Sends information about your current playing track to the active channel/pmsg window
echo -a /itunes showto - Sends information about your current playing track to a specified irc target
echo -a /itunes stop - Sends a request to iTunes to stop the playing of the current track permanently
echo -a /itunes support - Connects you automatically to the iRCTunes support channel on the freenode network
echo -a /itunes theme - Shows a human readable version of the iRCTunes theme in the active window
echo -a /itunes themehelp - Displays a list of theme variables for use with iRCTunes theme editor
echo -a /itunes themes - Displays the iRCTunes theme editor for changing your iRCTunes np theme
echo -a /itunes website - Displays the iRCTunes for mIRC website in your windows default browser
echo -a Copyright $chr(169) $asctime(yyyy) Peter Powell (irctunes.sf.net)
}
elseif ($1 == themehelp) {
echo -a == iRCTunes $itversion for mIRC Theming Help ==
echo -a The variables you can use in themes are:
echo -a ^ALBUM^ - Returns the album of your current track
echo -a ^ARTIST^ - Returns the artist of your current track
echo -a ^BITRATE^ - Returns the bitrate of your current track
echo -a ^BPM^ - Returns the beats per minute of your track
echo -a ^GENRE^ - Returns the genre of your current track
echo -a ^GRAPHRATING^ - Returns the rating of your current track (graph format)
echo -a ^LENGTH^ - Returns the formatted length of your current track
echo -a ^LOCATION^ - Returns the long location of your current track
echo -a ^PLAYCOUNT^ - Returns the play count of your current track
echo -a ^RATING^ - Returns the rating of your current track
echo -a ^SECLENGTH^ - Returns the length in seconds of your current track
echo -a ^SHORTLOCATION^ - Returns the short location of your current track
echo -a ^SIZE^ - Returns the size in megabytes of your current track
echo -a ^TRACK^ - Returns the name of your current track
echo -a ^YEAR^ - Returns the year your current track was released
echo -a ^COMPOSER^ - Returns the composer of your current track
echo -a ^COMMENTS^ - Returns the comments of your current track
echo -a ^MEDIATYPE^ - Returns the media type of your current track
echo -a ^TRACKCOUNT^ - Returns the track count of your current track
echo -a ^TRACKNUMBER^ - Returns the track number of your current track
echo -a ^COMPILATION^ - Returns the compilation of your current track
echo -a (+) - Removes the space between the previous and next variable
echo -a TIME(duration,format) - Returns the duration in the format specified
echo -a (BOLD) - Inserts a bold start character (ASCII character 2)
echo -a (/BOLD) - Inserts a bold end character (ASCII character 15)
echo -a Copyright $chr(169) $asctime(yyyy) Peter Powell (irctunes.sf.net)
}
elseif ($1 == website) { run http://irctunes.sourceforge.net/mirc/ }
elseif ($1 == popup) { dialog -m it_popup it_popup }
elseif ($1 == info) { dialog -m it_trackinfo it_trackinfo }
elseif ($1 == about) { dialog -m it_about it_about }
elseif ($1 == themes) { dialog -m it_theming it_theming }
elseif ($1 == theme) { echo -a 04Current Theme: $itcurrtheme }
elseif ($1 == plugins) {
if ($exists($scriptdiritplugins\) != $true) mkdir $scriptdiritplugins\
if ($findfile($scriptdiritplugins\,it_*.mrc,0) > 0) {
var %it.plugin 1
echo -a == iRCTunes $itversion Plugin List ==
while (%it.plugin <= $findfile($scriptdiritplugins\,it_*.mrc,0)) {
echo -a $+(Name:,$chr(32),$replace($nopath($findfile($scriptdiritplugins\,it_*.mrc,%it.plugin)),.mrc,$null),$chr(44),$chr(32),Status:,$chr(32),$iif(!$script($findfile($scriptdiritplugins\,it_*.mrc,%it.plugin).shortfn),Not Loaded,Loaded))
inc %it.plugin
}
}
else {
echo Error: iRCTunes can not find any plugins matching the name it_*.mrc in the plugins directory
}
}
elseif ($1 == status) {
if (!$com(irctunes)) { echo -a COM Status: iRCTunes is disconnected from iTunes }
elseif ($com(irctunes)) { echo -a COM Status: iRCTunes is connected to iTunes }
}
elseif ($1 == comstatus) {
if (!$com(irctunes)) { echo -a COM Status: iRCTunes is disconnected from iTunes }
elseif ($com(irctunes)) { echo -a COM Status: iRCTunes is connected to iTunes }
}
elseif ($1 == sendtrack) {
if ($2) { dcc send $2 $itunesinfo(shortlocation) }
else { dcc send $?="Enter the nickname of the person you would like to send your current track to" $itunesinfo(shortlocation) }
}
elseif ($1 == rewind) {
var %it.comresult $com(irctunes,Rewind,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes rewind }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
elseif ($1 == show) {
tokenize 32 $itsettings(theme)
if ($1 == [DESCRIBE]) { .scid $scid($activecid) describe $active $2- }
else { .scid $scid($activecid) msg $active $itsettings(theme) }
}
elseif ($1 == showto) {
if ($2) {
var %trgt $2
tokenize 32 $itsettings(theme)
if ($1 == [DESCRIBE]) { .scid $scid($activecid) describe %trgt $2- }
else { .scid $activecid msg %trgt $itsettings(theme) }
}
else echo -a Syntax: /itunes showto [#ChannelName|NickName]
}
elseif ($1 == broadcast) {
tokenize 32 $itsettings(theme)
if ($1 == [DESCRIBE]) { .scid -at1 ame $2- }
else { .scid -at1 amsg $itsettings(theme) }
}
elseif ($1 == demand) {
if ($itsettings(demand) == false) { itsettings demand true | scid -at1 ame has now enabled iTunes On Demand - type !itunes or /ctcp $me itunes to see what song i am currently playing in iTunes [iRCTunes] }
elseif ($itsettings(demand) == true) { itsettings demand false | scid -at1 ame now has disabled iTunes On Demand [iRCTunes] }
}
elseif ($1 == autoconn) {
if ($itsettings(autoconn) == true) { itsettings autoconn false | echo -a iRCTunes will no longer connect to iTunes on startup (not recommended) | echo -a To re-enable this type /itunes autoconn (recommended) }
elseif ($itsettings(autoconn) == false) { itsettings autoconn true | echo -a iRCTunes will now connect to iTunes on startup (recommended) | echo -a To disable this type /itunes autoconn (not recommended) }
}
elseif ($1 == dcc) {
if ($itsettings(dcc) == false) { itsettings dcc true | scid -at1 ame has now enabled their iRCTunes DCC Server - type !getsong or /ctcp $me getsong to get a copy of the song i am currently playing in iTunes [iRCTunes] }
elseif ($itsettings(dcc) == true) { itsettings dcc false | scid -at1 ame has now disabled their iRCTunes DCC Server [iRCTunes] }
}
elseif ($1 == checkupdate) {
if ($sock(it_chkupdate)) { sockclose it_chkupdate }
.sockopen it_chkupdate irctunes.sourceforge.net 80
}
elseif ($1 == acheckupdate) {
if ($itsettings(checkupdate) == false) { itsettings checkupdate true | echo -a Automatic update checking now enabled (recommended) }
elseif ($itsettings(checkupdate) == true) { itsettings checkupdate false | echo -a Automatic update checking now disabled (not recommended) }
}
elseif ($1 == helps) {
; BEGIN EASTER EGG!!!!!!!!!!!!!!
if ($version >= 6.3) {
var %it.tipwin $+(easteregg,$rand(1,99999))
noop $tip(%it.tipwin, Hey $me,OI!!!, 5)
noop $tip(%it.tipwin, Hey $me,This is iRCTunes speaking here!, 5)
noop $tip(%it.tipwin, Hey $me,Im fed up of you always making, 5)
noop $tip(%it.tipwin, Hey $me,the mistake of 'helps' instead, 5)
noop $tip(%it.tipwin, Hey $me,of 'help' - learn to spell plz, 5)
noop $tip(%it.tipwin, Hey $me,$chr(32), 5)
noop $tip(%it.tipwin, Hey $me,[iRCTunes Easter Egg Engine :P], 5)
}
; END EASTER EGG!!!!!!!!!!!!!!
else {
echo -a Error: " $+ $1- $+ " is an unknown command
}
}
elseif ($1 == clipboard) { clipboard [iRCTunes] Track: $itunesinfo(track) $+ , Artist: $itunesinfo(artist) $+ , Album: $itunesinfo(album) | echo -a 04Track information sent to the clipboard }
elseif ($1 == editbox) { editbox [iRCTunes] Track: $itunesinfo(track) $+ , Artist: $itunesinfo(artist) $+ , Album: $itunesinfo(album) | echo -a 04Track information sent to the editbox }
elseif ($1 == advertise) { scid $activecid describe $active uses iRCTunes $itversion for mIRC by Peter Powell (irctunes.sf.net) }
elseif ($1 == showabout) { echo -a The /itunes showabout command has been renamed to /itunes advertise }
elseif ($1 == autobroadcast) {
if ($timer(ast)) { .timerast off | echo -a iRCTunes detected that autoshowto was enabled and has disabled it to prevent conflicts }
if ($timer(abc)) { .timerabc off | echo -a iRCTunes will now no longer send an automatic np message to all channels }
elseif (!$timer(abc)) { .ittemp lastlocb $itunesinfo(shortlocation) | .timerabc 0 10 abcast | echo -a iRCTunes will now send an automatic np message to all channels every time your track changes }
}
elseif ($1 == autoshowto) {
if ($timer(abc)) { .timerabc off | echo -a iRCTunes detected that autobroadcast was enabled and has disabled it to prevent conflicts }
if ($timer(ast)) { .timerast off | unset %it.shwtochn | echo -a iRCTunes will now no longer send an automatic np message to your specified channel }
elseif (!$timer(ast)) {
if ($2) { ittemp lastlocs $itunesinfo(shortlocation) | .timerast 0 10 .scid $scid($activecid) ashowto $2 | echo -a iRCTunes will now send an automatic np message to $$2 every time your track changes }
else echo -a Syntax: /itunes autoshowto [#ChannelName|NickName]
}
}
elseif ($1 == support) {
itsettings support true
if ($status == disconnected) server chat.freenode.net -j #thegeeklord
else server -m chat.freenode.net -j #thegeeklord
echo -a Now Connecting you to the freenode IRC Network for Live Support
echo -a An automatic support message will be sent to the help channel on connection
}
elseif ($1 == restart) {
echo -a Restarting iRCTunes connection..
if ($com(irctunes)) { .comclose irctunes | .timerco 1 1 .comopen irctunes iTunes.Application }
else { .comopen irctunes iTunes.Application }
.timer1 1 2 echo -a iRCTunes has now restarted
}
elseif ($1 == play) {
var %it.comresult $com(irctunes,Play,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes play }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
elseif ($1 == pause) {
var %it.comresult $com(irctunes,Pause,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes play }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
elseif ($1 == stop) {
var %it.comresult $com(irctunes,Stop,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes stop }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
elseif ($1 == next) {
var %it.comresult $com(irctunes,NextTrack,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes next }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
elseif ($1 == prev) {
var %it.comresult $com(irctunes,PreviousTrack,3)
if (!$com(irctunes)) { .comopen irctunes iTunes.Application }
if ($comerr) { silentrestart | itunes prev }
if (%it.comresult == 0) { echo -a 03Error: Please ensure that iTunes is open and connected (/itunes comstatus) }
}
else {
echo -a Error: " $+ $1- $+ " is an unknown command
}
}
alias itunesinfo {
if (!$com(irctunes)) .comopen irctunes iTunes.Application
if ($com(CurrentTrack)) .comclose CurrentTrack
.echo -q $com(irctunes,CurrentTrack,3,dispatch* CurrentTrack)
if ($comerr) { silentrestart | return COM Error }
if (!$com(CurrentTrack)) { silentrestart | return COM Error }
if ($1 == track) {
.echo -q $com(CurrentTrack,Name,3)
if ($com(CurrentTrack).result == $null) return Unknown Track
var %it.track $com(CurrentTrack).result
return %it.track
}
elseif ($1 == artist) {
.echo -q $com(CurrentTrack,Artist,3)
if ($com(CurrentTrack).result == $null) return Unknown Artist
var %it.artist $com(CurrentTrack).result
return %it.artist
}
elseif ($1 == album) {
.echo -q $com(CurrentTrack,Album,3)
if ($com(CurrentTrack).result == $null) return Unknown Album
var %it.album $com(CurrentTrack).result
return %it.album
}
elseif ($1 == bitrate) {
.echo -q $com(CurrentTrack,BitRate,3)
if ($com(CurrentTrack).result == $null) return Unknown Bitrate
var %it.bitrate $com(CurrentTrack).result
return %it.bitrate
}
elseif ($1 == playcount) {
.echo -q $com(CurrentTrack,PlayedCount,3)
if ($com(CurrentTrack).result == $null) return Unknown Playcount
var %it.playcount $com(CurrentTrack).result
return %it.playcount
}
elseif ($1 == rating) {
.echo -q $com(CurrentTrack,Rating,3)
if ($com(CurrentTrack).result == $null) return Unknown Rating
var %it.rating $com(CurrentTrack).result
if (%it.rating == 0) { var %it.fullrating Unrated }
else { var %it.fullrating %it.rating }
return %it.fullrating
}
elseif ($1 == graphrating) {
.echo -q $com(CurrentTrack,Rating,3)
if ($com(CurrentTrack).result == $null) return Unknown Rating
var %it.graphrating $com(CurrentTrack).result
if (%it.graphrating == 0) { var %it.fullgraphrating [UNRATED] }
elseif (%it.graphrating == 20) { var %it.fullgraphrating [*....] }
elseif (%it.graphrating == 40) { var %it.fullgraphrating [**...] }
elseif (%it.graphrating == 60) { var %it.fullgraphrating [***..] }
elseif (%it.graphrating == 80) { var %it.fullgraphrating [****.] }
elseif (%it.graphrating == 100) { var %it.fullgraphrating [*****] }
return %it.fullgraphrating
}
elseif ($1 == length) {
.echo -q $com(CurrentTrack,Duration,3)
if ($com(CurrentTrack).result == $null) return Unknown Length
var %it.duration $duration($com(CurrentTrack).result)
return %it.duration
}
elseif ($1 == seclength) {
.echo -q $com(CurrentTrack,Duration,3)
if ($com(CurrentTrack).result == $null) return Unknown Length
var %it.duration $com(CurrentTrack).result
return %it.duration
}
elseif ($1 == genre) {
.echo -q $com(CurrentTrack,Genre,3)
if ($com(CurrentTrack).result == $null) return Unknown Genre
var %it.genre $com(CurrentTrack).result
return %it.genre
}
elseif ($1 == bpm) {
.echo -q $com(CurrentTrack,BPM,3)
if ($com(CurrentTrack).result == $null) return Unknown BPM
var %it.bpm $com(CurrentTrack).result
return %it.bpm
}
elseif ($1 == location) {
.echo -q $com(CurrentTrack,Location,3)
if ($com(CurrentTrack).result == $null) return Unknown Location
var %it.location $com(CurrentTrack).result
return %it.location
}
elseif ($1 == shortlocation) {
.echo -q $com(CurrentTrack,Location,3)
if ($com(CurrentTrack).result == $null) return Unknown Location
var %it.location2 $com(CurrentTrack).result
var %it.shortlocation $shortfn(%it.location2)
return %it.shortlocation
}
elseif ($1 == size) {
.echo -q $com(CurrentTrack,Size,3)
if ($com(CurrentTrack).result == $null) return Unknown Size
var %it.size $left($calc($com(CurrentTrack).result / 1048576),4)
return %it.size
}
elseif ($1 == year) {
.echo -q $com(CurrentTrack,Year,3)
if ($com(CurrentTrack).result == $null return Unknown Year
elseif ($com(CurrentTrack).result == 0) return Unknown Year
var %it.year $com(CurrentTrack).result
return %it.year
}
elseif ($1 == composer) {
.echo -q $com(CurrentTrack,Composer,3)
if ($com(CurrentTrack).result == $null) return Unknown Composer
var %it.composer $com(CurrentTrack).result
return %it.composer
}
elseif ($1 == comments) {
.echo -q $com(CurrentTrack,Comment,3)
if ($com(CurrentTrack).result == $null) return Unknown Comments
var %it.comment $com(CurrentTrack).result
return %it.comment
}
elseif ($1 == mediatype) {
.echo -q $com(CurrentTrack,KindAsString,3)
if ($com(CurrentTrack).result == $null) return Unknown Media Type
var %it.mediatype $com(CurrentTrack).result
return %it.mediatype
}
elseif ($1 == trackcount) {
.echo -q $com(CurrentTrack,TrackCount,3)
if ($com(CurrentTrack).result == $null) return Unknown Track Count
elseif ($com(CurrentTrack).result == 0) return Unknown Track Count
var %it.trackcount $com(CurrentTrack).result
return %it.trackcount
}
elseif ($1 == tracknumber) {
.echo -q $com(CurrentTrack,TrackNumber,3)
if ($com(CurrentTrack).result == $null) return Unknown Track Number
elseif ($com(CurrentTrack).result == 0) return Unknown Track Number
var %it.tracknumber $com(CurrentTrack).result
return %it.tracknumber
}
elseif ($1 == compilation) {
.echo -q $com(CurrentTrack,Compilation,3)
if ($com(CurrentTrack).result == $null) return Unknown Compilation
var %it.compilation $com(CurrentTrack).result
return $right(%it.compilation,-1)
}
elseif ($1 == location2) {
return $itunesinfo(shortlocation)
}
elseif ($1 == rating2) {
return $itunesinfo(graphrating)
}
elseif ($1 == length2) {
return $itunesinfo(seclength)
}
}
alias irctunes {
echo -a 03Error: did you mean to type /itunes $1- $+ ?
}
alias itversion {
$iif($isid,return,echo) v2.4
}
alias itnumversion {
$iif($isid,return,echo) 2.4.0
}
alias itsettings {
if ($isid == $true) return $readini($itconfig, settings, $1)
else writeini $itconfig settings $$1 $$2-
}
alias ittemp {
if ($isid == $true) return $readini($itconfig, temp, $1)
else writeini $itconfig temp $$1 $$2 $3-
}
alias itconfig {
$iif($isid,return,echo) $+($shortfn($scriptdir),irctunes.ini)
}
alias itdirectory {
$iif($isid,return,echo) $iif($1 == $true,$shortfn($scriptdir),$scriptdir)
}
alias itparsetheme {
if ($1 == read2code) {
var %a $replace($2,^ALBUM^,$!itunesinfo(album),^ARTIST^,$!itunesinfo(artist),^BITRATE^,$!itunesinfo(bitrate))
var %a $replace(%a,^BPM^,$!itunesinfo(bpm),^GENRE^,$!itunesinfo(genre),^LENGTH^,$!itunesinfo(length))
var %a $replace(%a,^SECLENGTH^,$!itunesinfo(seclength),^LOCATION^,$!itunesinfo(location))
var %a $replace(%a,^SHORTLOCATION^,$!itunesinfo(shortlocation),^PLAYCOUNT^,$!itunesinfo(playcount))
var %a $replace(%a,^RATING^,$!itunesinfo(rating),^GRAPHRATING^,$!itunesinfo(graphrating),^SIZE^,$!itunesinfo(size))
var %a $replace(%a,^TRACK^,$!itunesinfo(track),(+),$!+,TIME,$!asctime,(BOLD),$!chr(2),(/BOLD),$!chr(15))
var %a $replace(%a,^YEAR^,$!itunesinfo(year),^COMPOSER^,$!itunesinfo(composer),^COMMENTS^,$!itunesinfo(comments))
var %a $replace(%a,^MEDIATYPE^,$!itunesinfo(mediatype),^TRACKCOUNT^,$!itunesinfo(trackcount))
var %a $replace(%a,^TRACKNUMBER^,$!itunesinfo(tracknumber),^COMPILATION^,$!itunesinfo(compilation))
return %a
}
elseif ($1 == code2read) {
var %b $replace($2,$!itunesinfo(album),^ALBUM^,$!itunesinfo(artist),^ARTIST^,$!itunesinfo(bitrate),^BITRATE^)
var %b $replace(%b,$!itunesinfo(bpm),^BPM^,$!itunesinfo(genre),^GENRE^,$!itunesinfo(length),^LENGTH^)
var %b $replace(%b,$!itunesinfo(seclength),^SECLENGTH^,$!itunesinfo(location),^LOCATION^)
var %b $replace(%b,$!itunesinfo(shortlocation),^SHORTLOCATION^,$!itunesinfo(playcount),^PLAYCOUNT^)
var %b $replace(%b,$!itunesinfo(rating),^RATING^,$!itunesinfo(graphrating),^GRAPHRATING^,$!itunesinfo(size),^SIZE^)
var %b $replace(%b,$!itunesinfo(track),^TRACK^,$!+,(+),$!chr(2),(BOLD),$!chr(15),(/BOLD),$!asctime,TIME)
var %b $replace(%b,$!itunesinfo(year),^YEAR^,$!itunesinfo(composer),^COMPOSER^,$!itunesinfo(comments),^COMMENTS^)
var %b $replace(%b,$!itunesinfo(mediatype),^MEDIATYPE^,$!itunesinfo(trackcount),^TRACKCOUNT^)
var %b $replace(%b,$!itunesinfo(tracknumber),^TRACKNUMBER^,$!itunesinfo(compilation),^COMPILATION^)
return %b
}
}
alias -l itupdpopup {
if ($timer(abc)) { did -a it_popup 13 [E] Auto Broadcast Track }
else { did -a it_popup 13 [D] Auto Broadcast Track }
if ($timer(ast)) { did -a it_popup 12 [E] Auto Show Track to Chan }
else { did -a it_popup 12 [D] Auto Show Track to Chan }
if ($itsettings(dcc) = true) { did -a it_popup 17 [E] iRCTunes DCC Server }
else { did -a it_popup 17 [D] iRCTunes DCC Server }
if ($itsettings(demand) = true) { did -a it_popup 18 [E] iTunes on Demand }
else { did -a it_popup 18 [D] iTunes on Demand }
}
alias -l itcurrtheme {
return $itparsetheme(code2read,$readini($itconfig, n, settings, theme))
}
alias -l abcast {
if ($ittemp(lastlocb) != $itunesinfo(shortlocation)) { itunes broadcast | ittemp lastlocb $itunesinfo(shortlocation) }
}
alias -l ashowto {
if ($ittemp(lastlocs) != $itunesinfo(shortlocation)) { itunes showto $1 | ittemp lastlocs $itunesinfo(shortlocation) }
}
alias -l silentrestart {
if ($com(irctunes)) { .timercc 1 1 .comclose irctunes | .timerco 1 2 .comopen irctunes iTunes.Application }
else { .timerco 1 2 .comopen irctunes iTunes.Application }
}
on *:sockopen:it_chkupdate: {
if ($sockerr) { echo -a 04WARNING: A problem occured while writing to the iRCTunes update server at irctunes.sf.net | halt }
.sockwrite -n $sockname GET /misc/mircupd.php?v=2 HTTP/1.1
.sockwrite -n $sockname Host: irctunes.sourceforge.net $+ $crlf $+ $crlf
}
on *:sockread:it_chkupdate:{
if ($sockerr) { echo -a 04WARNING: A problem occured while reading from the iRCTunes update server at irctunes.sf.net | halt }
var %isck
sockread -f %isck
tokenize 32 %isck
if ($1 = LATEST_VERSION) { writeini -n $itconfig updater version $2- }
elseif ($1 == LATEST_NUMVERSION) { writeini -n $itconfig updater numversion $2- }
elseif ($1 == LATEST_INFO) { writeini -n $itconfig updater information $2- }
elseif ($1 == LATEST_LINK) { writeini -n $itconfig updater link $2- }
elseif ($1 == END_OF_FILE) { .sockclose $sockname
if ($readini($itconfig, updater, numversion) == $itnumversion) { echo -a You are using the latest version of iRCTunes for mIRC $+($chr(40),$itversion,$chr(41)) | remini $itconfig updater }
elseif ($readini($itconfig, updater, numversion) < $itnumversion) { echo -a You are using a version that is newer than the latest version of iRCTunes for mIRC $chr(40) $+ $itversion $+ $chr(41) | remini $itconfig updater }
elseif ($readini($itconfig, updater, numversion) > $itnumversion) { echo -a 04You are using an older version of iRCTunes for mIRC - Your Version: $itversion $+ , Latest Version: $readini($itconfig, updater, version) | dialog -mdrieo it_newver it_newver }
else { echo -a 03An error occurred while reading the update information - to find out the latest version please go to http://irctunes.sf.net/mirc/download.php | remini $itconfig updater }
}
}
menu channel,query {
iRCTunes $itversion
.Announce Track :itunes show
.iTunes on Demand:itunes demand
.Advertise iRCTunes:itunes advertise
.Restart iRCTunes:itunes restart
.-
.iRCTunes !commands
..!itunes:msg $active !itunes
..!getsong:msg $active !getsong
}
menu nicklist {
iRCTunes $itversion
.CTCP iTunes:ctcp $$1 itunes
.CTCP iRCTunes:ctcp $$1 irctunes
.CTCP GetSong:ctcp $$1 getsong
}
menu menubar {
iRCTunes $itversion
.iTunes Controls
..Next track:itunes next
..Pause track:itunes pause
..Play track:itunes play
..Previous track:itunes prev
..Rewind track:itunes rewind
..Stop track:itunes stop
.iRCTunes Controls
..About iRCTunes:itunes about
..Advertise iRCTunes:itunes advertise
..Automatic broadcast track:itunes autobroadcast
..Automatic showto track:itunes autoshowto $active
..Automatically check for updates:itunes acheckupdate
..Broadcast track:itunes broadcast
..Check for updates:itunes checkupdate
..Find track info:itunes info
..Get iRCTunes COM status:itunes comstatus
..iRCTunes DCC Server:itunes dcc
..iRCTunes on Demand:itunes demand
..iRCTunes theme manager:itunes themes
..iTunes autoconnect:itunes autoconn
..Restart iRCTunes:itunes restart
..List iRCTunes Plugins:itunes plugins
..Send song to clipboard:itunes clipboard
..Send song to editbox:itunes editbox
..iRCTunes Popup:itunes popup
..Send track:itunes sendtrack
..Show current theme:itunes theme
..Show track:itunes show
..Showto track:itunes showto $active
..Theme help:itunes themehelp
.Help and Support
..Main Help:itunes help
..Theme Help:itunes themehelp
..External Support
...WWW:itunes website
...Live Support:itunes support
}
dialog -l it_trackinfo {
title "iRCTunes :: Track Information"
size -1 -1 160 71
option dbu
box Listing information for $nopath($itunesinfo(shortlocation)), 1, 1 1 158 69
text Name: $itunesinfo(track), 2, 5 10 150 8
text Artist: $itunesinfo(artist), 3, 5 19 150 8
text Album: $itunesinfo(album), 4, 5 28 150 8
text Genre: $itunesinfo(genre), 5, 5 37 150 8
button "Play", 6, 5 46 37 10
button "Pause", 7, 42 46 37 10
button "Previous", 8, 5 56 74 10
button "Next", 9, 79 56 76 10
button "Rewind", 10, 117 46 38 10
button "Stop", 11, 79 46 38 10
}
dialog -l it_theming {
title "iRCTunes :: Theme Manager v2.1"
size -1 -1 200 106
option dbu
box "Theme Manager v2.1", 1, 1 1 198 104
button * $me is listening to 'TRACK' by ARTIST [LENGTH / SIZE / BITRATE], 2, 5 10 190 12
button * $me iTunes: [TRACK | ARTIST | ALBUM], 3, 5 22 190 12
button * $me iTunes: TRACK - ARTIST, 4, 5 34 190 12
button iRCTunes :: TRACK - ARTIST - ALBUM, 5, 5 58 190 12
button iTunes np: $chr(91) TRACK / ARTIST / ALBUM $chr(93), 6, 5 46 190 12
button iNP: TRACK - ARTIST [iRCTunes], 7, 5 70 190 12
edit $itcurrtheme, 8, 6 82 188 10, autohs
text "iRCTunes :: irctunes.sf.net", 11, 5 95 110 8, disable center
button "Cancel", 12, 155 93 40 10, cancel
button "Save", 13, 115 93 40 10, ok
}
dialog -l it_newver {
title "iRCTunes :: Update Notifier"
size -1 -1 180 68
option dbu
text "The iRCTunes updater found the following update available for download:", 1, 1 1 178 8
text "Current iRCTunes version:", 2, 2 10 65 8
text "Latest iRCTunes version:", 3, 2 19 65 8
text "Latest version information:", 4, 2 28 65 8
text $itversion, 5, 69 10 110 8
text "Loading...", 6, 69 19 110 8
text "Loading...", 7, 69 28 110 30
button "Download Update", 8, 1 37 66 10
button "Remind me later (in 2hrs)", 9, 1 47 66 10
button "Disable checker and close", 10, 1 57 66 10, ok cancel
text "iRCTunes :: irctunes.sf.net", 11, 69 59 110 8, disable center
}
dialog -l it_about {
title "iRCTunes :: About"
size -1 -1 140 88
option dbu
text "Name:", 1, 2 9 20 8
text iRCTunes $itversion for mIRC, 2, 22 9 118 8
text "PetPow @ chat.freenode.net #TheGeekLord", 3, 22 25 118 8
text "Author: Peter Powell <petpow@thegeeklord.net>", 4, 2 17 138 8
text "About iRCTunes for mIRC", 5, 0 0 140 8, center
text "About:", 6, 2 33 20 8
text "iRCTunes is a tool to assist in linking mIRC and iTunes together via COM controls. By providing simple to use controls inside your IRC Client, you can show your current playing track across one or multiple channels. You can also use iRCTunes to share music and control iTunes with an array of commands which are second to none.", 7, 22 33 118 46
text "iRCTunes :: irctunes.sf.net", 8, 0 80 140 8, disable center
}
dialog -l it_popup {
title "iRCTunes :: Popup"
size -1 -1 160 172
option dbu
text "iTunes Controls", 1, 0 0 160 8, center
button "Play", 2, 1 7 79 10
button "Pause", 3, 80 7 79 10
button "Previous", 4, 1 17 79 10
button "Next", 5, 80 17 79 10
button "Rewind", 6, 1 27 79 10
button "Stop", 7, 80 27 79 10
text "iRCTunes Controls", 8, 1 37 160 8, center
button "About iRCTunes", 9, 1 54 79 10
button "Auto Update Checker", 10, 80 144 79 10
button "Auto Connect to iTunes", 11, 1 144 79 10
button "Auto Show Track to Chan", 12, 80 44 79 10
button "Auto Broadcast Track", 13, 1 44 79 10
button "Broadcast Track", 14, 80 54 79 10
button "Check for Updates", 15, 1 64 79 10
button "Send Track Info to Clipboard", 16, 80 64 79 10
button "iRCTunes DCC Server", 17, 1 74 79 10
button "iTunes on Demand", 18, 80 74 79 10
button "iTunes Track Information", 19, 1 84 79 10
button "Restart iRCTunes", 20, 80 84 79 10
button "Send Track via DCC", 21, 1 94 79 10
button "Show Track", 22, 80 94 79 10
button "Advertise iRCTunes", 23, 1 104 79 10
button "Show Track to Chan", 24, 80 104 79 10
button "iRCTunes COM Status", 25, 1 114 79 10
button "iRCTunes Support", 26, 80 114 79 10
button "Show Now Playing Theme", 27, 1 124 79 10
button "iRCTunes Theme Manager", 28, 80 124 79 10
button "iRCTunes Main Help", 29, 1 134 79 10
button "iRCTunes Plugin List", 30, 80 134 79 10
button "Send Track Info to Editbox", 31, 1 154 79 10
button "Open iRCTunes Website", 32, 80 154 79 10
text "iRCTunes :: irctunes.sf.net", 33, 0 164 160 8, disable center
}
on *:dialog:it_popup:sclick:2: itunes play
on *:dialog:it_popup:sclick:3: itunes pause
on *:dialog:it_popup:sclick:4: itunes prev
on *:dialog:it_popup:sclick:5: itunes next
on *:dialog:it_popup:sclick:6: itunes rewind
on *:dialog:it_popup:sclick:7: itunes stop
on *:dialog:it_popup:sclick:9: itunes about
on *:dialog:it_popup:sclick:10: itunes acheckupdate
on *:dialog:it_popup:sclick:11: itunes autoconn
on *:dialog:it_popup:sclick:12: itunes autoshowto $active
on *:dialog:it_popup:sclick:13: itunes autobroadcast
on *:dialog:it_popup:sclick:14: itunes broadcast
on *:dialog:it_popup:sclick:15: itunes checkupdate
on *:dialog:it_popup:sclick:16: itunes clipboard
on *:dialog:it_popup:sclick:17: itunes dcc
on *:dialog:it_popup:sclick:18: itunes demand
on *:dialog:it_popup:sclick:19: itunes info
on *:dialog:it_popup:sclick:20: itunes restart
on *:dialog:it_popup:sclick:21: itunes sendtrack
on *:dialog:it_popup:sclick:22: itunes show
on *:dialog:it_popup:sclick:23: itunes advertise
on *:dialog:it_popup:sclick:24: itunes showto $active
on *:dialog:it_popup:sclick:25: itunes comstatus
on *:dialog:it_popup:sclick:26: itunes support
on *:dialog:it_popup:sclick:27: itunes theme
on *:dialog:it_popup:sclick:28: itunes themes
on *:dialog:it_popup:sclick:29: itunes help
on *:dialog:it_popup:sclick:30: itunes plugins
on *:dialog:it_popup:sclick:31: itunes editbox
on *:dialog:it_popup:sclick:32: itunes website
on *:dialog:it_popup:init:*: .timeripp 0 1 itupdpopup
on *:dialog:it_popup:close:*: .timeripp off
on *:dialog:it_trackinfo:sclick:6: itunes play
on *:dialog:it_trackinfo:sclick:7: itunes pause
on *:dialog:it_trackinfo:sclick:8: itunes prev
on *:dialog:it_trackinfo:sclick:9: itunes next
on *:dialog:it_trackinfo:sclick:10: itunes rewind
on *:dialog:it_trackinfo:sclick:11: itunes stop
on *:dialog:it_newver:sclick:8: { run $readini($itconfig, updater, link) | dialog -x it_newver }
on *:dialog:it_newver:sclick:9: { dialog -x it_newver | .timeriupd 1 7200 itunes checkupdate }
on *:dialog:it_newver:sclick:10: { dialog -x it_newver | itsettings checkupdate false | echo -a iRCTunes has disabled automatic update checking }
on *:dialog:it_newver:init:*: { did -a it_newver 6 $readini($itconfig, updater, version) | did -a it_newver 7 $readini($itconfig, updater, information) }
on *:dialog:it_newver:close:*: { remini $itconfig updater }
on *:dialog:it_theming:sclick:2: did -o it_theming 8 1 $itparsetheme(code2read,[DESCRIBE] is listening to $!chr(2) $!+ ' $!+ ^TRACK^ $!+ ' $!+ $!chr(15) by $!chr(2) $!+ ^ARTIST^ $!+ $!chr(15) [ $!+ $!asctime(^SECLENGTH^,n:ss) $!+ / $!+ ^SIZE^ $!+ mb/ $!+ ^BITRATE^ $!+ kbps])
on *:dialog:it_theming:sclick:3: did -o it_theming 8 1 $itparsetheme(code2read,[DESCRIBE] iTunes: $!chr(91) $!+ ^TRACK^ $!+ $eval(|,0) $!+ ^ARTIST^ $!+ $eval(|,0) $!+ ^ALBUM^ $!+ $!chr(93))
on *:dialog:it_theming:sclick:4: did -o it_theming 8 1 $itparsetheme(code2read,[DESCRIBE] iTunes: ^TRACK^ - ^ARTIST^)
on *:dialog:it_theming:sclick:5: did -o it_theming 8 1 $itparsetheme(code2read,iRCTunes :: ^TRACK^ - ^ARTIST^ - ^ALBUM^)
on *:dialog:it_theming:sclick:6: did -o it_theming 8 1 $itparsetheme(code2read,iTunes np: $!chr(91) $!+ ^TRACK^ $!+ / $!+ ^ARTIST^ $!+ / $!+ ^ALBUM^ $!+ $!chr(93))
on *:dialog:it_theming:sclick:7: did -o it_theming 8 1 $itparsetheme(code2read,iNP: ^TRACK^ - ^ARTIST^ [iRCTunes])
on *:dialog:it_theming:sclick:13: itsettings theme $itparsetheme(read2code,$did(it_theming, 8).text)