rendered paste bodyproc no:dupe:backfill {nick uhost handle chan arg} {
if {![channel get $chan "bf"]} {
return 0
}
global nomysql notable nocrap nochan nolength noerror nofilter nolimit noafterpre
set rls [check:string [string map [list "\{" " " "\}" " " "\[\[:cntrl:\]\]" " " "\\" " " "\/" " " "'" " " "*" " "] $arg]]
foreach rls [split $rls] {
set ignore {
cd?
cd??
covers?
covers??
sample?
sample??
disc?
disc??
disk?
disk??
extra?
extra??
dvd?
dvd??
}
foreach ig $ignore {
if {[string match -nocase "*/$ig *" $arg]} {
return
}
}
set nomysql(conn) [mysqlconnect -host $nomysql(hst) -port $nomysql(prt) -user $nomysql(usr) -password $nomysql(pwd) -db $nomysql(db)]
set nochkdupe [mysqlsel $nomysql(conn) "SELECT $notable(id),$notable(tim),$notable(sec),$notable(rls),$notable(grp),$notable(nick),$notable(fil),$notable(meg),$notable(genre),$notable(nuke),$notable(nuke_tim),$notable(nuke_reason),$notable(unnuke),$notable(unnuke_tim),$notable(unnuke_reason) FROM $nomysql(table) WHERE $notable(rls) LIKE '$rls' ORDER BY $notable(tim) DESC LIMIT 1" -flatlist]
set notable_db_id [lindex $nochkdupe 0]
if {$notable_db_id != ""} {
foreach {id tim sec rls grp nick fil meg genre nuke nuke_tim nuke_reason unnuke unnuke_tim unnuke_reason} $nochkdupe {
set nothetime [unixtime]
set tim_ago [no:dupe:ago $nothetime $tim]
set tim_day [no:dupe:day $tim]
set nuke_tim_ago [no:dupe:ago $nothetime $nuke_tim]
set nuke_tim_day [no:dupe:day $nuke_tim]
set unnuke_tim_ago [no:dupe:ago $nothetime $unnuke_tim]
set unnuke_tim_day [no:dupe:day $unnuke_tim]
if {$tim == ""} {} else {
if { $nothetime > [expr $noafterpre + $tim] } {set backfillinfo "\00315\[ \0034BACKFiLL\00315 \]"} else {set backfillinfo "\00315\[\00314 PRETiME\00315:\0039 OK \00315\]"}
if { $fil == "0" } {
if {$nuke == "1"} {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago \00315\[ \00304NUKE \00315\]\[ \00314REASON :\00304 $nuke_reason \00315\]"
} elseif {$unnuke == "1"} {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago \00315\[ \00309UNNUKE \00315\]\[ \00314REASON :\00309 $unnuke_reason \00315\]"
} else {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago"
}
} else {
set ffil ""; append ffil $fil "FiLES"
set mmeg ""; append mmeg $meg "MB"
if {$nuke == "1"} {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago \00315\[ \00304NUKE \00315\]\[ \00314REASON :\00304 $nuke_reason \00315\]"
} elseif {$unnuke == "1"} {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago \00315\[ \00309UNNUKE \00315\]\[ \00314REASON :\00309 $unnuke_reason \00315\]"
} else {
putquick "PRIVMSG $chan :\0034 $backfillinfo \00315 $rls \00315\[\00314 $sec \00315\] released\0039 $tim_ago"
}
}
}
}
mysqlclose $nomysql(conn)
break
}
mysqlclose $nomysql(conn)
}
}