From 5e2cd8c23ff4d3c1c2142212de4bb4e7cc6d575a Mon Sep 17 00:00:00 2001 From: Jeix Date: Wed, 16 Feb 2011 19:55:00 +0100 Subject: youtube fix, xdccrequest abort dl implemented --- module/network/XDCCRequest.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'module/network') diff --git a/module/network/XDCCRequest.py b/module/network/XDCCRequest.py index 01015cc62..92ccb4839 100644 --- a/module/network/XDCCRequest.py +++ b/module/network/XDCCRequest.py @@ -20,6 +20,7 @@ import socket import re +from os import remove from os.path import exists from time import time @@ -27,8 +28,8 @@ from time import time import struct from select import select -class XDCCError(Exception): - pass +from module.plugins.Plugin import Abort + class XDCCRequest(): def __init__(self, timeout=30, proxies={}): @@ -88,7 +89,10 @@ class XDCCRequest(): # recv loop for dcc socket while True: if self.abort: - break + dccsock.close() + fh.close() + remove(filename) + raise Abort() data = dccsock.recv(4096) dataLen = len(data) @@ -121,6 +125,9 @@ class XDCCRequest(): return filename + def abortDownloads(self): + self.abort = True + @property def size(self): return self.filesize -- cgit v1.2.3