From a686c8253b6bb94dddcbb3c56a49ba7a63571e64 Mon Sep 17 00:00:00 2001 From: gujal Date: Mon, 26 Aug 2019 18:25:34 +1200 Subject: [PATCH] Update hmf.py The check valid url method is doign a GET request which is causing large files to be downloaded in the background. Kodiplayer is also downloading the same file to diaplay, so end up with two processes pulling the same large file causing wasted bandwidth. Doing a HEAD request achieves the valid file check while not downloading the entire file --- lib/resolveurl/hmf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/resolveurl/hmf.py b/lib/resolveurl/hmf.py index 857f1f9a..1fe6e9f4 100644 --- a/lib/resolveurl/hmf.py +++ b/lib/resolveurl/hmf.py @@ -256,6 +256,8 @@ def __test_stream(self, stream_url): try: msg = '' request = urllib2.Request(stream_url.split('|')[0], headers=headers) + # only do a HEAD request. gujal + request.get_method = lambda : 'HEAD' # set urlopen timeout to 15 seconds http_code = urllib2.urlopen(request, timeout=15).getcode() except urllib2.URLError as e: