This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Problem with list and speed

Old posts that have not been replied to for several years.
Locked
J
JD10

Problem with list and speed

Post by JD10 »

Hi there,
I just started with TCL and Eggbot a day ago.
I want to write a script which lists the contents of a directory.

The code is :

Code: Select all

bind pub - !mp3list mp3:list
proc mp3:list {nick user handle chan text} {
  if {$chan == "#mp3"} {
   foreach d [glob -nocomplain -types d /music/mp3/$text/*] {
           putserv "PRIVMSG $nick : Dir in MP3/$text: $d "
  }
   foreach f [glob -nocomplain -types f /music/mp3/$text/*] {
        putserv "PRIVMSG $nick : File in MP3/$text : $f"
   }
   }
}
It works but i have 2 problems:
First its very slow.
Second i can only run a query at once.

How should i change the code to solve these problems.

Another two questions:
1. Is it possible to list all files, which have been added the current day
2. Is it possible to link these files so that u click on a directory it makes the !mp3list with the path u clicked on if a file is choosen opens the file in the default player (only for unix boxes which have mounted the mp3 dir as on the server).

Thanks in advance.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

To make it work faster, you can use:

Code: Select all

putquick "PRIVMSG $nick :Dir in MP3/$text: $d" -next
This should definately give a faster output.
Or to try and bypass all the queues, search for 'putdccraw'
on this forum and you will get many results! :mrgreen:

However, I would suggest putquick be a better solution.
If the directory (output) is long/big putdccraw will surely excess
flood the bot of the IRC Server. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
J
JD10

Post by JD10 »

Ok i changed my script to putquick so users can run querys simulaniously.
Thanks for the help.

How about the two other issues?

1. Is it possible to list all files, which have been added the current day
2. Is it possible to link these files so that u click on a directory it makes the !mp3list with the path u clicked on if a file is choosen opens the file in the default player (only for unix boxes which have mounted the mp3 dir as on the server).

Thanks
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

For 1:
Well, it will list all the files it reads in the dir.

So if there added the current day, or 1 hr ago, or created 1 min ago it should definately list them as well. (If you doubt, check it... yourself :wink: )

For 2:
As for that, you can do a foreach loop and add/append all the files in a list from the dir. Then select the file you want to play, probobaly through pub bind, and lsearch match in that exists or through string match then go ahead and do your stuff.

About the playing thing I have no idea. I am not good with those OS's. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
J
JD10

Post by JD10 »

Can i append a trigger to a output i give with the putserv or putquick, so that a user can click on the output and the proc which is bound to the output is startet?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I think you mean binding.
Yes you can.
BIND = Trigger
See 'bind' types in the tcl-commands.doc included in the eggdrop.*******.tar.gz package /docs/html dir. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
J
JD10

Post by JD10 »

I mean that if i give an output like :

Code: Select all

putserv "PRIVMSG $nick : Push me"
Is it possible to make the appearing Push me to trigger a procedure, when someone clicks with the mouse on it like a link?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Well, I don't understand what you are doing, or trying to achieve, 8)
but when the bot says "Push Me" that is already an output. :wink:

However if you would like to bot to trigger on that, then you can do a pubm or pub bind, matching indexes or apart of the text with the one you want to trigger also at first checking, if ([isbotnick $nick]). :mrgreen:

I am not sure what you mean by clicking on the mouse. If you use mIRC and you click on a url, then it surely opens that address/link in your default web browser. On the eggdrop there is nothing like that. No bind on an eggdrop can be triggered if a user clicks on a text by another person, infact the same goes for on mIRC. :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
Locked