<?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/19433" />

	<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-08-29T19:07:53-04:00</updated>

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

		<entry>
		<author><name><![CDATA[hayuto]]></name></author>
		<updated>2013-06-04T12:58:05-04:00</updated>

		<published>2013-06-04T12:58:05-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101627#p101627</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101627#p101627"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101627#p101627"><![CDATA[
i updated the stream and translated all variables (first post in topic updated) to english if anyone want it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"> it have many functions now <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12239">hayuto</a> — Tue Jun 04, 2013 12:58 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hayuto]]></name></author>
		<updated>2013-06-03T12:43:43-04:00</updated>

		<published>2013-06-03T12:43:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101626#p101626</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101626#p101626"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101626#p101626"><![CDATA[
thanks <br>i dont know since yesterday i put much work in my own script maybe it isnt super pretty but it have now many function like having a list of all past streams with date and length, it can show status, and it announce immidietly when the stream starts and stops <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> even if bot is restarted it will know if stream status changed while it was offline cause it is done by wget etc<br><br> its badly writen but it works<br><br>but thank you anyways for your effort <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> im sure someone will look for something like this sooner or later on google and will find this topic, so i put here my script as well when im done (maybe) he will have a choice <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12239">hayuto</a> — Mon Jun 03, 2013 12:43 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2013-06-02T15:22:49-04:00</updated>

		<published>2013-06-02T15:22:49-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101623#p101623</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101623#p101623"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101623#p101623"><![CDATA[
<blockquote class="uncited"><div>didn't edited anything yet just loaded it and<div class="codebox"><p>Code: </p><pre><code>20:38 &lt;suchybot&gt; [20:38:00] Tcl error [streamUpOrDown]: can't use non-numeric string as operand of "-"</code></pre></div></div></blockquote>The problem is your stream, when its online, has no start_time given to it. It remains "null" the same as if it were offline. So when start_time isn't found, the script will now make use of [clock seconds] which will give an inaccurate time the stream has been up, but hey, thats the best you can do when you don't know how long it's been active eh?<br><div class="codebox"><p>Code: </p><pre><code># dailymotion stream thing-a-mah-jig# speechles/#roms-isos on June 3rd, 2013## This will check every minute if the stream has gone up or down# and will announce the start and ending. When the stream is enabled,# it will also announce the url and how long the stream has been going# on the hour and half hour. So every 30 minutes give or take a few# seconds. It's using bind to time rather than timers too. So far less# overhead is required tracking things.#--&gt; config start# channel everything occurs inset stream(channel) "#kangaroopocket"# url we announce for people to joinset stream(url) "http://www.dailymotion.com/video/xzlc83"# url we use to obtain status informationset stream(api) "https://api.dailymotion.com/video/xzlc83"# This one below you should _NEVER_ change unless you have# issues with duration agos from start of videosset stream(timezone) "%Y-%m-%d %H:%M:%S %Z"# Use this to adjust minor clock sync issues -/+secondsset stream(fixtime) "0"# &lt;-- config endpackage require httppackage require tls::http::register https 443 [list ::tls::socket -require 0 -request 1]if {![info exists stream(status)]} {   set stream(status) "false"   set stream(time) 0}proc streamDuration {time} {   global stream   set now [clock scan [clock format [clock seconds] -format $stream(timezone)] -gmt 1]   putlog "$now - $time + $stream(fixtime)"   return [duration [expr {$now - $time + $stream(fixtime)}]]}foreach t {30* 60*} { bind time - $t streamSpam }proc streamSpam {args} {   global stream   if {[string equal true $stream(status)]} {      putserv "privmsg $stream(channel) :Live stream in progress at $stream(url) started [streamDuration $stream(time)] ago."   }}bind time - * streamUpOrDownproc streamUpOrDown {args} {   global stream   if {[catch { http::geturl "$stream(api)?fields=onair,start_time" -timeout 3000 } http]} {      putlog "Dailymotion: [string totitle $http]"      return 0   }   if {![string equal -nocase [::http::status $http] "ok"]} {      putlog "Dailymotion: [string totitle [::http::status $http]]"      http::cleanup $http      return 0   }   set data [http::data $http]   http::cleanup $http   regexp -- {"onair"\:(.*?),} $data - onair   regexp -- {"start_time"\:(.*?)\}} $data - start   if {![info exists onair]} {      if {[regexp -- {"message"\:"(.*?)"} $data - message]} {         putserv "privmsg $stream(channel) :$message"      } else {         putlog "Dailymotion: Parsing error; unexpected data."      }   } else {      if {![string equal $onair $stream(status)]} {         if {[string equal true $onair]} {            if {[string equal null $start]} { set start [clock scan [clock format [clock seconds] -format $stream(timezone)] -gmt 1] }            set message "\002Stream is UP\002 started [streamDuration $start] ago. Come watch us live at $stream(url)"            set stream(time) $start         } else {            set message "\002Stream is DOWN\002 after [streamDuration $stream(time)] at $stream(url)"            set stream(time) 0         }         set stream(status) $onair         putserv "privmsg $stream(channel) :$message"      }   }}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Jun 02, 2013 3:22 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hayuto]]></name></author>
		<updated>2013-06-02T14:38:46-04:00</updated>

		<published>2013-06-02T14:38:46-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101622#p101622</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101622#p101622"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101622#p101622"><![CDATA[
