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

	<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>2016-09-02T15:09:17-04:00</updated>

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

		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2016-09-02T15:09:17-04:00</updated>

		<published>2016-09-02T15:09:17-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105386#p105386</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105386#p105386"/>
		<title type="html"><![CDATA[MyShows script.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105386#p105386"><![CDATA[
If I replace<div class="codebox"><p>Code: </p><pre><code>foreach line $result {if {[string match -nocase *TBD* [dict get $line status]]} { lappend temp(pause) "\00304[dict get $line id]\003 - \00306[dict get $line titleOriginal]" }if {[string match -nocase *ended* [dict get $line status]]} { lappend temp(canceled) "\00304[dict get $line id]\003 - \00306[dict get $line titleOriginal]" }if {[string match -nocase *returning* [dict get $line status]]} { lappend temp(running) "\00312[dict get $line id]\003 - \00303[dict get $line titleOriginal]" }}</code></pre></div><br>On:<div class="codebox"><p>Code: </p><pre><code>set z_ 0foreach line $result {if {[string match -nocase *ended* [dict get $line status]]} { incr z_lappend temp(canceled) "\002${z_}\017. [dict get $line id] - [dict get $line titleOriginal]" }if {[string match -nocase *TBD* [dict get $line status]]} { incr z_lappend temp(pause) "\002${z_}\017. [dict get $line id] - [dict get $line titleOriginal]" }if {[string match -nocase *returning* [dict get $line status]]} { incr z_lappend temp(running) "\002${z_}\017. [dict get $line id] - [dict get $line titleOriginal]" }}</code></pre></div>Then I can get the number,<blockquote class="uncited"><div>&lt;User&gt; !tv search Vikings<br>&lt;Bot&gt; Running: 1. 29471 - Vikings, 5. 39024 - Den siste viking<br>&lt;Bot&gt; Canceled/Ended: 2. 27540 - Vikings, 3. 30436 - Tales of the Vikings, 4. 25742 - Whale Wars: Viking Shores, 6. 49785 - Vikings: Athelstan's Journal, 7. 38341 - Blood of the Vikings, 8. 30661 - There's A Viking In My Bed<br>&lt;Bot&gt; User - You can now see informations using command !tv id</div></blockquote>A little uncomfortable to write/copy ID. Instead, we can do something like:<blockquote class="uncited"><div>&lt;User&gt; !tv -1 Vikings</div></blockquote>and get info about "1. 29471 - Vikings"<br><br>Can anyone suggest how to do it?<p>Statistics: Posted by Guest — Fri Sep 02, 2016 3:09 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[Anonymous]]></name></author>
		<updated>2016-08-23T11:18:30-04:00</updated>

		<published>2016-08-23T11:18:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=105360#p105360</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=105360#p105360"/>
		<title type="html"><![CDATA[MyShows script.]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=105360#p105360"><![CDATA[
<div class="codebox"><p>Code: </p><pre><code># +-------------------------------------------------------------------------------------+# |                                                                                     |# |                         MyShows v1.0.0                                              |# |                                                                                     |# +-------------------------------------------------------------------------------------+# |                                                                                     |# | *** Website             @  http://www.EggdropTCL.com                                |# | *** GitHub              @  http://github.com/MadaliNTCL/eggdrop-tcl                 |# |                                                                                     |# +-------------------------------------------------------------------------------------+# | *** IRC Support:                                                                    |# |                    #EggdropTCL     @ QuakeNET                                       |# |                    #EggdropTCL     @ UnderNET                                       |# |                    #EggdropTCL     @ EfNET                                          |# |                                                                                     |# | *** Contact:                                                                        |# |                    Yahoo Messenger/Mail: madalinmen28@yahoo.com                     |# |                    Google Mail         : madalinmen28@gmail.com                     |# |                    Skype Messenger     : madalinmen28                               |# |                                                                                     |# +-------------------------------------------------------------------------------------+# + *** Commands ***                                                                    |# |                                                                                     |# |     +++ !tv &lt;search&gt; [name]                                                         |# |     +++ !tv [id]                                                                    |# |                                                                                     |# | Credits:                                                                            |# |                                                                                     |# |     +++ war10ck                                                                     |# +-------------------------------------------------------------------------------------+bind PUBM - * myshowspackage require jsonpackage require httppackage require tlsproc myshows {nick uhost hand chan arg} {global tempif {[string index $arg 0] in {! . `}} {set temp(cmd) [string range $arg 1 end]set temp(cmd) [lindex [split $temp(cmd)] 0]set arg [join [lrange [split $arg] 1 end]]} elseif {[isbotnick [lindex [split $arg] 0]]} {set temp(cmd) [lindex [split $arg] 1]set arg [join [lrange [split $arg] 2 end]]} else { return 0 }if {[info commands myshows:$temp(cmd)] ne ""} { myshows:$temp(cmd) $nick $uhost $hand $chan $arg }}proc myshows:tv {nick uhost hand chan arg} {switch -exact -- [lindex [split $arg] 0] {search {#set arg [string map [list " " "%20"] $arg]::http::register https 443 [list ::tls::socket -tls1 1]http::config -accept "application/json" -useragent "Mozilla/5.0 (X11;Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"if {[catch {set token [http::geturl "https://api.myshows.me/v2/rpc/" \-timeout 10000 \-method POST \-query "\{\"jsonrpc\": \"2.0\", \"method\":\"shows.Search\", \"params\": \{\"query\": \"[join [lrange $arg 1 end]]\"\}, \"id\": 1\}" \-type "application/json"]} err]} {putquick "PRIVMSG $chan :Something went wrong ($err)."; return 0}set connect [http::data $token]set connect [json::json2dict $connect]set result [dict get $connect result]set temp(canceled) ""; set temp(running) ""; set temp(pause) ""foreach line $result {if {[string match -nocase *TBD* [dict get $line status]]} { lappend temp(pause) "\00304[dict get $line id]\003 - \00306[dict get $line titleOriginal]" }if {[string match -nocase *ended* [dict get $line status]]} { lappend temp(canceled) "\00304[dict get $line id]\003 - \00306[dict get $line titleOriginal]" }if {[string match -nocase *returning* [dict get $line status]]} { lappend temp(running) "\00312[dict get $line id]\003 - \00303[dict get $line titleOriginal]" }}if {$temp(running) ne ""} { putquick "PRIVMSG $chan :\002Running\002: [join $temp(running) ", "]" }if {$temp(pause) ne ""} { putquick "PRIVMSG $chan :\002Pause\002: [join $temp(pause) ", "]" }if {$temp(canceled) ne ""} { putquick "PRIVMSG $chan :\002Canceled/Ended\002: [join $temp(canceled) ", "]" }if {$temp(running) ne "" || $temp(pause) ne "" || $temp(canceled) ne ""} { putquick "PRIVMSG $chan :\002$nick\002 - You can now see informations using command \00306!tv \00304id" }if {$result eq ""} { putquick "PRIVMSG $chan :\002$nick\002 - Nothing found"; return }}default {if {[isnumber [lindex [split $arg] 0]]} { shows.GetById $chan [lindex [split $arg] 0]; return}putquick "PRIVMSG $chan :\002$nick\002 - \002USAGE\002: !tv &lt;search/\[\$id\]&gt; \[\$name\]"}}}proc shows.GetById {chan id} {::http::register https 443 [list ::tls::socket -tls1 1]http::config -accept "application/json" -useragent "Mozilla/5.0 (X11;Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"if {[catch {set token [http::geturl "https://api.myshows.me/v2/rpc/" \-timeout 10000 \-method POST \-query "\{\"jsonrpc\": \"2.0\", \"method\": \"shows.GetById\", \"params\": \{\"showId\": \"$id\"\}, \"id\": 1\}" \-type "application/json"]} err]} {putquick "PRIVMSG $chan :Something went wrong ($err)."; return 0}set connect [http::data $token]set connect [json::json2dict $connect]set temp(episode-list) [dict get [dict get $connect result] episodes]putquick "PRIVMSG $chan :\00312[dict get [dict get $connect result] titleOriginal]\003 \037\002/\002\037 \00302Status: \00304[dict get [dict get $connect result] status]\003 \037\002/\002\037 \00302Total Season: \00303\002[dict get [dict get $connect result] totalSeasons]\002\003 - \00306https://en.myshows.me/view/[dict get [dict get $connect result] id]/"putquick "PRIVMSG $chan :\00302Premiered\003: \00303[dict get [dict get $connect result] started]\003 - \00304\002[dict get [dict get $connect result] ended]\002\003 \037\002/\002\037 \00302Rating: \00304[dict get [dict get $connect result] rating]\003 (Votes: \00304[dict get [dict get $connect result] voted]\003) \037\002/\002\037 \00302Watchers: \00304[dict get [dict get $connect result] watching]\003 \037\002/\002\037 \00302Country: \00304[dict get [dict get $connect result] country]\003"set temp(next5) ""; set temp(last5) ""foreach episode $temp(episode-list) {if {![string match -nocase [dict get $episode airDate] "null"]} { set airDate [expr [clock scan [string map [list "T" " " "+0000" ""] [dict get $episode airDate]]] - [unixtime]] }set shortName [dict get $episode shortName]set title [dict get $episode title]putlog "$airDate -- $shortName -- $title"if {![string match -nocase *-* $airDate]} {lappend temp(next5) "[list $airDate $shortName $title]"} else {lappend temp(last5) "[list $airDate $shortName $title]"}}set lsortnext [lsort -index 0 -integer -increasing $temp(next5)]set lsortlast [lsort -index 0 -integer -decreasing $temp(last5)]set next 0; set last 0foreach line $lsortnext {incr nextif {$next &lt;= "3"} { putquick "PRIVMSG $chan :\002\037\[\002\037NexT\037\002\]\037\002 \00302Name\003: \00312[lindex $line 2]\003 - \00304[lindex $line 1]\003 airs in \00303[convert:myshows [duration [lindex $line 0]]]" }}foreach line $lsortlast {incr lastset airDate [string map [list "-" ""] [lindex $line 0]]if {$last &lt;= "3"} { putquick "PRIVMSG $chan :\002\037\[\002\037LasT\037\002\]\037\002 \00302Name\003: \00312[lindex $line 2]\003 - \00304[lindex $line 1]\003 aired \00303[convert:myshows [duration $airDate]] ago" }}}proc convert:myshows {arg} { return [string map [list " years" "y" " year" "y" " months" "m" " month" "m" " weeks" "w" " week" "w" " days" "d" " day" "d" " hours" "h" " hour" "h" " minutes" "m" " minute" "m" " seconds" "s" " second" "s"] $arg] }putlog "++ \[ - \00304PUBLIC\003 - \00306loaded\003 * \00303MyShows\003 \]"</code></pre></div>---<blockquote class="uncited"><div>&lt;User&gt; !tv search The Strain<br>&lt;Bot&gt; Running: 34435 - The Strain<br><br>&lt;User&gt;!tv 34435<br>&lt;Bot&gt;The Strain / Status: Returning Series / Total Season: 3 - <a href="https://en.myshows.me/view/34435/" class="postlink">https://en.myshows.me/view/34435/</a><br>&lt;Bot&gt;Premiered: Jul/13/2014 - null / Rating: 3.67 (Votes: 14961) / Watchers: 32282 / Country: US<br>&lt;Bot&gt;[NexT] Name: New York Strong - s03e01 airs in 5d 7h 50m 52s<br>&lt;Bot&gt;[NexT] Name: Bad White - s03e02 airs in 1w 5d 7h 50m 52s<br>&lt;Bot&gt;[NexT] Name: First Born - s03e03 airs in 2w 5d 7h 50m 52s<br>&lt;Bot&gt;[LasT] Name: Night Train - s02e13 airs in 46w 1d 16h 9m 8s<br>&lt;Bot&gt;[LasT] Name: Fallen Light - s02e12 airs in 47w 1d 16h 9m 8s<br>&lt;Bot&gt;[LasT] Name: Dead End - s02e11 airs in 48w 1d 16h 9m 8s</div></blockquote>---<br>Thank you for the myshows.tcl, Madalin. Also thanks to Sergio\RN.<br>Download on <a href="https://github.com/MadaliNTCL/eggdrop-tcl/tree/master/myshows" class="postlink">GitHub</a><br>Topic created by agreement with the <a href="http://forum.egghelp.org/profile.php?mode=viewprofile&amp;u=6396" class="postlink">Madalin</a><br>---<br>In the script there are some drawbacks. Please write if you find something.<p>Statistics: Posted by Guest — Tue Aug 23, 2016 11:18 am</p><hr />
]]></content>
	</entry>
	</feed>
