All pastes #992401 Raw Edit

Unbenannt

public text v1 · immutable
#992401 ·published 2008-04-21 20:20 UTC
rendered paste body
proc nfo:announce {type rls filename unxtim} {
	global nfo ttl apache NFOs
	
	if {$type == "sitenfo"} {
		set randomurl [randomRangeString 25]
		
		if {![file exists index.html]} {
			set fp [open index.html a+]
			puts $fp "<html><body><h1>What are you looking for?</h1></body></html>"
			close $fp
		}
		
		file mkdir $apache(web)/$randomurl
		if {![file exists $apache(web)/index.html]} {
			file copy index.html $apache(web)
		}
			
		set year [clock format $unxtim -format "%Y"]
		set month [clock format $unxtim -format "%m"]
		set day [clock format $unxtim -format "%d"]
			
		file copy index.html $apache(web)/$randomurl/index.html
		file copy $NFOs/$year/$month/$day/$rls/$filename $apache(web)/$randomurl/$filename
			
		timer $apache(ttl) "file delete $apache(web)/$randomurl/$filename"
		timer $apache(ttl) "file delete $apache(web)/$randomurl/index.html"
		
		timer $apache(ttl) "file delete -force -- $apache(web)/$randomurl"
 		foreach i [split $nfo(.nfo)] { if {[channel get $i nfosource]} {putquick "PRIVMSG $i :!addnfo $rls http://$apache(host)/nfos/$randomurl/$filename $filename"}
 		}
       	} elseif {$type == "sitem3u"} {
		set randomurl [randomRangeString 25]
		
		if {![file exists index.html]} {
			set fp [open index.html a+]
			puts $fp "<html><body><h1>What are you looking for?</h1></body></html>"
			close $fp
		}
		
		file mkdir $apache(web)/$randomurl
		if {![file exists $apache(web)/index.html]} {
			file copy index.html $apache(web)
		}
			
		set year [clock format $unxtim -format "%Y"]
		set month [clock format $unxtim -format "%m"]
		set day [clock format $unxtim -format "%d"]
			
		file copy index.html $apache(web)/$randomurl/index.html
		file copy $NFOs/$year/$month/$day/$rls/$filename $apache(web)/$randomurl/$filename
			
		timer $apache(ttl) "file delete $apache(web)/$randomurl/$filename"
		timer $apache(ttl) "file delete $apache(web)/$randomurl/index.html"
		
		timer $apache(ttl) "file delete -force -- $apache(web)/$randomurl"
	       foreach i [split $nfo(.m3u)] { if {[channel get $i m3usource]} { putquick "PRIVMSG $i :!addm3u $rls http://$apache(host)/nfos/$randomurl/$filename $filename" }
			}
		}
	}