didn't edited anything yet just loaded it and<div class="codebox"><p>Code: </p><pre><code>20:38 &lt;suchybot&gt; [20:38:00] Tcl error [streamUpOrDown]: can't use non-numeric string as operand of "-"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12239">hayuto</a> — Sun Jun 02, 2013 2:38 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hayuto]]></name></author>
		<updated>2013-06-02T09:57:53-04:00</updated>

		<published>2013-06-02T09:57:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101620#p101620</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101620#p101620"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101620#p101620"><![CDATA[
will it be less resource heavy if i check every 5 seconds within the script, instead of wget? i want to check every 5 seconds, what good from script that will tell us the stream started after it has been live for whole minute? <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"> i always tought wget is super fast and super optimized, and also i changed couple things here and there since i posted so i really dont know whats better now.<br><br>i now use duration from russian peak.tcl script which i translated to polish it works as supposed it use proper grammar for our language:<br><br><a href="http://paste.tclhelp.net/?id=ddk" class="postlink">http://paste.tclhelp.net/?id=ddk</a> (edit forgot about <a href="http://paste.tclhelp.net/?id=ddl" class="postlink">http://paste.tclhelp.net/?id=ddl</a>)<br><br>i also use @reboot cron command and do; while bash script<br><br>i love your code and want to use it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_razz.gif" width="15" height="15" alt=":P" title="Razz"> <br><br>will it be better, is it faster then wget? i dont know how to test it in long run<br><br>anyways i will load it later and tell you if it works ok (but it have to announce immidietly when stream starts and ends so i need to figure out first how to change it <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy">)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12239">hayuto</a> — Sun Jun 02, 2013 9:57 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[speechles]]></name></author>
		<updated>2013-06-02T04:46:33-04:00</updated>

		<published>2013-06-02T04:46:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101619#p101619</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101619#p101619"/>
		<title type="html"><![CDATA[Re: i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101619#p101619"><![CDATA[
<blockquote class="uncited"><div><strong class="text-strong">what you think?</strong> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"></div></blockquote>It looks very resource heavy. Why didn't you write it in pure-tcl using http package instead? You also, inadvertently overwrote tcl's native [duration] command with one of your own. Not sure if this was intended... But to make it less of a drain on your bot, and your shell here's is something that should behave similar to what you are already doing.<br><div class="codebox"><p>Code: </p><pre><code># dailymotion stream thing-a-mah-jig# speechles/#roms-isos on June 2nd, 2013## This will check every minute if the stream has gone up or down# and will announce the start and ending. When the stream is enabled,# it will also announce the url and how long the stream has been going# on the hour and half hour. So every 30 minutes give or take a few # seconds. It's using bind to time rather than timers too. So far less # overhead is required tracking things.#--&gt; config start# channel everything occurs inset stream(channel) "#chan"# url we announce for people to joinset stream(url) "http://www.dailymotion.com/video/xzlc83"# url we use to obtain status informationset stream(api) "https://api.dailymotion.com/video/xzlc83"# This one below you should _NEVER_ change unless you have# issues with duration agos from start of videosset stream(timezone) "%Y-%m-%d %H:%M:%S %Z"# Use this to adjust minor clock sync issues -/+secondsset stream(fixtime) "0"# &lt;-- config endpackage require httppackage require tls::http::register https 443 [list ::tls::socket -require 0 -request 1]if {![info exists stream(status)]} {set stream(status) "false"set stream(time) 0}proc streamDuration {time} {global streamset now [clock scan [clock format [clock seconds] -format $stream(timezone)] -gmt 1]return [duration [expr {$now - $time + $stream(fixtime)}]]}foreach t {30* 60*} { bind time - $t streamSpam }proc streamSpam {args} {global streamif {[string equal true $stream(status)]} {putserv "privmsg $stream(channel) :Live stream in progress at $stream(url) started [streamDuration $stream(time)] ago."}}bind time - * streamUpOrDownproc streamUpOrDown {args} {global streamif {[catch { http::geturl "$stream(api)?fields=onair,start_time" -timeout 3000 } http]} {putlog "Dailymotion: [string totitle $http]"return 0}if {![string equal -nocase [::http::status $http] "ok"]} {putlog "Dailymotion: [string totitle [::http::status $http]]"http::cleanup $httpreturn 0}set data [http::data $http]http::cleanup $httpregexp -- {"onair"\:(.*?),} $data - onairregexp -- {"start_time"\:(.*?)\}} $data - startif {![info exists onair]} {if {[regexp -- {"message"\:"(.*?)"} $data - message]} {putserv "privmsg $stream(channel) :$message"} else {putlog "Dailymotion: Parsing error; unexpected data."}} else {if {![string equal $onair $stream(status)]} {if {[string equal true $onair]} {set message "\002Stream is UP\002 started [streamDuration $start] ago. Come watch us live at $stream(url)"set stream(time) $start} else {set message "\002Stream is DOWN\002 after [streamDuration $stream(time)] at $stream(url)"set stream(time) 0}set stream(status) $onairputserv "privmsg $stream(channel) :$message"}}}</code></pre></div>Yes, it does it all within this one script. If you have problems, notice bugs, let me know. I only tested this "in my head". <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_wink.gif" width="15" height="15" alt=";)" title="Wink"><br><br>Note: The start time used for this is the "actual" time the stream began. So starting the stream, then 4 hours later the bot joins. It will announce the stream is up and started 4 hours ago. Then every 30 minutes it will keep announcing there is a live stream running and for how long its been up until you switch off the stream. At that point it will announce the stream is down and how long the stream was up previously. It will only issue up/down announcement if the status of the stream has changed.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8138">speechles</a> — Sun Jun 02, 2013 4:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[hayuto]]></name></author>
		<updated>2013-08-29T19:07:53-04:00</updated>

		<published>2013-06-02T01:57:23-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=101618#p101618</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=101618#p101618"/>
		<title type="html"><![CDATA[i made simple script that check dailymotion livestream]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=101618#p101618"><![CDATA[
i made it for our channel only so you have to edit it<br><br><a href="http://wonziu.tk/sprawdzstream.tar.bz2" class="postlink">http://wonziu.tk/sprawdzstream.tar.bz2</a><br><strong class="text-strong">what you think?</strong> <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12239">hayuto</a> — Sun Jun 02, 2013 1:57 am</p><hr />
]]></content>
	</entry>
	</feed>
