PDA

View Full Version : site pretime


Mouton
05-14-2003, 11:40 AM
[12:21:01] site pretime
[12:21:03] 200-*-------------------------------------------------------*
[12:21:03] 200-| SYNTAX: SITE PRETiME <lookup> [number] |
[12:21:03] 200-| <lookup>: Either the complete release name, a type of |
[12:21:03] 200-| release, a group name or a keyword to search |
[12:21:03] 200-| the db for. |
[12:21:03] 200-| <number>: Number of results to show (default is used if |
[12:21:03] 200-| none specified). |
[12:21:03] 200-| Default: |
[12:21:03] 200-| Exact match returns 0-1 result |
[12:21:03] 200-| Release type returns 0-10 result(s) |
[12:21:03] 200-| Group name returns 0-10 result(s) |
[12:21:03] 200-| Keyword match returns 0-25 result(s) |
[12:21:03] 200-| Valid types: 0-DAY DiVX DVD-R GAME-iSO GBA MP3 MUSiC-ViD PS SVCD TV VCD XBOX XViD XXX *
[12:21:03] 200-------------------------------------------------------*
[12:21:03] 200 Command Successful.

U need a mysql table that contains type, name and timestamp of all rls. And don't ask where to get such a thing.
timestamp field needs to be a unix timestamp (as int), NOT a mysql timestamp field.

Source included, just in case ur table doesn't use the default field names, etc.

Enjoy.

*file has been removed*
Please ppl, mirror it. It won't be avail. there for much more than a week.

phoenixfr
05-14-2003, 11:51 AM
wahoo mouton
this sounds nice to me
thx for sharing
i think you've worked a lot to make it work :)

Mouton
05-14-2003, 12:11 PM
not that much...
once u get mysql++ working, it's an hour or two. :)

dasOp
05-14-2003, 12:14 PM
in that case most of the work was probably getting mysql++ working at all. ;)

Mouton
05-14-2003, 12:29 PM
had to google a couple of minutes before I could find how to compile that thing on vs.net... had to comment gay functions and stuff...

Flare2
05-14-2003, 02:13 PM
nice shit man, nice shit


any way to make a non-SQL version of this?

Mouton
05-14-2003, 03:07 PM
Where would u like it to fetch the info from ?

ProlyX
05-14-2003, 03:21 PM
txt?

save it like
type name time
then you grep the the search string and output the results..

cez
05-14-2003, 03:36 PM
not really on topic, but anyone know of a tcl-sqldriver to be used with windrop and dzsbot??

iXi
05-17-2003, 07:09 PM
moin,

realy nice script but thats only one part:)
is a secound part planed ?

that means a script for writing release name + pre time into a sql-db on pre ?

*g


cya

Flare2
05-17-2003, 09:58 PM
make it able to use a .mdb instead of SQL

would be good for us without SQL

Mouton
05-18-2003, 11:00 AM
I really don't think you can use ".mdb" and "good" in the same sentence and still make sense! ;)

I won't support that, cause I don't intend to learn how to access an Access DB from a C++ program...
Just the tought of that gives me shivers!

Quick Q: Why don't u use MySQL or Postgres, or any other free sql-(almost-)compliant db ?

Mouton
05-18-2003, 11:05 AM
pRoLuCkY:

.tcl:

bind msgm - [PRE]* procpre

proc procpre {nick uhost handle text} {
set query [http::formatQuery "rls" $text]
set url "http://your_ip/pretime.php?$query"
putlog "url: $url"
set result [http::data [http::geturl $url -timeout 5000]]
putlog "$result"
}


pretime.php:

<?
mysql_connect("localhost", "user", "password");
mysql_select_db("pretimes_db");

ereg("\[PRE\] - ([a-zA-Z0-9\._-]*). in .([a-zA-Z0-9\._-]*)",$rls,$regs);
$release = $regs[1];
$type = $regs[2];

$time = time();

if ($type!="" && $release!="") {
$sql = "INSERT INTO pretimes (timestamp, type, name) VALUES ('$time', '$type', '$release')";
mysql_query($sql)
or die($sql."<br>\n".mysql_error());

echo "Release '$release' succesfully added as $type";
}

iXi
05-18-2003, 01:42 PM
thx man;)

but thats a write in via msg;) not via io*gg

i meaned a tcl or programm what is writing into the sql db .. when
a rls grp on the site makes a pre...

cya

*edit*

btw other question how can i make a idler kick job for ioFTPD with
sitekill.exe ?

Slayer
05-20-2003, 05:50 AM
mouton nice tcl's
is there anyway to make the bot report pretime via a trigger to the channel?

Mouton
05-20-2003, 08:38 AM
U can either use the tcl extension for eggdrop, which is the clean way to do it, but the way i don't like myself because of the complicatedeness of installing that extension...

Or u can just do a http::geturl on a webpage (php for example) that will do the sql query for u and echo the result, and ur bot just has to echo that result back on irc.

Or maybe you could call my pretime.exe directly from the eggdrop tcl... Hum... It would probably work. U'll need to run your egg in -nt mode though.

Zalio
06-24-2003, 05:22 PM
wonderful script mounton.. i started editing your c++ file, i wanted to change the table names because it is better when i want to add more functions to it.

but i have one problem.. you are using column timestamp and i use date_time. In the last part of the .cpp file it says this:


