|
|
|
It is currently Fri Sep 03, 2010 8:11 am
|
View unanswered posts | View active topics
iTunes Integration into mIRC [Now Playing +more]
| Author |
Message |
|
Kvn
|
Post subject: iTunes Integration into mIRC [Now Playing +more] Posted: Sun Aug 12, 2007 4:23 am |
|
 |
| User |
 |
Joined: Fri Mar 02, 2007 2:34 am Posts: 60 Location: #rseos
|
» » iTunes « «
This is a simple iTunes script, no dialog just some aliases. I was nagged to death about releasing this by certain parties who will remain unnamed. After I wrote this one, I looked on the forum to see if there is any competetion and only found one other iTunes script. (I didn't feel like releasing mine because I thought there was already several here). Ignore the timestamps, I didn't feel like editing them to make it more realistic, yes I know they're all exactly the same. Note: Some parts of these scripts are CPU intensive, so I advise you don't spam them
Anyway, the script:
/iTunes:
If iTunes is not open, you will be prompted [yes/no] to run it. If you chose to run iTunes, let iTunes finish opening, select the music you want to play, and type /iTunes again
The alias triggers a timer that will message the active channel what you are listening to every 480 seconds (easily edited to something else). The colors on all the scripts are easily customizable by editing the color aliases [c1,c2,c3,c4]. I would avoid using white or black as colors, considering many people have white/black as their background and whatever is that color will not show up for them. I've color coded all the examples so you can see what the script output looks like. Color 1 is orange[07], color 2 is dark gray[14], color 3 is red[04], and color 4 is light blue[12].
Quote: |9:57:17pm| <@Kvn> [iTunes] —› Track: Hide » Artist: Creed [2001] » Album: Weathered » Position: 1:20/4:27 [30%] [¦¦¦¦¦¦¦¦¦¦¦¦] » Rating: ¤¤¤¤- » Bitrate: 128kbps » Genre: Rock » PlayedCount: 31 /pause and /resume: Use these two aliases to pause and resume the current song respectively. Quote: |9:57:17pm|** [iTunes] —› Music Paused.
|9:57:17pm|** [iTunes] —› Music Resumed. /setrating: Use this alias to change the Rating of the currently playing song, goes from 0 to 5 (stars). It's the same setting as on your iPod or in the iTunes Media Library. Change it here and it will change there. The default rating for all songs is 0. Quote: |9:57:17pm|** [iTunes] —› Rating for Animals changed to 5. /back and /next: Use these two aliases to go backward and forwards through your songs. Avoid spamming them, though. If you want to find a specific song you're better off restoring iTunes and looking yourself. Quote: |9:57:17pm|** [iTunes] —› Advanced to previous track: Oceans.
|9:57:17pm|** [iTunes] —› Advanced to next track: Weathered.
/_iTunes:
Notice the underscore. You can use this to show what song you are listening to NOW instead of waiting for the timer to set off.
----------------------------------------
Places to edit:
There are always places to edit in scripts, for colors or whatnot.
In the first four lines, you can find your color aliases. Tweak the numbers in the aliases to change the colors of the script.
In the "L" (one L) alias, you can change the seperator which is by default a double arrow (»). Just swap it out in the alias for something else if you wish.
Look for "var %p = iTunes, %i = IITTrack" in the _iTunes alias (underscored one) and right below that is the %chans var. Change the contents of that var to whatever chans you don't want the script to message. Syntax is %chans = #chan1 #chan2 ... #chanN.
In the iTunes alias, you can change "480" to any other number value you want, but I advise it stay above 180 [3 minutes] because it can get spammy. The value is in seconds not minutes.
If you don't like an hourglass popping up as your mouse pointer whenever the alias runs, you can remove or "nerf" the chkprg alias. This can be done by completely removing all references to the alias in the script (not recommended if you aren't an advanced scripter and are not particularly familiar with my coding - note: I don't want anyone to post a modified script which has the chkprg alias removed, it's unnecessary).
To "nerf" the alias, you can make it so that the chkprg alias will always return true - so the effect will be removed. Simple enough? Just replace the current chkprg alias with that one. If you can't do that then you shouldn't have been able to copy/paste this script into the Script Editor either.
Code: alias chkprg return 1 ----------------------------------------Other Stoof: Just a couple notes for you, if you have other color aliases in the same file there will be a conflict, so put this script in a seperate file. I know James likes to do color aliases a lot so there's potential problems. The chkprg alias was made for my by Champagne, I don't know much VB but basically that alias writes all the currently running processes (task manager -> processes) into a text file. I made it so it checks if $1 (iTunes.exe in this case) is in the file and thereby running. I just found it annoying for iTunes to run when you didn't want it do (maybe you closed iTunes but forgot to end the timer). With that alias that won't happen(unless you disabled that with the snippet above). Thanks Champagne. He said he released it but I don't see it in this forum anywhere so :s ----------------------------------------The Source: You can download the script at: http://rseos.com/EchoScript/iTunes.mrc or copy and paste it from below. If you download it, move it to your mIRC directory [$mircdir] and do /load -rs iTunes.mrc. Otherwise, just copy and paste the code into your scripts editor and hit "OK". Code: ;;----------------------------------------------------------;; ;; iTunes script by Kvn Pfc :: http://rseos.com/EchoScript/ ;; ;;----------------------------------------------------------;; alias -l c1 { return $+($chr(3),07) } alias -l c2 { return $+($chr(3),14) } alias -l c3 { return $+($chr(3),04) } alias -l c4 { return $+($chr(3),12) } alias -l l { return $+($chr(2),$c3,»,$chr(3),$chr(2)) } alias -l ll { return $+($c2,$1-,$c3,:,$c1) } alias -l it { return $+($c2,[,$c4,iTunes,$c2,],$chr(2),$c3 —›,$chr(2)) } alias -l lll { return $+($c2,[,$c1,$1-,$c2,]) } alias itunes { _iTunes | .timeriTunes 0 480 noop $!_itunes } alias itunesoff { .timeriTune* off }
alias _itunes { if (!$chkprg(iTunes.exe)) { if (!$isid) { var %x = $?!="Would you like to run iTunes?" if (%x) { run iTunes.exe | echo -at $c1 $+ ** $it $+($c2,Now running,$chr(32),$c1,iTunes.exe,$c2,. Type /itunes again when iTunes finishes opening and you have started playing music.) } else { echo -at $c1 $+ ** $it $+ $c2 No action taken. } } .timeriTune* off return } scid $activecid var %p = iTunes, %i = IITTrack, %b = $chr(2), %% = $+(%b,$c3,»,$chr(3),%b), $& %chans = #pc #idle #irchelp #rsmarket .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%i,Name,2), %name = $com(%i).result, $& %k = $com(%i,Album,2), %album = $com(%i).result, $& %k = $com(%i,Artist,2), %artist = $com(%i).result, $& %k = $com(%i,BitRate,2), %bitrate $com(%i).result, $& %k = $com(%i,Time,2), %time = $regsubex($com(%i).result,/(\d+):(\d+)/,$+(\1,$c2,:,$c1,\2)), $& %k = $com(%i,Rating,2), %n = $com(%i).result, $& %rating = $+($str(¤,$calc(%n /20)),%b,$str(-,$calc(5 - (%n /20))),%b), $& %k = $com(%i,Year,2), %year = $com(%i).result var %k = $com(%i,Duration,2), %k = $com(%p,PlayerPosition,2), $& %position = $regsubex($asctime($com(%p).result,n:ss),/(\d+):(\d+)/,$+(\1,$c2,:,$c1,\2)), $& %pr = $calc($com(%p).result / $com(%i).result), $& %progress = $+(%b,$chr(3),4,$str(¦,$floor($calc(%pr *10))),$chr(3),1¦,$chr(3),3,$str(¦,$calc(10- $round($calc(%pr *10),0))),%b,$c2), $& %k = $com(%p,PlayerState,2), %st = $com(%p).result, $& %k = $com(%i,Genre,2), %genre = $com(%i).result, $& %k = $com(%i,PlayedCount,2), %played = $com(%i).result var %msg = $it $ll(Track) %name $iif(!%st,$lll(Paused)) $& %% $ll(Artist) %artist $iif(%year,$lll(%year)) $& %% $ll(Album) %album $& %% $ll(Position) $+(%position,$c2,/,$c1,%time) $& $lll($calc($round(%pr,2) *100) $+ %) $+([,%progress,]) $& %% $ll(Rating) %rating $& %% $ll(Bitrate) $+(%bitrate,$c2,kbps) $& %% $ll(Genre) %genre $& %% $ll(PlayedCount) %played $+ $chr(15) $iif($active ischan && !$istok(%chans,$active,32),msg $active,noop) $iif(c !isincs $chan($active).mode,%msg,$strip(%msg,c))) } :error while ($com(0)) { .comclose $com(1) } }
alias pause { if (!$chkprg(iTunes.exe)) { return } .comopen iTunes iTunes.Application noop $com(iTunes,Pause,3) echo -at $c1 $+ ** $it $c2 $+ Music Paused. .comclose iTunes }
alias resume { if (!$chkprg(iTunes.exe)) { return } .comopen iTunes iTunes.Application noop $com(iTunes,Play,3) echo -at $c1 $+ ** $it $c2 $+ Music Resumed. .comclose iTunes }
alias setrating { if (!$1) { return } var %p = iTunes, %i = IITTrack .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%i,Rating,4,long,$calc($1 *20)), $& %k = $com(%i,Name,2), %n = $com(%i).result echo -at $c1 $+ ** $it $+($c2,Rating for:,$c1,$chr(32),%n,$chr(32),$c2,changed to,$c1,$chr(32),$1,$c2,.) } :error while ($com(0)) { .comclose $com(1) } }
alias next { if (!$chkprg(iTunes.exe)) { return } var %p = iTunes, %i = IITTrack .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%p,NextTrack,3) .timer 1 .5 _next } while ($com(0)) { .comclose $com(1) } }
alias back { if (!$chkprg(iTunes.exe)) { return } var %p = iTunes, %i = IITTrack .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%p,PreviousTrack,3) .timer 1 .5 _back } while ($com(0)) { .comclose $com(1) } }
alias -l _back { var %p = iTunes, %i = IITTrack .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%i,Name,2) echo -at $c1 $+ ** $it $+($c2,Advanced to previous track:,$c1) $com(%i).result } while ($com(0)) { .comclose $com(1) } }
alias -l _next { var %p = iTunes, %i = IITTrack .comopen iTunes iTunes.Application if ($comerr) { .timeriTunes off | return } if $com(%p,CurrentTrack,3,dispatch* %i) { var %k = $com(%i,Name,2) echo -at $c1 $+ ** $it $+($c2,Advanced to next track:,$c1) $com(%i).result } while ($com(0)) { .comclose $com(1) } }
alias chkprg { .fopen -o processes processes.txt .fclose processes var %% = aline @@, %x = processes.txt window -h @@ %% Dim z, x, t %% Set z = CreateObject("Scripting.FileSystemObject") %% Set x = z.OpenTextFile(" $+ $mircdir $+ %x $+ ", 2, 1) %% t = "." %% For Each obj In GetObject("winmgmts://" & t & "/root/cimv2").ExecQuery("SELECT * FROM Win32_Process") %% x.Write(obj.Description & vbCrLf) %% Next savebuf @@ pro.vbs window -c @@ .comopen q wscript.shell .comclose q $com(q,run,3,bstr,wscript " $+ $mircdir $+ pro.vbs",uint,5,bool,true) return $read(processes.txt,r,$1) }
_________________
Get your own EoS Sig at: http://rseos.com/?page=sigs
EoS Retired and Maker/Host of EchoScript
Last edited by Kvn on Tue Apr 15, 2008 4:01 am, edited 2 times in total.
|
|
|
|
 |
