Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ <HCExtension>
- @name IDM Speed Limit (testing)
- @author bdstd, Komunitas Handycache Indonesia
- @version testing
- @event RequestHeaderReceived/Rikwes
- @event Init/init
- </HCExtension> ]]
- function init()
- hc.put_msg(30, 'IDM Speed limit')
- end
- function GetContentLength(s)
- _,_,x = string.find(s, '[cC]ontent%-[lL]ength: *(%d+)')
- if x==nil then return -1 else return tonumber(x) end
- end
- function Rikwes()
- if re.match(hc.request_header, [[^Range:\sbytes=.*\r\n]]) then
- if hc.cache_file_name=='' then
- hc.call_me_for('AnswerHeaderReceived', 'Limit')
- end
- end
- end
- function Limit()
- len = GetContentLength(hc.answer_header)
- if len > 102400 then
- hc.file_speed_limit = 55000
- hc.monitor_string = 'Limit IDM '
- end
- end
Add Comment
Please, Sign In to add comment