| View previous topic :: View next topic |
| Author |
Message |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Sun Jul 18, 2010 4:27 pm Post subject: invalid command name? [solved] |
|
|
Ok folks, I've got this code snippet:
| Code: | proc pub_get {nick host hand chan text} {
putserv "NOTICE $nick :Searching for $text. Please stand by..."
set runcmd [exec /usr/local/filebot/search.sh "$text"]
if {[catch $runcmd res]} {
putserv "NOTICE $nick:No matches for $text"
}
putserv "NOTICE $nick :$res"
putlog "$res"
}
|
Which is running this shell script:
| Code: | #!/bin/bash
srch="$1"
oput1="/usr/local/filebot/tmp/search$$.lst"
find /mnt/music -name "*$srch*.mp3" > $oput1
fil=`head -1 $oput1`
echo "$fil"
rm -f $oput1
exit
|
Sample output of the shell script (command line option of "Better Now"):
| Code: | /mnt/music/C/Collective Soul/Collective Soul - Better Now.mp3
|
The trouble is, the tcl script returns this:
| Code: | | invalid command name "/mnt/music/C/Collective" |
Where am I going wrong?
Last edited by DJCharlie on Wed Jul 21, 2010 8:59 pm; edited 1 time in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sun Jul 18, 2010 4:49 pm Post subject: |
|
|
Perhaps by trying to execute the first line the search result as a tcl-command:
| Code: | ...
if {[catch $runcmd res]} {
... |
This executes the content of runcmd as a tcl-command, and stores the return-code, or error message in the case of an error, into the variable res. The return-code of catch itself reflects whether it caught an tcl-error or not.
Next, runcmd contains the result of calling the external shellscript - that is, whatever the shellscript echo:ed to stdout. In this case, "/mnt/music/C/Collective Soul/Collective Soul - Better Now.mp3".
So, most likely, you don't wan't to use the catch command.
On a side-note, I'd personally use the glob command for file searching, rather than invoking an external bash script. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Sun Jul 18, 2010 7:25 pm Post subject: |
|
|
That fixed it, thanks!
Any idea why a dccsend $runcmd $nick times out almost immediately? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Sun Jul 18, 2010 10:31 pm Post subject: |
|
|
| Did that already. It finds the files just fine, but times out immediately, soon as dccsend is started. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Sun Jul 18, 2010 10:42 pm Post subject: |
|
|
| DJCharlie wrote: | | Did that already. It finds the files just fine, but times out immediately, soon as dccsend is started. |
| Code: | catch { set result [dccsend $runcmd $nick] } error
if {![info exists result]} {
putserv "NOTICE $nick: Error: $error"
} else {
set indexlist [list "success" "the dcc table is full (too many connections)" "can't open a socket for the transfer" "the file doesn't exist" "the file was queued for later transfer, which means that person has too many file transfers going right now" "copy-to-tmp is enabled and the file already exists in the temp directory"]
putserv "NOTICE $nick: [string totitle [lindex $indexlist $result]]"
} |
Use the above code in place of merely using: dccsend $runcmd $nick
Report back what the above code replies.  _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Mon Jul 19, 2010 10:39 am Post subject: |
|
|
Added the code, rehashed, and tried again.
| Code: | -FredGibson- Searching for Better Now. Please stand by...
-FredGibson- Sending you /mnt/music/C/Collective Soul/Collective Soul - Better Now.mp3
-FredGibson- Timeout during transfer, aborting Collective_Soul_-_Better_Now.mp3. |
That pops up immediately after. |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Mon Jul 19, 2010 1:11 pm Post subject: |
|
|
Update: We can rule out firewalling. Ports are open on the firewall for this range (4500 - 4550).
Here's the results of a .dccstat:
| Code: | <FredGibson> [13:09] #DJCharlie# dccstat
<FredGibson> SOCK ADDR PORT NICK HOST TYPE
<FredGibson> ---- -------- ----- --------- ----------------- ----
<FredGibson> 7 7F000101 3393 (telnet) * lstn 3393
<FredGibson> 8 00000000 0 (dns) dns (ready)
<FredGibson> 11 4020146E 6667 (server) chat.kjsr.net serv (lag: 0)
<FredGibson> 14 C0A8000B 1026 DJCharlie JCharlie@kjsr.net chat flags: cPtEp/0
<FredGibson> 15 DEADF00D 4500 DJKyo irc send waited 65s
<FredGibson> Filename: Amy_Castle_-_Cuppycake_Song.mp3
<FredGibson> 17 DEADF00D 4501 DJCharlie irc send waited 38s
<FredGibson> Filename: Collective_Soul_-_Better_Now.mp3 |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Jul 19, 2010 1:58 pm Post subject: |
|
|
Could you check the value of xfer-timeout?
Also, see if you can grap the DCC SEND ctcp request/notice from your irc client, and validate that the correct IP is sent in the request. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Mon Jul 19, 2010 2:05 pm Post subject: |
|
|
set xfer-timeout 90
How would I grab the request/notice? I'm running mIRC. |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Mon Jul 19, 2010 9:54 pm Post subject: |
|
|
Well, tried using XChat, and got this:
| Code: | !fetch Collective Soul - Better Now
-FredGibson- Searching for Collective Soul - Better Now. Please stand by...
-FredGibson- Sending you /mnt/music/C/Collective Soul/Collective Soul - Better Now.mp3
* FredGibson has offered Collective_Soul_-_Better_Now.mp3 (3115136 bytes)
* DCC RECV connect attempt to FredGibson failed (err=Connection refused) |
Does that help any? |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Tue Jul 20, 2010 5:39 am Post subject: |
|
|
| DJCharlie wrote: | * DCC RECV connect attempt to FredGibson failed (err=Connection refused)
Does that help any? |
Your refusing the send. Most IRC clients won't auto-accept and they certainly won't come preset to auto-accept *.mp3. So the problem isn't your bot at all, although the code I gave you will indicate to users when it is your bots fault. The problem is entirely the receiving clients fault. _________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Tue Jul 20, 2010 9:06 am Post subject: |
|
|
| So how do I fix it? So far I've not found a single user who can get a file transfer to work. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Jul 20, 2010 1:15 pm Post subject: |
|
|
Speechles,
Think again. The error rather suggests that the irc client was unable to connect to the eggdrop. This usually suggests that the eggdrop sends the incorrect IP address with the DCC SEND request - running the eggdrop behind a masquerading router/firewall and not setting the nat-ip setting properly often causes this. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DJCharlie Voice
Joined: 06 May 2009 Posts: 37
|
Posted: Tue Jul 20, 2010 4:26 pm Post subject: |
|
|
As far as I know, the router isn't masquerading. How can I find out what IP the eggdrop is claiming?
The server it's on DOES have a domain name (provided by dyndns) if that helps. |
|
| Back to top |
|
 |
|