|
Zeus
|
Post subject: Posted: Sun Aug 12, 2007 4:36 am |
|
 |
| User |
 |
Joined: Mon Jul 31, 2006 3:52 am Posts: 232 Location: California
|
Looks pretty cool
Now add it to a dialog
/me prods Kvn's face
_________________
|
|
|
|
 |
|
acethebunny
|
Post subject: Posted: Sun Aug 12, 2007 6:22 am |
|
 |
| User |
 |
Joined: Tue Dec 26, 2006 1:35 pm Posts: 279 Location: Rand, WV
|
|
|
|
 |
|
Champagne
|
Post subject: Posted: Sun Aug 12, 2007 7:33 am |
|
| User |
 |
Joined: Tue Jul 10, 2007 8:44 pm Posts: 163
|
Nice Job Kvn. 
|
|
|
|
 |
|
James^
|
Post subject: Posted: Sun Aug 12, 2007 10:58 am |
|
 |
| User |
 |
Joined: Sat Oct 21, 2006 7:33 am Posts: 1654 Location: Lake Forest, California
|
|
It sure is more complex than mine lol. Good job
_________________
|
|
|
|
 |
|
Ward
|
Post subject: Posted: Sun Aug 12, 2007 11:59 am |
|
| mIRC Guru |
 |
