Advertisement
reges007

IDM limitter2

Mar 18th, 2015
987
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. --[[ <HCExtension>
  2. @name       IDM limit Single Con (BETA2)
  3. @author     reges007 (inspirasi by bdstd aka budi )
  4. @version    1.2
  5. @event      RequestHeaderReceived
  6. </HCExtension> ]]
  7.  
  8.  
  9. function RequestHeaderReceived()
  10.          if re.find(hc.request_header, [[^User-Agent:\sMozilla/4.0]]) then -- User Agent default download manager
  11.          if hc.cache_file_name=='' and re.match(hc.request_header, [[^Range:\sbytes=.*\r\n]]) then -- only empty file and range byte can be process
  12.               hc.action = 'save'
  13.                  local file = hc.get_cache_file_name(hc.url)
  14.                  local new  = hc.get_cache_file_size(file..'.new')
  15.          if new==-1 then
  16.               hc.call_me_for('BeforeAnswerBodySend', 'hapus')
  17.               hc.put_msg(2, 'IDM Limit Active')
  18.          else
  19.               hc.sleep(50)
  20.          if new~=nil then
  21.               hc.client_disconnect()
  22.               hc.monitor_string = 'SKIP'
  23.          end
  24.          end
  25.          end
  26.          end
  27.  
  28. end
  29.  
  30. function hapus()   -- Destroy everything
  31.          if hc.last_part then
  32.             local file = hc.get_cache_file_name(hc.url)
  33.              hc.delete_file(file)
  34.              -- hc.put_msg(2, file)
  35.           end
  36. end
  37.  
  38. -- versi 1.2 BETA2
  39. -- + Perbaikan pada metode penghapusan fake cache file dengan demikian aman untuk multi thread
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement