mIRC Homepage
Posted By: marius88mkd Script Auto Send text - 03/04/23 11:41 PM
Hi all, i am using mirc to download some music, no piracy, and they use the command:

!nickname name.of.file.mp3


so, i have a long .txt file with all their music, and i will like to create a script to send each line to download each mp3. it is a large file +50000 mp3 and if i use /play command it will be considerate flood and they kick me out.

So, i need to send each line of the txt file to a channel every 2-3 minutes.

Cán anybody can help me ???? Thanks
Posted By: maroon Re: Script Auto Send text - 04/04/23 02:55 AM
Well, if you want to use /play, the F1 help shows that /play has a default delay of 1000 milliseconds, but there is a parameter to change the delay, so if you want 2.5 minutes, that's 150 seconds, or 150000 milliseconds

I'm not sure how much of a time buffer you're putting in that 2-3 minutes, i.e. whether flooding is making too many requests too soon, or requesting too many while the file is transferring.

But based on your description, your 2.5 minutes would take nearly 3 months even if nothing goes wrong and if you're able to do it around the clock. 50000 x 150 seconds / 86400 seconds per day = 87 days.

I assume you would have some way of verifying that they actually accept your request for each of the 50k files, and that all files actually finish 100%, and that there aren't any duplicate filenames in the list that would cause something to try to resume-get on top of a different file, and either create a hybrid file, or fails because the new one is smaller than the existing one.

One thing you can do is hook the FILERCVD and GETFAIL events, where you can request the next line after waiting N seconds beyond a successful FILERCVD, if the file comes from that nick - and if a getfail from the nick you can do special handling to deal with it later, and then just get the next file instead. Something simple like this requires you first create several global variables

I haven't tested this, so might need tweaking, and you'll need to edit the nick and the channelname and the value for $network at that network.

So, if you make a manual request from line 123, first create the global variable tracking the last line requested:
/set %mp3line 123

Once you receive a file from that nick, it will wait 10 seconds before requesting another file, after incrementing %mp3line to 124, using the make_request alias. It has a line that keeps from making a request if there's more than 1 get-window open from that nick, so you'd want to have it auto-close when incoming files complete or fail. It also has another line to keep from making requests sooner than 60 seconds apart even if there are no active sends, but if you don't need that, you can ;comment it out.

If there's a getfail, it makes sure to not request another file for 120 seconds, because if it's your fault you don't want to be getfail'ing at short intervals.

The /request_monitor runs on a timer that double-checks to see if there is no active send in spite of the latest request being > 300 seconds ago, which should give time for you to reach the top of a queue. If this happens, it writes the filename last requested to a logfile, the same logfile where it writes the name of getfails - and you can later inspect the file for special handling to see if it were really received. Also written to the fail log is an FYI when a received file resume-gets, so you can verify whether the same filename exists twice in the list.

This is playing it safe by not trying to re-request failed files, because there can be lots of things which cause some filenames to fail, with not all of them being your/their fault, and you don't want to have that going on while you're away from the keyboard. For example, you don't want to auto-compare received files against the file list, because filenames can be received differently than requested, such as having spaces or ^ changed to underscores. Or, there can be other quirks related to reserved device names. I'm not sure whether i can receive global.txt, because the attempt to send the file to myself fails, lol.

While you're doing special handling to fill in missing files you've skipped past, you don't want the /make_request alias doing anything, so while you're doing that you can remove the ;semi-colon from the RETURN at the top of that script, then put it back when ready to continue


Code
on *:FILERCVD:*:{
  if ($nick == foobar) {
    timer 1 0 make_request
    if ($get(-1).resume > 0) write fail_log.txt $asctime FYI resume-get of $filename at offset $v1
  }
}

on *:GETFAIL:*:{
  if ($nick == foobar) {
    write fail_log.txt fail at $asctime filename $nopath($filename) 
    timerrequest_monitor -o 0 120 request_monitor
  }
}

alias make_request {
  ;return
  if ($network != NetworkName) return
  if (!$nick(#channelname,foobar)) return
  if ($get(foobar,0) > 1) { request_monitor | return }
  if ($calc($ctime - %last.request.time) < 60) { timer 1 $calc(60+1- $v1) make_request | return }
  var %file $read(mp3list.txt,nt,%mp3line)
  inc %mp3line | timermake_request 1 10 msg #channelname !foobar $unsafe(%file)
  set %last.request.time $ctime
  set %last.request.file %file
  echo -s requested line %mp3line file: %file
}

alias request_monitor {
  if (!$timer(request_monitor)) timerrequest_monitor -o 0 120 request_monitor
  if ($get(foobar,0) > 1) { echo -s delaying request while $v1 send in progress | return }
  if ($calc($ctime - %last.request.time) > 300) {
    write fail_log.txt $asctime no active sends after requesting $v1 seconds ago: %last.request.file
    make_request
  }
}
© mIRC Discussion Forums