Code: Select all
proc wordwrap {str {len 200} {prefix {}} {splitChr { }}} {
set out {}
set cur $prefix
set i 0
foreach word [split [set str][unset str] $splitChr] {
if {[incr i [string len $word]]>$len} {
lappend out [join $cur $splitChr]
#set out [string map {" : " " :"} $out]
# my hack - rosc
regsub { : } $out { :} out
if {[regexp {^.*(\003\d\d)} $cur -> lastColor]} {
set cur [join [list $prefix $lastColor $word] ""]
} else {
set cur [join [list $prefix $word] ""]
}
set i [string len $word]
} else {
lappend cur $word
}
incr i
}
lappend out [join $cur $splitChr]
# my hack - rosc
regsub { : } $out { :} out
return $out
}
Code: Select all
# this takes the wrapped output $out and stuffs prefixes into it.
# This would be used after the very last 'lappend out [join $cur $splitChr]'
# in the word-wrapper.
# this adds prefix to each line and (con't) at the end of split lines except
# the very last
set j 0
foreach line2 $out {
# modified to suit tvrage.tcl
# put the prefix at the beginning of each line
set line2 [linsert $line2 0 $prefix]
if {$j >= 1} {
# this puts (con't) at the end of a split line
set line2 [linsert $line2 end (con't)]
# but not the very last split line, where it's not needed.
set j [expr $j - 1]
}
lappend out $line2
}
return $out
#end---------------
# It's also possible to format the split lines to have prefix, title, con't, etc:
set j 0;set count 0
foreach line2 $out {
set line2 [linsert $line2 0 $prefix]
if {$count == 0} {
# gives the 1st line a title string at the beginning,
# $text was the original query name (this is from the dream.tcl script I made)
set line2 [linsert $line2 0 \002[string totitle $text]\002:]
incr count
if {$j >= 1} {
# puts (con't) at the end of the line
set line2 [linsert $line2 end \002(con't)\002]
set j [expr $j - 1]
}
} else {
# puts "title (con't)" at the beginning of the next line, so you
# can put like, "Entry continued from last line"
set line2 [linsert $line2 0 \002([string totitle $text] con't)\002]
if {$j >= 1} {
# puts (con't) at end of line, except the very last
set line2 [linsert $line2 end \002(con't)\002]
set j [expr $j - 1]
}
}
}
lappend out $line2
}
Code: Select all
Currently: can't read "days(sun uk)": no such element in array
Currently: while executing
Currently: "expr (7 - $today) + $days([string tolower $text])"
Currently: ("sun" arm line 3)
Currently: invoked from within
Currently: "switch $arg {
Currently: today { set w 0 }
Currently: tomorrow { set w 1 }
Currently: yesterday { set w -1 }
Currently: mon -
Currently: tue -
Currently: wed -
Currently: thu -
Currently: fri -
Currently: ..."
Currently: (procedure "::tvrage::primetime" line 22)
Currently: invoked from within
Currently: "::tvrage::primetime $_pub1 $_pub2 $_pub3 $_pub4 $_pub5"
Code: Select all
In proc getEpisodeInfo
if {[catch {set token [http::geturl $show(episode_url) -timeout [expr $tvrage(httpTimeout) * 1000]]} error]} {
debug ERROR "TVRage: ERROR: $error"
set show(found) 0
return
}
Code: Select all
Original:
printSchedule $show(country) [expr (7 - $currDay) + $days([string tolower $text])] $chan $nick
Fix:
printSchedule $show(country) [expr (7 - $currDay) + $days([string tolower $desiredDay])] $chan $nick
Code: Select all
if {[string is integer $desiredDay ]} {
if {$desiredDay <= 6 && $desiredDay >= [expr (-1 * $tvrage(cacheForDays))]} {
printSchedule $show(country) $desiredDay $chan $nick
# my hack
} else {
puthelp "PRIVMSG $nick :No schedule is cached for $desiredDay days."
#displayInfo [templateParser $tvrage(notCached) "$desiredDay days"]
return
}
Code: Select all
# Changed to allow both pub and msg binds -Rosc
if {$tvrage(pubTriggers) == 1} {
set tvrage(triggerType) "pub"
} elseif {$tvrage(pubTriggers) == 2} {
set tvrage(triggerType) "msg"
} else {
set tvrage(triggerType) "pub msg"
}
# added this foreach to enable both pub and msg binds.. Added msg procs as well, as setting
# set tvrage(pubTriggers) did not work with the triggers set to msg type. -Rosc
foreach triggerType2 $tvrage(triggerType) {
if {$tvrage(enableSchedule)} {
foreach trigger [split $tvrage(todayTrigger) " "] {
bind $triggerType2 $tvrage(todayFlags) $trigger [namespace current]::today:$triggerType2
}
# repeat for each bind
};# end of foreach triggerType
Code: Select all
New msg proc:
proc availableCountries:msg {nick uhost hand text} {
if {![onchan $nick]} {return}
availableCountries:pub $nick $uhost $hand privmsg $text
return
}
Modified pub proc:
proc availableCountries:pub {nick uhost hand chan text} {
variable tvrage
if {$chan == "privmsg"} {
set chan $nick
} elseif {[channel get $chan tvquiet]} {
set chan $nick
} elseif {![channel get $chan tv]} {
return
}