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

	<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>2014-08-18T05:16:40-04:00</updated>

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

		<entry>
		<author><name><![CDATA[COBRa]]></name></author>
		<updated>2014-08-18T05:16:40-04:00</updated>

		<published>2014-08-18T05:16:40-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103148#p103148</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103148#p103148"/>
		<title type="html"><![CDATA[Adding info into a database via tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103148#p103148"><![CDATA[
took your advice and all is working superbly well many thanks to all<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12170">COBRa</a> — Mon Aug 18, 2014 5:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2014-07-31T14:07:03-04:00</updated>

		<published>2014-07-31T14:07:03-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103108#p103108</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103108#p103108"/>
		<title type="html"><![CDATA[Adding info into a database via tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103108#p103108"><![CDATA[
This seems obviously related to your other thread.<br>What you need to understand, is that the regular expression (pattern) I tailored in that thread, was specific to the format of the data - as posted in that thread. Here you have a different format, and thus need a different pattern.<br><br>From what I can tell though, it would seem you have two eggdrops, one which receives the messages from a third party, which you then relay to the second eggdrop which is then responsible for storing the data in the database. In this case, I'd suggest you use the already built-in encapsulation methods in tcl in this bot-to-bot transfer. And that would be tcl-lists.<br>Your first eggdrop has managed to split the data into four different variables (rlsname genre year sampling), so just create a list containing these four elements, and be done with it...<br><div class="codebox"><p>Code: </p><pre><code>#bot 1...putbot bot2 "addid3c [list $rlsname $genre $year $sampling]"...#bot 2bind bot - addid3cproc addmy:idc {bot command items} {  lassign $items rlsname genre year sampling  ...</code></pre></div>lassign is only available from tcl8.5 and forwards, for older versions you could use lindex to access each item by it's list offset instead.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Jul 31, 2014 2:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[COBRa]]></name></author>
		<updated>2014-07-31T13:04:41-04:00</updated>

		<published>2014-07-31T13:04:41-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=103106#p103106</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=103106#p103106"/>
		<title type="html"><![CDATA[Adding info into a database via tcl]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=103106#p103106"><![CDATA[
i want to want to store the info into a database ive come up with this code so far it kinda works unless the genre is double worded then it seems to add the first word of the genre at the end of the rlsname<br><br><div class="codebox"><p>Code: </p><pre><code>proc addmy:id3c { bot com arg } {global chann_ db_handle   set pattern { ([^&gt;]+) ([^&gt;]+) ([0-9]+) ([0-9]+)  }        if { [regexp $pattern $arg match rlsname genre year sampling] } {        set result [mysqlsel $db_handle "SELECT `rlsname` FROM `id3c` WHERE `rlsname` = '$rlsname'"]    }      if { $result == "0" } {     mysqlexec $db_handle "INSERT INTO `id3c` ( `rlsname` , `genre` , `year` , `sampling` ) VALUES ( '$rlsname' , '$genre' , '$year' , '$sampling' )"putquick "PRIVMSG $chann_(addid3c) :!addid3c $rlsname $genre $year $sampling"   }}</code></pre></div>the output from the previous script is this <br><div class="codebox"><p>Code: </p><pre><code>!addid3c Marduk-World_Funeral-Remastered-2014-BERC Black Metal 2014 44100</code></pre></div>and here is the database table<br><div class="codebox"><p>Code: </p><pre><code>-- Table structure for table `id3c`--CREATE TABLE IF NOT EXISTS `id3c` (  `id` int(11) NOT NULL AUTO_INCREMENT,  `rlsname` varchar(240) CHARACTER SET utf8 NOT NULL,  `genre` text CHARACTER SET utf8,  `year` year(4) NOT NULL,  `sampling` int(10) DEFAULT NULL,   PRIMARY KEY (`id`),  UNIQUE KEY `rlsname` (`rlsname`)) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=602 ;</code></pre></div>so basically it adds Marduk-World_Funeral-Remastered-2014-BERC Black into the rlsname field instead of Marduk-World_Funeral-Remastered-2014-BERC without the word Black which is part of the genre field<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12170">COBRa</a> — Thu Jul 31, 2014 1:04 pm</p><hr />
]]></content>
	</entry>
	</feed>