Result::iterator i;
int j = 1;
time_t timestamp;
struct tm *datetime;
for (i = res.begin(); i != res.end(); i++) {
row = *i;
timestamp = (time_t)row["timestamp"];
datetime = localtime(&timestamp);
printf("%02i. %i-%02i-%02i %02i:%02i:%02i -> ",j++,datetime->tm_year+1900,datetime->tm_mon,datetime->tm_mday,datetime->tm_hour,datetime->tm_min,datetime->tm_sec);
cout << row["name"] << endl;
}
cout << "*--[/PRETiME]----------------------------------------------------*\n";


i changed it in this:


timestamp = (time_t)row["date_time"];
datetime = localtime(&timestamp);


is this good or do i also need to change the (&timestamp) in (&date_time) ? :P

very thnx if you can help me :D

Greetz Zalio

Mouton
06-25-2003, 02:24 PM
You C logic is fine, but I don't know it your date_time field contains a unix timestamp as my 'timestamp' field does.

I'm using a unix timestamp because it's easy to play with that in C then. If you're using a mysql datetime type field, u'll probably need to find the function that returns the unix timestamp in the sql line...

select datetimetounix(date_time) from pretimes...
or something similar... I don't know the exact function name, but I think it exist.

404error
07-01-2003, 12:24 AM
The SQL function you're looking for is UNIX_TIMESTAMP(any sql time column).

So SELECT UNIX_TIMESTAMP(timestamp) AS timestamp FROM table; or whatever you need.

Using mysqltcl really isn't difficult (at least on *ix, I have little experience with using it on a Windrop, though I execpt it's as easy as dropping a dll in the windrop dir and loading it from the script with the 'load' command. It *should* be possible to use this module in a .itcl as well, and it might even let u use persistent connections. It's availiable here: http://www.xdobry.de/mysqltcl/ Windows binaries here: http://www.xdobry.de/mysqltcl/windows.html

Oh and whoever wanted to import data from a text file, look into the LOAD DATA INFILE SQL command: http://www.mysql.com/doc/en/LOAD_DATA.html

MrManc
12-26-2003, 03:46 PM
Been using this script for a while, with ioftp v 5.2.x and v 5.3.x.
Works great in them versions, but get a starnge error with ioftpd 5.4.2 and 5.4.3.

[L] site pretime Dying_-_The_Truth_is_Inside-2003-FERiCE
[L] 200-Error: Can't create TCP/IP socket (10106)
[L] 200 Command successful.

I haven't messed with any firewall settings, and if i now go back to 5.3.9 it works.

Anyone else having this problem?
I think it uses the same code as the pretime features of iobanana, anyone having similar probs with that?

Mouton
12-27-2003, 10:24 PM
I guess it's a bug in newest io...
external script can't create sockets or something similar...
does imdb on nfo upload works ? it opens a socket too.

Harm
12-28-2003, 07:19 AM
Imdb on nfo upload works fine with ioFTPD 5.4.3r.
I will try the pretime db things this afternoon.

MrManc
12-28-2003, 07:43 AM
Yep imdb on nfo works fine for me too

[Rastaman]
03-14-2004, 12:24 PM
Works perfect in command line but when it's called from within site command :

[L] 200-Error: Can't create TCP/IP socket (10106)
[L] 200 Command successful.

Mouton said it was prolly a bug in newest io releases... no one succeed to get rid of that by any chance ? :>

_rage_ thegod
03-14-2004, 12:38 PM
just an idea, i havent and cant test this since i dont have the script nor do i intend to, but anyway, try this:

take the

pretime = EXEC ..\scripts\iopretime\iopretime.exe arg

line, create a batch file like this:


@echo off
set SystemRoot=c:\WINNT
c:\ioftpd\scripts\iopretime\iopretime.exe arg
exit 0


and replace

pretime = EXEC ..\scripts\iopretime\iopretime.exe arg
with
pretime = EXEC ..\scripts\path\to\where\you\put\the\batchfile.cmd

again, i have no clue if this works, but try if you want.

MrManc
03-14-2004, 12:56 PM
try adding these to ioftpd.env

SYSTEMROOT=%[environment(SYSTEMROOT)]
SYSTEMPATH=%[$path]

fixed my problem :)

[Rastaman]
03-15-2004, 10:23 AM
First: Thanx to MrManc & _rage_ thegod :>

SYSTEMPATH=%[$path] was already in my ioftpd.env
so i just added SYSTEMROOT=%[environment(SYSTEMROOT)] as MrManc suggested... but it seems that it didn't helped.

So, i tried the batch file solution, and finally it works :)
Except there was some errors in the syntax, here is what to fix :
- The SITE PRETIME syntax was wrong :
pretime = EXEC ..\scripts\path\to\where\you\put\the\batchfile.cmd

Here is the fixed syntax :
pretime = %EXEC ..\scripts\iopretime\iopretime.cmd

- The batch file syntax was wrong :
c:\ioftpd\scripts\iopretime\iopretime.exe arg
Here is the fixed syntax :
C:\ioFTPD\scripts\pretime.exe %1
(just add %2 %3 %4 %5... etc if needed)

and finally it works :)

_rage_ thegod
03-15-2004, 11:06 AM
true, didnt think of the arg as %1, hehe well :)

Mouton
03-15-2004, 05:36 PM
Originally posted by [Rastaman]
Here is the fixed syntax :
pretime = %EXEC ..\scripts\iopretime\iopretime.cmd the % there is not needed unless ur using cookies on that line. From what u showed, u're not, so it's not needed.

[anais]
03-30-2005, 10:54 AM
Any link for download it please ?:rolleyes: :rolleyes: