| View previous topic :: View next topic |
| Author |
Message |
Anonymous Guest
|
Posted: Fri Jan 26, 2007 5:48 pm Post subject: Small eggdrop TCL script for Ices cue file handling |
|
|
I couldn't find any script for it elsewhere so I wrote my own.
I'm not very good at TCL, so there's probably a better way to write this, but it works for me!
Feel free to edit it how you see fit, it should be fairly self-explanatory how to add sections. If not, read the comments
| Code: |
| Code deleted.. use the one at the bottom! |
Obviously, this only displays the time and the percentage, but it's easily modified to display the other entries in the cue file.
Enjoy 
Last edited by Anonymous on Sun Feb 04, 2007 11:56 pm; edited 1 time in total |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Fri Feb 02, 2007 7:41 pm Post subject: |
|
|
I made it better..
| Code: |
| Code Deleted .. use the one at the bottom! |
Last edited by Anonymous on Sun Feb 04, 2007 11:55 pm; edited 1 time in total |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Sun Feb 04, 2007 11:22 pm Post subject: |
|
|
OK.. now I made it the best it can get
| Code: |
# Ices cue file reading script v1.0 by Ellis Percival
# Checks that the cuefile is present, then delivers
# suitable responses to each chatroom request
set cuefile "/tmp/ices.cue"
set percenttrigger ".percent"
set totaltimetrigger ".time"
set bitratetrigger ".bitrate"
set filesizetrigger ".filesize"
set pathtrigger ".path"
set playlistnotrigger ".playlistno"
bind pub - $percenttrigger pub_percentsay
bind msg - $percenttrigger msg_percentsay
bind pub - $totaltimetrigger pub_totaltime
bind msg - $totaltimetrigger msg_totaltime
bind pub - $bitratetrigger pub_bitrate
bind msg - $bitratetrigger msg_bitrate
bind pub - $filesizetrigger pub_filesize
bind msg - $filesizetrigger msg_filesize
bind pub - $pathtrigger pub_path
bind msg - $pathtrigger msg_path
bind pub - $playlistnotrigger pub_playlistno
bind msg - $playlistnotrigger msg_playlistno
proc pub_percentsay { nick uhost hand chan arg } { fileread $chan percent }
proc msg_percentsay { nick uhost hand arg } { fileread $nick percent }
proc pub_totaltime { nick uhost hand chan arg } { fileread $chan time }
proc msg_totaltime { nick uhost hand arg } { fileread $nick time }
proc pub_bitrate { nick uhost hand chan arg } { fileread $chan bitrate }
proc msg_bitrate { nick uhost hand arg } { fileread $nick bitrate }
proc pub_filesize { nick uhost hand chan arg } { fileread $chan filesize }
proc msg_bitrate { nick uhost hand arg } { fileread $chan filesize }
proc pub_path { nick uhost hand chan arg } { fileread $chan path }
proc msg_path { nick uhost hand arg } { fileread $nick path }
proc pub_playlistno { nick uhost hand chan arg } { fileread $chan playlistno }
proc msg_playlistno { nick uhost hand arg } { fileread $nick playlistno }
proc fileread { target request } {
global cuefile
if { [file exists $cuefile] } {
set cf [open $cuefile "r"]
set data [read -nonewline $cf]
set lines [split $data "\n"]
if { $request == "time" } {
set time [lindex $lines 3]
foreach {days hours minutes seconds} [split $time :] break
if { $hours != 1 } { set a "hours" } else { set a "hour" }
if { $minutes != 1 } { set b "minutes" } else { set b "minute" }
if { $seconds != 1 } { set c "seconds" } else { set c "seconds" }
putserv "privmsg $target :The current archive is $hours $a, $minutes $b and $seconds $c long"
} elseif { $request == "percent" } {
set percentfull [lindex $lines 4]
set percent [string range $percentfull 0 3]
putserv "privmsg $target :The current archive is ${percent}% complete"
} elseif { $request == "bitrate" } {
set bitrate [lindex $lines 2]
putserv "privmsg $target :The current archive is at ${bitrate}kbit"
} elseif { $request == "filesize" } {
set filesizebytes [lindex $lines 1]
set filesizembytes [expr $filesizebytes / 1048576]
putserv "privmsg $target :The current archive is ${filesizembytes}MB"
} elseif { $request == "path" } {
set path [lindex $lines 0]
putserv "privmsg $target :The path of the current archive is $path"
} elseif { $request == "playlistno" } {
set playlistno [lindex $lines 5]
putserv "privmsg $target :The current archive is number $playlistno in the playlist"
}
close $cf
} else {
putserv "privmsg $target :Automation is currently turned off"
}
} |
Obviously change the responses and triggers to whatever you'd like them to be.
I hope someone can use this!
Oh, and let me know if you do  |
|
| Back to top |
|
 |
|
|
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 You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group subRebel style by ktauber
|