Joined: Sat Jul 21, 2007 10:57 pm Posts: 626 Location: Brussels, Belgium
|
acethebunny wrote: omfg. it worked. i actaully got him to give it up.  /me dances around and opens iTunes
You're a monster 
|
|
|
|
 |
|
Roly
|
Post subject: Posted: Sun Aug 12, 2007 7:53 pm |
|
| User |
 |
Joined: Mon Dec 18, 2006 2:58 pm Posts: 186 Location: #Roly
|
niceyyyyyy
now do it for the Zune player
pretty please 
|
|
|
|
 |
|
Kvn
|
Post subject: Posted: Sun Aug 12, 2007 8:38 pm |
|
 |
| User |
 |
Joined: Fri Mar 02, 2007 2:34 am Posts: 60 Location: #rseos
|
|
wanna know how i remember the zune?
"The Zune, as in, 'Hey! My Zune isn't as cool as your iPod'"
And no i'm not making a dialog
Ty for all the feedback though
_________________
Get your own EoS Sig at: http://rseos.com/?page=sigs
EoS Retired and Maker/Host of EchoScript
|
|
|
|
 |
|
Kirbster
|
Post subject: Posted: Sun Aug 12, 2007 9:58 pm |
|
| User |
 |
Joined: Sat Apr 07, 2007 4:21 am Posts: 184
|
Yay, finally something that doesn't involve finding the file and putting it into a dialog. <3 this script  ! Good job.
Is there anyway to listen to the music on your iPod when it's plugged in?
_________________
^ Thanks Shobufire/Sasori ! ^
|
|
|
|
 |
