Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ON !*:TEXT:!*:#: {
- tokenize 32 $strip($1-)
- if ($1 == !song) { itunes }
- if ($1 == !rate) {
- if (!$2) { .msg $chan [ $+ $nick $+ ]: Error, Not enough parameters, try again and enter the number! | return }
- if ($2 !isnum) { .msg $chan [ $+ $nick $+ ]: Error, Incorrect parameters, try again and enter only numbers! | return }
- if ($2 > 5) { .msg $chan [ $+ $nick $+ ]: Error, Too high, try again and use an smaller number 1-5 only permitted! | return }
- setrating_command $chan $nick $2
- }
- }
- alias setrating_command {
- if (!$1-) { return }
- var %p = iTunes, %i = IITTrack
- .comopen iTunes iTunes.Application
- if ($comerr) { .timeriTunes off | goto error }
- if $com(%p,CurrentTrack,3,dispatch* %i) {
- if (!$com(%i)) {
- .msg $1 [ $+ $2 $+ ]: Error, NOT any track is currently has been selected.
- goto error
- }
- var -s %info = $com(%i,Rating,4,long).result
- var -s %k = $com(%i,Rating,4,long,$calc($3 *20))
- var -s %k = $com(%i,Name,2)
- var -s %n = $com(%i).result
- .msg $1 [ $+ $2 $+ ]: Song ratings for $qt(%n) has been changed to $qt($3) $+ .
- }
- :error
- while ($com(0)) { .comclose $com(1) }
- }
- alias get_rate {
- .comopen Rating iTunes.Application
- if ($comerr) { goto error }
- if ($com(Rating,CurrentTrack,3,dispatch* Track)) {
- if (!$com(Track)) { goto error }
- var -s %k = $com(Track,Rating,2)
- var -s %n = $com(Track).result
- }
- :error
- while ($com(0)) { .comclose $com(1) }
- }
- ;; checkForItunes - Should return $true if you want to use the
- ;; -- chkprog alias to see if iTunes is running before each
- ;; -- command. Slows the program down slightly, but the script
- ;; -- will not run iTunes if it is not open. If $false, the
- ;; -- script will run slightly faster and it will assume the
- ;; -- user knows whether or not iTunes is open, and due to
- ;; -- the COM interface, will run iTunes if it is not open.
- ;alias -l checkForITunes { return $false }
- ;; useTimer - Should return $true if you want the iTunes script
- ;; -- to run periodically, i.e. every 480 seconds. If $false,
- ;; -- no timers will be run.
- ;alias -l useTimer { return $false }
- ;; doNotMessageChans -- This should be a space delimited list of
- ;; -- channels you do not want the script to message. By default
- ;; -- the script will message your active channel, so if one of
- ;; -- these channels is your active channel, it will do nothing
- ;; -- Syntax: #chan1 #chan2 #chan3 #chanN
- alias -l doNotMessageChans { return #irchelp #rsmarket }
- ;; period -- Edit the number to the number of seconds you want
- ;; -- as a delay between automatic messages.
- ;alias -l period { return 480 }
- alias itunes {
- _iTunes
- }
- alias itunesoff {
- .timeriTune* off
- echo -at $+ ** $+ iTunes timer stopped.
- }
- alias _itunes {
- scid $activecid
- var %p = iTunes, %i = Track, %b = $chr(2), %% = $+(%b,,-,$chr(3),%b)
- .comopen iTunes iTunes.Application
- if ($comerr) { .timeriTunes off | goto error }
- if $com(%p,CurrentTrack,3,dispatch* %i) {
- if (!$com(%i)) { echo -at $+ ** $+ No track is currently playing. | goto error }
- var %k = $com(%i,Name,2)
- var %name = $com(%i).result
- var %k = $com(%i,Album,2)
- var %album = $com(%i).result
- var %k = $com(%i,Artist,2)
- var %artist = $com(%i).result
- var -s %k = $com(%i,Rating,2)
- var -s %n = $com(%i).result
- var -s %rating = $+($str(*,$calc(%n /20)),%b,$str(-,$calc(5 - (%n /20))),%b)
- var %position = $regsubex($asctime($com(%p).result,n:ss),/(\d+):(\d+)/,$+(\1,,:,,\2))
- var %pr = $calc($com(%p).result / $com(%i).result)
- var %k = $com(%p,PlayerState,2)
- var %st = $com(%p).result
- var %k = $com(%i,PlayedCount,2)
- var %played = $com(%i).result
- var %msg = %name $iif(!%st,(Paused))
- $iif(%artist,%% %artist)
- $iif(%album,%% Album %album)
- %% Played %played $+ $chr(15) times
- %% Rating %rating
- $iif($active ischan && !$istok($doNotMessageChans,$active,32),msg $active,noop) $iif(c !isincs $chan($active).mode,%msg,$strip(%msg,c)))
- }
- :error
- while ($com(0)) { .comclose $com(1) }
- }
- alias setrating {
- if (!$1) {
- echo -at $c1 $+ ** $it $c2 $+ Please specify a rating to give this song, between 0 and 5 inclusive.
- return
- }
- var %p = iTunes, %i = IITTrack
- .comopen iTunes iTunes.Application
- if ($comerr) { .timeriTunes off | goto error }
- if $com(%p,CurrentTrack,3,dispatch* %i) {
- if (!$com(%i)) {
- echo -at $c1 $+ ** $it $c2 $+ No track is currently selected.
- .timeriTunes off
- goto error
- }
- 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) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement