All pastes #419809 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-01 17:26 UTC
rendered paste body
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; iRCTunes for mIRC v1.0                          ;
; Author: PeterPowell - petpow@co.nr              ;
; Created: 28/03/07 - 17:14 (recoded for release) ;
; Last Modified: 28/03/07 - 21:21 GMT +1 (BST)    ;
; License: GNU General Public License             ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; On startup setup iRCTunes
on *:START: {
  set %it.version v1.0
  set %it.demand false
  if (%it.theme == $null) { set %it.theme ACTION is listening to $!track from $!artist [L: $!+ $!duration($!length) $!+ / $!+ B: $!+ $!bitrate $!+ kbps] }
  if (%it.autoconn == true) { .comopen itunes iTunes.Application }
  else { set %it.autoconn true }
  echo -a iRCTunes %it.version for mIRC has been loaded :)
}
; On first load open COM to iTunes
on *:LOAD: {
  .comopen itunes iTunes.Application
}
; On unload close COM and unset variables
on *:UNLOAD: {
  .comclose itunes
  echo -a iRCTunes %it.version for mIRC unloaded :(
  unset %it.*
}
; Menu System
menu menubar {
  iRCTunes %it.version
  .Announce Track:/itunes show
  .Echo Track:/itunes echo
  .Play:/itunes play
  .Stop:/itunes stop
  .Pause:/itunes pause
  .Next Track:/itunes next
  .Previous Track:/itunes prev
  .iTunes on Demand:/itunes demand
  .iRCTunes Theme Manager:/itunes themes
  .About iRCTunes:/itunes about
  .Announce iRCTunes:/itunes showabout
  .Restart iRCTunes:/itunes restart
  .Cut Track Info:/itunes clipboard
  .Help and Support
  ..Main Help:/itunes help
  ..Theme Help:/itunes themehelp
  ..External Support
  ...WWW:/run http://irctunes.sourceforge.net/mirc/
  ...Live Support:/itunes support
}
menu channel,query,chat {
  iRCTunes %it.version
  .Announce Track :/itunes show
  .iTunes on Demand:/itunes demand
  .Announce iRCTunes:/itunes showabout
  .Restart iRCTunes:/itunes restart
}
menu nicklist {
  iRCTunes %it.version
  .CTCP iTunes:/ctcp $1 itunes
  .CTCP iRCTunes:/ctcp $1 irctunes
}
alias itunes {
  if ($1 == $null) { 
    echo -a 03Error: you need to enter a command. See "/itunes help" for all of the commands 
  }
  elseif ($1 == help) {
    echo -a ==iRCTunes %it.version for mIRC Help==                        
    echo -a  /itunes show      : Displays playing track
    echo -a  /itunes broadcast : Displays Playing Track in all open channels
    echo -a  /itunes play      : Start playing track
    echo -a  /itunes stop      : Stop playing track
    echo -a  /itunes pause     : Pauses playing track
    echo -a  /itunes next      : Move to next track
    echo -a  /itunes prev      : Move to previous track
    echo -a  /itunes restart   : Restart the iTunes System
    echo -a  /itunes about     : Displays script information
    echo -a  /itunes showabout : Displays script information to current active channel
    echo -a  /itunes help      : Displays this help menu
    echo -a  /itunes demand    : Displays iTunes On Demand info to other users
    echo -a  /itunes themes    : Starts the iRCTunes theme editor.
    echo -a  /itunes themehelp : Shows more help for custom themes
    echo -a  /itunes autoconn  : Toggle on & off auto connecting to iTunes on startup
    echo -a  /itunes clipboard : Sends your current songs information to the clipboard
    echo -a  /itunes support   : Connects you to MoofSpeak IRC for support
    echo -a  ==Commands Coming Soon==
    echo -a  /itunes status    : Display iTunes playing status
    echo -a  /itunes rewind    : Go back to beginning of the current track
    echo -a  /itunes shuffle   : Jumps to a completely random song
    echo -a  /itunes playlist  : Allows you to select a playlist to play.
    echo -a  /itunes volume    : Set iTunes volume
    echo -a  /itunes mute      : Mutes & Unmutes iTunes
    echo -a  Copyright 2007 Michael Brice and Peter Powell of MoofSpeak (Formerly MacSpeak) Scripts.
  }
  elseif ($1 == show) { 
    if (ACTION isin %it.theme) { 
      scid -a %it.theme
    }
    else { 
      say %it.theme
    }
  }
  elseif ($1 == broadcast) { 
    if (ACTION isin %it.theme) { 
      scid -a all $+ %it.theme
    }
    else { 
      allsay %it.theme
    }
  }
  elseif ($1 == echo) { 
    echo -a 04iTunes Now Playing: Track: $track $+ , Artist: $artist $+ , Album: $album
  }
  elseif ($1 == play) { 
    if (!$com(itunes)) {
      .comopen itunes iTunes.Application
    }
    %it.com = $com(itunes,PlayPause,3)
    if (%it.com == 0) {
      echo -a 03Error: Please ensure iTunes is open and connected.
    }
    if ($comerr) { silentrestart | itunes play }
  }
  elseif ($1 == stop) {
    if (!$com(itunes)) {
      .comopen itunes iTunes.Application
    }
    %it.com = $com(itunes,Stop,3)
    if (%it.com == 0) {
      echo -a 03Error: Please ensure iTunes is open and connected.
      if ($comerr) { silentrestart | itunes stop }
    }
  }
  elseif ($1 == pause) {
    if (!$com(itunes)) {
      .comopen itunes iTunes.Application
    }
    %it.com = $com(itunes,PlayPause,3)
    if (%it.com == 0) {
      echo -a 03Error: Please ensure iTunes is open and connected.
      if ($comerr) { silentrestart | itunes pause }
    }
  }
  elseif ($1 == next) {
    if (!$com(itunes)) {
      .comopen itunes iTunes.Application
    }
    %it.com = $com(itunes,NextTrack,3)
    if (%it.com == 0) {
      echo -a 03Error: Please ensure iTunes is open and connected.
      if ($comerr) { silentrestart | itunes next }
    }
  }
  elseif ($1 == prev) {
    if (!$com(itunes)) {
      comopen itunes iTunes.Application
    }
    %it.com = $com(itunes,PreviousTrack,3)
    if (%it.com == 0) {
      echo -a 03Error: Please ensure iTunes is open and connected.
      if ($comerr) { silentrestart | itunes prev }
    }
  }
  elseif ($1 == about) { 
    echo -a iRCTunes %it.version for mIRC by Peter Powell and Michael Brice of MoofSpeak Scripts (http://irctunes.sourceforge.net/ & irc://irc.moofspeak.net #scripts)
  }
  elseif ($1 == showabout) {
    describe $active uses iRCTunes %it.version for mIRC by Peter Powell and Michael Brice of MoofSpeak Scripts (http://irctunes.sourceforge.net/ & irc://irc.moofspeak.net #scripts)
  }
  elseif ($1 == support) {
    set %it.support true
    server -m irc.moofspeak.net 
    echo -a Now Connecting you to the MoofSpeak IRC Network for Live Support
    echo -a An automatic support message will be sent to the help channel on connection
  }
  elseif ($1 == restart) { 
    .timerrs1 1 1 .comclose itunes
    .timerrs2 1 5 .comopen itunes iTunes.Application
    .timerrs3 1 6 echo -a iRCTunes Restarted
  }
  elseif ($1 == demand) { 
    if (%it.demand == false) {
      set %it.demand true
      ame now has iTunes On Demand - type !itunes (or /ctcp $me itunes for my personal information) to see what other iRCTunes users in your channel are listening to. [iRCTunes]
    }
    elseif (%it.demand == true) {
      set %it.demand false
      ame now has disabled iTunes On Demand. [iRCTunes] 
    }
  }
  elseif ($1 == themes) {
    dialog -mdieo ittheming ittheming
  }
  elseif ($1 == themehelp) {
    echo -a ==iRCTunes %it.version for mIRC Theming Help==
    echo -a The variables you can use in themes are:
    echo -a $!bpm $!genre $!length $!rating $!playcount $!bitrate $!album $!artist and $!track
  }
  elseif ($1 == autoconn) { 
    if (%it.autoconn == true) {
      set %it.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 (%it.autoconn == false) {
      set %it.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 == clipboard) {
    clipboard [iRCTunes] Song: $track $+ , Artist $artist $+ , Album: $album
  }
}
; Aliases for getting track information
alias -l track {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Name,3) 
  %it.name = $com(CurrentTrack).result
  return %it.name
}
alias -l artist {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Artist,3) 
  %it.artist = $com(CurrentTrack).result
  return %it.artist
}
alias -l album {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Album,3) 
  %it.album = $com(CurrentTrack).result
  return %it.album
}
alias -l bitrate {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,BitRate,3) 
  %it.bitrate = $com(CurrentTrack).result
  return %it.bitrate
}
alias -l playcount {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,PlayedCount,3)
  %it.playcount = $com(CurrentTrack).result
  return %it.playcount
}
alias -l rating {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Rating,3)
  %it.rating = $com(CurrentTrack).result
  return %it.rating
}
alias -l length {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Duration,3)
  %it.duration = $com(CurrentTrack).result
  return %it.duration
}
alias -l genre {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,Genre,3)
  %it.genre = $com(CurrentTrack).result
  return %it.genre
}
alias -l bpm {
  if (!$com(itunes)) .comopen itunes iTunes.Application
  if ($comerr) silentrestart
  if ($com(CurrentTrack)) .comclose CurrentTrack
  .echo -q $com(itunes,CurrentTrack,3,dispatch* CurrentTrack) 
  .echo -q $com(CurrentTrack,BPM,3)
  %it.bpm = $com(CurrentTrack).result
  return %it.bpm
}
; Misc aliases
alias -l action {
  scid $activecid describe $active $1-
}
alias -l allaction {
  scid $activecid ame $1-
}
alias -l say {
  scid $activecid msg $active $1-
}
alias -l allsay {
  scid $activecid amsg $1-
}
alias -l silentrestart {
  .timer1 1 1 .comclose itunes
  .timer2 1 2 .comopen itunes iTunes.Application
}
; CTCPs
ctcp *:irctunes: {
  notice $nick I use iRCTunes %it.version for mIRC by Peter Powell and Michael Brice of MoofSpeak Scripts (http://irctunes.sourceforge.net/ & irc://irc.moofspeak.net #scripts)
}
ctcp *:itunes: {
  if (%it.demand == true) {
    if (!$com(itunes)) {
      notice $nick [iRCTunes] iTunes is currently disconnected
    }
    else {
      notice $nick [iRCTunes] I am listening to $track by $artist from the album $album
    }
  }
  else {
    notice $nick [iRCTunes] iRCTunes on Demand is currently disabled
  }
}
on *:text:!itunes:#: {
  if (%it.demand == true) {
    if (!$com(itunes)) {
      notice $nick [iRCTunes] iTunes is currently disconnected
    }
    else {
      notice $nick [iRCTunes] I am listening to $track by $artist from the album $album
    }
  }
}
on *:connect: {
  if ($network == MoofSpeak) {
    if (%it.support == true) {
      join #scripts
      timerms 1 3 msg #scripts [AUTO] I require help for iRCTunes for mIRC %it.version
      unset %it.support
    }
  }
}
dialog ittheming {
  title "iRCTunes Theme Manager"
  size -1 -1 220 170
  option pixels
  text "Please Choose your iRCTunes Theme", 1, 0 3 220 40, center
  button "/me is listening to <track> from <artist> [L:<length>/B:<bitrate>kbps]", 2, 5 20 210 25, push
  button "/me iTunes: artist - song", 3, 5 45 210 25, push
  button "iRCTunes :: song - artist - album", 4, 5 70 210 25, push
  button "Custom iRCTunes Theme", 5, 5 100 210 25, push
  button "Cancel", 100, 110 140 105 25, push
}
on *:DIALOG:ittheming:SCLICK:2:{
  set %it.theme ACTION is listening to $!track from $!artist [L: $!+ $!duration($!length) $!+ / $!+ B: $!+ $!bitrate $!+ kbps]
  echo -a iRCTunes Theme #1 applied
  dialog -x ittheming
}
on *:DIALOG:ittheming:SCLICK:3:{
  set %it.theme ACTION iTunes: $!artist - $!track
  echo -a iRCTunes Theme #2 applied
  dialog -x ittheming
}
on *:DIALOG:ittheming:SCLICK:4:{
  set %it.theme iRCTunes :: $!track - $!artist - $!album
  echo -a iRCTunes Theme #3 applied
  dialog -x ittheming
}
on *:DIALOG:ittheming:SCLICK:5:{
  dialog -x ittheming
  set %it.theme $?="Please enter your custom theme for iRCTunes. Please note that if you want an action type ACTION and a list of variables can be found by typing /itunes themehelp"
}
on *:DIALOG:ittheming:SCLICK:100:{
  dialog -x ittheming
}