|
Novalok
|
Post subject: Posted: Mon Aug 13, 2007 4:37 pm |
|
 |
| User |
 |
Joined: Fri Aug 04, 2006 12:40 pm Posts: 658 Location: 127.0.0.1
|
*Kiddo uses it
Verry verry nice script 
_________________ rofl een stoffige pantoffel ®© 2005
|
|
|
|
 |
|
Kvn
|
Post subject: Posted: Mon Aug 13, 2007 8:09 pm |
|
 |
| User |
 |
Joined: Fri Mar 02, 2007 2:34 am Posts: 60 Location: #rseos
|
Kirbster wrote: Yay, finally something that doesn't involve finding the file and putting it into a dialog. <3 this script  ! Good job. Is there anyway to listen to the music on your iPod when it's plugged in?
Yes, open up iTunes and on the left hand side your iPod will show up. If you have any playlists on it those will show up below it. Click a playlist and hit play.
If you don't have any playlists, you can click on your iPod and select music to play in there
_________________
Get your own EoS Sig at: http://rseos.com/?page=sigs
EoS Retired and Maker/Host of EchoScript
|
|
|
|
 |
|
Kirbster
|
Post subject: Posted: Tue Aug 14, 2007 6:29 am |
|
| User |
 |
Joined: Sat Apr 07, 2007 4:21 am Posts: 184
|
Kvn wrote: Kirbster wrote: Yay, finally something that doesn't involve finding the file and putting it into a dialog. <3 this script  ! Good job. Is there anyway to listen to the music on your iPod when it's plugged in? Yes, open up iTunes and on the left hand side your iPod will show up. If you have any playlists on it those will show up below it. Click a playlist and hit play. If you don't have any playlists, you can click on your iPod and select music to play in there
I mean through COM... *cough*
_________________
^ Thanks Shobufire/Sasori ! ^
|
|
|
|
 |
|
`Jt
|
Post subject: Posted: Tue Aug 14, 2007 3:10 pm |
|
 |
| User |
 |
Joined: Fri Mar 09, 2007 2:29 am Posts: 2217
|
|
|
|
 |
|
Kvn
|
Post subject: Posted: Thu Aug 16, 2007 5:17 am |
|
 |
| User |
 |
Joined: Fri Mar 02, 2007 2:34 am Posts: 60 Location: #rseos
|
Kirbster wrote: Kvn wrote: Kirbster wrote: Yay, finally something that doesn't involve finding the file and putting it into a dialog. <3 this script  ! Good job. Is there anyway to listen to the music on your iPod when it's plugged in? Yes, open up iTunes and on the left hand side your iPod will show up. If you have any playlists on it those will show up below it. Click a playlist and hit play. If you don't have any playlists, you can click on your iPod and select music to play in there I mean through COM... *cough*
I'm sure there is but I won't be going through the trouble any time soon
_________________
Get your own EoS Sig at: http://rseos.com/?page=sigs
EoS Retired and Maker/Host of EchoScript
|
|
|
|
 |
|
Ryan71002
|
Post subject: /amsg Posted: Fri Aug 17, 2007 3:55 am |
|
| Newbie |
 |
Joined: Thu Jun 14, 2007 9:45 pm Posts: 14 Location: Bourbonnais, Illinois
|
|
is there anyway to /amsg what your playing?
_________________
|
|
|
|
 |
Users browsing this forum: No registered users and 0 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum
|
|
|