mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
fix remote_path handling on different os types.
This commit is contained in:
parent
332957caaa
commit
7ece7997a9
4 changed files with 38 additions and 7 deletions
|
@ -59,13 +59,20 @@ class autoProcessComics:
|
||||||
|
|
||||||
replaceExtensions(dirName)
|
replaceExtensions(dirName)
|
||||||
|
|
||||||
|
if remote_path:
|
||||||
|
if remote_path[-1] in ['\\','/']: # supplied directory includes final directory separator
|
||||||
|
remote_path = remote_path + os.path.basename(dirName)
|
||||||
|
elif remote_path[0] == '/': # posix path
|
||||||
|
remote_path = remote_path + '/' + os.path.basename(dirName)
|
||||||
|
else: # assume windows path or UNF path
|
||||||
|
remote_path = remote_path + '\\' + os.path.basename(dirName)
|
||||||
|
|
||||||
params = {}
|
params = {}
|
||||||
params['apikey'] = apikey
|
params['apikey'] = apikey
|
||||||
params['cmd'] = "forceProcess"
|
params['cmd'] = "forceProcess"
|
||||||
|
params['nzb_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['nzb_folder'] = os.path.join(remote_path, os.path.basename(dirName))
|
params['nzb_folder'] = remote_path
|
||||||
else:
|
|
||||||
params['nzb_folder'] = dirName
|
|
||||||
|
|
||||||
if inputName != None:
|
if inputName != None:
|
||||||
params['nzb_name'] = inputName
|
params['nzb_name'] = inputName
|
||||||
|
|
|
@ -145,6 +145,14 @@ class autoProcessMovie:
|
||||||
process_all_exceptions(inputName.lower(), dirName)
|
process_all_exceptions(inputName.lower(), dirName)
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
|
if remote_path:
|
||||||
|
if remote_path[-1] in ['\\','/']: # supplied directory includes final directory separator
|
||||||
|
remote_path = remote_path + os.path.basename(dirName)
|
||||||
|
elif remote_path[0] == '/': # posix path
|
||||||
|
remote_path = remote_path + '/' + os.path.basename(dirName)
|
||||||
|
else: # assume windows path or UNF path
|
||||||
|
remote_path = remote_path + '\\' + os.path.basename(dirName)
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
if nzbtomedia.TRANSCODE == 1:
|
if nzbtomedia.TRANSCODE == 1:
|
||||||
result = transcoder.Transcode_directory(dirName)
|
result = transcoder.Transcode_directory(dirName)
|
||||||
|
@ -165,7 +173,7 @@ class autoProcessMovie:
|
||||||
|
|
||||||
params['media_folder'] = dirName
|
params['media_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['media_folder'] = os.path.join(remote_path, os.path.basename(dirName))
|
params['media_folder'] = remote_path
|
||||||
|
|
||||||
url = "%s%s" % (baseURL, command)
|
url = "%s%s" % (baseURL, command)
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,14 @@ class autoProcessMusic:
|
||||||
|
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
|
if remote_path:
|
||||||
|
if remote_path[-1] in ['\\','/']: # supplied directory includes final directory separator
|
||||||
|
remote_path = remote_path + os.path.basename(dirName)
|
||||||
|
elif remote_path[0] == '/': # posix path
|
||||||
|
remote_path = remote_path + '/' + os.path.basename(dirName)
|
||||||
|
else: # assume windows path or UNF path
|
||||||
|
remote_path = remote_path + '\\' + os.path.basename(dirName)
|
||||||
|
|
||||||
url = "%s%s:%s%s/api" % (protocol,host,port,web_root)
|
url = "%s%s:%s%s/api" % (protocol,host,port,web_root)
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
|
@ -68,7 +76,7 @@ class autoProcessMusic:
|
||||||
|
|
||||||
params['dir'] = os.path.dirname(dirName)
|
params['dir'] = os.path.dirname(dirName)
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['dir'] = os.path.join(remote_path, os.path.basename(os.path.dirname(dirName)))
|
params['dir'] = remote_path
|
||||||
|
|
||||||
release_status = self.get_status(url, apikey, dirName)
|
release_status = self.get_status(url, apikey, dirName)
|
||||||
if not release_status:
|
if not release_status:
|
||||||
|
|
|
@ -107,6 +107,14 @@ class autoProcessTV:
|
||||||
status = 1
|
status = 1
|
||||||
failed = 1
|
failed = 1
|
||||||
|
|
||||||
|
if remote_path:
|
||||||
|
if remote_path[-1] in ['\\','/']: # supplied directory includes final directory separator
|
||||||
|
remote_path = remote_path + os.path.basename(dirName)
|
||||||
|
elif remote_path[0] == '/': # posix path
|
||||||
|
remote_path = remote_path + '/' + os.path.basename(dirName)
|
||||||
|
else: # assume windows path or UNF path
|
||||||
|
remote_path = remote_path + '\\' + os.path.basename(dirName)
|
||||||
|
|
||||||
# configure SB params to pass
|
# configure SB params to pass
|
||||||
fork_params['quiet'] = 1
|
fork_params['quiet'] = 1
|
||||||
if inputName is not None:
|
if inputName is not None:
|
||||||
|
@ -119,7 +127,7 @@ class autoProcessTV:
|
||||||
if param in ["dirName", "dir"]:
|
if param in ["dirName", "dir"]:
|
||||||
fork_params[param] = dirName
|
fork_params[param] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
fork_params[param] = os.path.join(remote_path, os.path.basename(dirName))
|
fork_params[param] = remote_path
|
||||||
|
|
||||||
if param == "process_method":
|
if param == "process_method":
|
||||||
if process_method:
|
if process_method:
|
||||||
|
@ -163,7 +171,7 @@ class autoProcessTV:
|
||||||
headers = {"X-Api-Key": apikey}
|
headers = {"X-Api-Key": apikey}
|
||||||
params = {'sortKey': 'series.title', 'page': 1, 'pageSize': 1, 'sortDir': 'asc'}
|
params = {'sortKey': 'series.title', 'page': 1, 'pageSize': 1, 'sortDir': 'asc'}
|
||||||
if remote_path:
|
if remote_path:
|
||||||
data = json.dumps({"name": "DownloadedEpisodesScan", "path": os.path.join(remote_path, os.path.basename(dirName))})
|
data = json.dumps({"name": "DownloadedEpisodesScan", "path": remote_path})
|
||||||
else:
|
else:
|
||||||
data = json.dumps({"name": "DownloadedEpisodesScan", "path": dirName})
|
data = json.dumps({"name": "DownloadedEpisodesScan", "path": dirName})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue