mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Fix PEP8 whitespace violations
This commit is contained in:
parent
e490f97a05
commit
52c6096b6a
14 changed files with 237 additions and 225 deletions
|
@ -35,12 +35,13 @@ def process_torrent(input_directory, input_name, input_category, input_hash, inp
|
|||
pass
|
||||
|
||||
control_value_dict = {"input_directory": text_type(input_directory1)}
|
||||
new_value_dict = {"input_name": text_type(input_name1),
|
||||
new_value_dict = {
|
||||
"input_name": text_type(input_name1),
|
||||
"input_hash": text_type(input_hash),
|
||||
"input_id": text_type(input_id),
|
||||
"client_agent": text_type(client_agent),
|
||||
"status": 0,
|
||||
"last_update": datetime.date.today().toordinal()
|
||||
"last_update": datetime.date.today().toordinal(),
|
||||
}
|
||||
my_db.upsert("downloads", new_value_dict, control_value_dict)
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@ def rename_script(dirname):
|
|||
except Exception as error:
|
||||
logger.error("Unable to rename file due to: {error}".format(error=error), "EXCEPTION")
|
||||
|
||||
|
||||
def par2(dirname):
|
||||
newlist = []
|
||||
sofar = 0
|
||||
|
|
|
@ -45,10 +45,15 @@ requests.packages.urllib3.disable_warnings()
|
|||
|
||||
# Monkey Patch shutil.copyfileobj() to adjust the buffer length to 512KB rather than 4KB
|
||||
shutil.copyfileobjOrig = shutil.copyfileobj
|
||||
|
||||
|
||||
def copyfileobj_fast(fsrc, fdst, length=512 * 1024):
|
||||
shutil.copyfileobjOrig(fsrc, fdst, length=length)
|
||||
|
||||
|
||||
shutil.copyfileobj = copyfileobj_fast
|
||||
|
||||
|
||||
def report_nzb(failure_link, client_agent):
|
||||
# Contact indexer site
|
||||
logger.info("Sending failure notification to indexer site")
|
||||
|
@ -605,6 +610,7 @@ def parse_vuze(args):
|
|||
|
||||
return input_directory, input_name, input_category, input_hash, input_id
|
||||
|
||||
|
||||
def parse_qbittorrent(args):
|
||||
# qbittorrent usage: C:\full\path\to\nzbToMedia\TorrentToMedia.py "%D|%N|%L|%I"
|
||||
try:
|
||||
|
@ -634,6 +640,7 @@ def parse_qbittorrent(args):
|
|||
|
||||
return input_directory, input_name, input_category, input_hash, input_id
|
||||
|
||||
|
||||
def parse_args(client_agent, args):
|
||||
clients = {
|
||||
'other': parse_other,
|
||||
|
@ -1309,6 +1316,7 @@ def get_download_info(input_name, status):
|
|||
|
||||
return sql_results
|
||||
|
||||
|
||||
class WindowsProcess(object):
|
||||
def __init__(self):
|
||||
self.mutex = None
|
||||
|
@ -1385,6 +1393,7 @@ class PosixProcess(object):
|
|||
if os.path.isfile(self.pidpath):
|
||||
os.unlink(self.pidpath)
|
||||
|
||||
|
||||
if os.name == 'nt':
|
||||
RunningProcess = WindowsProcess
|
||||
else:
|
||||
|
|
|
@ -19,6 +19,7 @@ try:
|
|||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
|
||||
class UTorrentClient(object):
|
||||
|
||||
def __init__(self, base_url, username, password):
|
||||
|
|
|
@ -53,8 +53,7 @@ class MultiPartForm(object):
|
|||
# Add the files to upload
|
||||
parts.extend(
|
||||
[part_boundary,
|
||||
'Content-Disposition: file; name="%s"; filename="%s"' % \
|
||||
(field_name, filename),
|
||||
'Content-Disposition: file; name="%s"; filename="%s"' % (field_name, filename),
|
||||
'Content-Type: %s' % content_type,
|
||||
'',
|
||||
body,
|
||||
|
|
|
@ -668,12 +668,13 @@ def process(input_directory, input_name=None, status=0, client_agent='manual', d
|
|||
pass
|
||||
|
||||
control_value_dict = {"input_directory": text_type(input_directory1)}
|
||||
new_value_dict = {"input_name": text_type(input_name1),
|
||||
new_value_dict = {
|
||||
"input_name": text_type(input_name1),
|
||||
"input_hash": text_type(download_id),
|
||||
"input_id": text_type(download_id),
|
||||
"client_agent": text_type(client_agent),
|
||||
"status": 0,
|
||||
"last_update": datetime.date.today().toordinal()
|
||||
"last_update": datetime.date.today().toordinal(),
|
||||
}
|
||||
my_db.upsert("downloads", new_value_dict, control_value_dict)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue