This NP script will read the currentSong.txt file that Grooveshark Desktop generates, and output to an IRC channel.
USAGE:
.np (Returns the active playing song from Grooveshark)
.np(off/on) (Sets a timer to automatically scan for changes to the song and messages the channel if the song changes)
HOW TO:
To modify the output, modify this line of code in your file:
msg $chan [Grooveshark] %np.artist with %np.song from %np.album
Where %np.artist is the artist, %np.song is the song name and %np.album is the album name.
DEPENDENCIES:
If you need support, please see Ae6 or Konata @ ##mirc on freenode.
;----------------------------------------------------------------------------------------------------;
;- AimeeGSNP.mrc - Aimee's Grooveshark Nowplaying script
;- This script will parse a Grooveshark currentsong.txt file, and post the results in the channel.
;- script will post each song only once, and allows for automatic posting of new songs.
;-
;- made in ##mirc on irc.freenode.net by AeSix for Aimee - modifications welcome!
;-
;- REMEMBER TO EDIT THE DIRECTORY PATH TO THE LOCATION OF currentSong.txt !!!!!!
;----------------------------------------------------------------------------------------------------;
on 1:TEXT:.np*:#:{
if ( $1 == .np ) {
.nowplaying
}
if ( $1 == .npon ) {
.nowplaying
.timernowplaying1 0 10 .nowplaying
}
if ( $1 == .npoff ) {
.timernowplaying1 off
}
}
alias nowplaying {
;- change C:\path\to\currentSong.txt to your path - can this be fixed to be universal?
var %x = $qt(C:\path\to\currentSong.txt)
if ( $token($read(%x,1),1,9) $+ . $+ $token($read(%x,1),3,9) != %np.song $+ . $+ %np.artist ) {
set %np.artist $token($read(%x,1),3,9)
set %np.song $token($read(%x,1),1,9)
set %np.album $token($read(%x,1),2,9)
msg $chan [Grooveshark] %np.artist with %np.song from %np.album
}
elseif ( $token($read(%x,1),1,9) $+ . $+ $token($read(%x,1),3,9) == %np.song $+ . $+ %np.artist ) {
halt
}
}
;- change C:\path\to\currentSong.txt to your path - can this be fixed to be universal?
use $scriptdir
u can use tokenize 9 $read(%x,1)
the elseif is useless u can use only else halt or remove it
so i think your code can be like this
on *:TEXT:*:#:{
if ($strip($1) == .np) .nowplaying
elseif $istok(.npon|.npoff,$strip($1),124) {
.timernowplaying1 $iif($strip($1) == .npon,0 10 .nowplaying,off)
if ($strip($1) == .npon) .nowplaying
}
}
alias nowplaying {
tokenize 9 $read($qt($scriptdircurrentSong.txt),1)
if $1 $3 != %np.song %np.artist {
set %np.artist $3
set %np.song $1
set %np.album $2
msg # [Grooveshark] %np.artist with %np.song from %np.album
}
}