<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/19566" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2013-12-10T21:46:54-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/19566</id>

		<entry>
		<author><name><![CDATA[geeker]]></name></author>
		<updated>2013-12-10T21:46:54-04:00</updated>

		<published>2013-12-10T21:46:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=102295#p102295</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=102295#p102295"/>
		<title type="html"><![CDATA[Image downloader.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=102295#p102295"><![CDATA[
I wrote a script to download images posted from URLs to the channel, Im running this on a small VPS server (3Gb disk), im looking to figure out the best way to check if there is space available before it even attempts to download the image<br><br>so far this is what i've came up with.<div class="codebox"><p>Code: </p><pre><code>proc freespace {} {set dir /homeregexp {(\d+)} [lindex [lindex [split [exec df -k $dir] \n] end] end-2] -&gt; kbytesif {$kbytes &gt; 1073741824} { set result [expr ${kbytes}.0 / 1073741824.0]; set sz "TB" } elseif {$kbytes &gt; 1048576} { set result [expr ${kbytes}.0 / 1048576.0] ; set sz "GB" } else { set result [expr $kbytes / 1024.0] ; set sz "MB" }set result "[format %.2f $result]${sz}"; puts $resultputs $kbytes}</code></pre></div>If the file cant be downloaded, it notifys the channel its too large.<br>The filesize given from the image site is in human-readable format<br>1.02MB. for example.<br>any ideas? thanks.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12308">geeker</a> — Tue Dec 10, 2013 9:46 pm</p><hr />
]]></content>
	</entry>
	</feed>
