mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
new remote path handling #409
This commit is contained in:
parent
b1d7847c20
commit
d569b5d6d5
14 changed files with 186 additions and 80 deletions
|
@ -45,8 +45,8 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if Couchpotato is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -73,8 +73,8 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if SickBeard is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if NzbDrone is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -125,8 +125,8 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if HeadPhones is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -149,8 +149,8 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if Mylar is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
@ -174,11 +174,16 @@
|
||||||
minSize = 0
|
minSize = 0
|
||||||
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
# Enable/Disable deleteing ignored files (samples and invalid media files)
|
||||||
delete_ignored = 0
|
delete_ignored = 0
|
||||||
##### Set to path where completed downloads are found on remote server for this category
|
##### Enable if Gamez is on a remote server for this category
|
||||||
remote_path =
|
remote_path = 0
|
||||||
##### Set to path where download client places completed downloads locally for this category
|
##### Set to path where download client places completed downloads locally for this category
|
||||||
watch_dir =
|
watch_dir =
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. MountPoints = /volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
mount_points =
|
||||||
|
|
||||||
[Nzb]
|
[Nzb]
|
||||||
###### clientAgent - Supported clients: sabnzbd, nzbget
|
###### clientAgent - Supported clients: sabnzbd, nzbget
|
||||||
clientAgent = sabnzbd
|
clientAgent = sabnzbd
|
||||||
|
|
|
@ -77,8 +77,16 @@
|
||||||
|
|
||||||
# CouchPotatoServer and NZBGet are a different system (0, 1).
|
# CouchPotatoServer and NZBGet are a different system (0, 1).
|
||||||
#
|
#
|
||||||
# Set to path where completed downloads go on the remote CouchPotatoServer.
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
#cpsremote_path =
|
#cpsremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,19 @@
|
||||||
# Set the number of minutes to wait after initiating HeadPhones post-processing to check if the album status has changed.
|
# Set the number of minutes to wait after initiating HeadPhones post-processing to check if the album status has changed.
|
||||||
#hpwait_for=2
|
#hpwait_for=2
|
||||||
|
|
||||||
|
# HeadPhones and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#hpremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## WakeOnLan
|
## WakeOnLan
|
||||||
|
|
||||||
# use WOL (0, 1).
|
# use WOL (0, 1).
|
||||||
|
|
|
@ -70,10 +70,10 @@
|
||||||
# Set the number of minutes to wait after calling the renamer, to check the movie has changed status.
|
# Set the number of minutes to wait after calling the renamer, to check the movie has changed status.
|
||||||
#cpswait_for=2
|
#cpswait_for=2
|
||||||
|
|
||||||
# CouchPotatoServer and NZBGet are a different system (0, 1).
|
# Couchpotato and NZBGet are a different system (0, 1).
|
||||||
#
|
#
|
||||||
# set to 1 if CouchPotato and NZBGet are on a different system, or 0 if on the same system.
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
#remoteCPS = 0
|
#cpsremote_path=0
|
||||||
|
|
||||||
## SickBeard
|
## SickBeard
|
||||||
|
|
||||||
|
@ -124,6 +124,11 @@
|
||||||
# set this to move, copy, hardlin, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default.
|
# set this to move, copy, hardlin, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default.
|
||||||
#sbprocess_method=
|
#sbprocess_method=
|
||||||
|
|
||||||
|
# SickBeard and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#sbremote_path=0
|
||||||
|
|
||||||
## NzbDrone
|
## NzbDrone
|
||||||
|
|
||||||
# NzbDrone script category.
|
# NzbDrone script category.
|
||||||
|
@ -160,6 +165,11 @@
|
||||||
# set to 1 to delete failed, or 0 to leave files in place.
|
# set to 1 to delete failed, or 0 to leave files in place.
|
||||||
#nddelete_failed=0
|
#nddelete_failed=0
|
||||||
|
|
||||||
|
# NzbDrone and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#ndremote_path=0
|
||||||
|
|
||||||
## HeadPhones
|
## HeadPhones
|
||||||
|
|
||||||
# HeadPhones script category.
|
# HeadPhones script category.
|
||||||
|
@ -186,6 +196,11 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#hpweb_root=
|
#hpweb_root=
|
||||||
|
|
||||||
|
# HeadPhones and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#hpremote_path=0
|
||||||
|
|
||||||
## Mylar
|
## Mylar
|
||||||
|
|
||||||
# Mylar script category.
|
# Mylar script category.
|
||||||
|
@ -217,6 +232,11 @@
|
||||||
# Set the number of minutes to wait after calling the force process, to check the issue has changed status.
|
# Set the number of minutes to wait after calling the force process, to check the issue has changed status.
|
||||||
#myswait_for=1
|
#myswait_for=1
|
||||||
|
|
||||||
|
# Mylar and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#myremote_path=0
|
||||||
|
|
||||||
## Gamez
|
## Gamez
|
||||||
|
|
||||||
# Gamez script category.
|
# Gamez script category.
|
||||||
|
@ -248,6 +268,19 @@
|
||||||
# set this if using a reverse proxy.
|
# set this if using a reverse proxy.
|
||||||
#gzweb_root=
|
#gzweb_root=
|
||||||
|
|
||||||
|
# Gamez and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#gzremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
|
@ -362,6 +395,11 @@ def process(inputDirectory, inputName=None, status=0, clientAgent='manual', down
|
||||||
except:
|
except:
|
||||||
extract = 0
|
extract = 0
|
||||||
|
|
||||||
|
if int(section[inputCategory]['remote_path']) and not nzbtomedia.REMOTEPATHS:
|
||||||
|
logger.error('Remote Path is enabled for %s:%s but no Network mount points are defined. Please check your autoProcessMedia.cfg, exiting!' % (
|
||||||
|
sectionName, inputCategory))
|
||||||
|
return -1
|
||||||
|
|
||||||
if extract == 1:
|
if extract == 1:
|
||||||
logger.debug('Checking for archives to extract in directory: %s' % (inputDirectory))
|
logger.debug('Checking for archives to extract in directory: %s' % (inputDirectory))
|
||||||
extractFiles(inputDirectory)
|
extractFiles(inputDirectory)
|
||||||
|
|
|
@ -61,6 +61,19 @@
|
||||||
# set this to where your Mylar completed downloads are.
|
# set this to where your Mylar completed downloads are.
|
||||||
#mywatch_dir=
|
#mywatch_dir=
|
||||||
|
|
||||||
|
# Mylar and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#myremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## WakeOnLan
|
## WakeOnLan
|
||||||
|
|
||||||
# use WOL (0, 1).
|
# use WOL (0, 1).
|
||||||
|
|
|
@ -65,6 +65,19 @@
|
||||||
# set to 1 to delete failed, or 0 to leave files in place.
|
# set to 1 to delete failed, or 0 to leave files in place.
|
||||||
#nddelete_failed=0
|
#nddelete_failed=0
|
||||||
|
|
||||||
|
# NzbDrone and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#ndremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
|
|
|
@ -83,6 +83,19 @@
|
||||||
# set this to move, copy, hardlin, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default.
|
# set this to move, copy, hardlin, symlink as appropriate if you want to over-ride SB defaults. Leave blank to use SB default.
|
||||||
#sbprocess_method=
|
#sbprocess_method=
|
||||||
|
|
||||||
|
# SickBeard and NZBGet are a different system (0, 1).
|
||||||
|
#
|
||||||
|
# Enable to replace local path with the path as per the mountPoints below.
|
||||||
|
#sbremote_path=0
|
||||||
|
|
||||||
|
## Network
|
||||||
|
|
||||||
|
# Network Mount Points (Needed for remote path above)
|
||||||
|
#
|
||||||
|
# Enter Mount points as LocalPath,RemotePath and separate each pair with '|'
|
||||||
|
# e.g. mountPoints=/volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
#mountPoints=
|
||||||
|
|
||||||
## Extensions
|
## Extensions
|
||||||
|
|
||||||
# Media Extensions
|
# Media Extensions
|
||||||
|
|
|
@ -91,6 +91,8 @@ NOFLATTEN = []
|
||||||
DELETE_ORIGINAL = None
|
DELETE_ORIGINAL = None
|
||||||
TORRENT_DEFAULTDIR = None
|
TORRENT_DEFAULTDIR = None
|
||||||
|
|
||||||
|
REMOTEPATHS = None
|
||||||
|
|
||||||
UTORRENTWEBUI = None
|
UTORRENTWEBUI = None
|
||||||
UTORRENTUSR = None
|
UTORRENTUSR = None
|
||||||
UTORRENTPWD = None
|
UTORRENTPWD = None
|
||||||
|
@ -162,7 +164,7 @@ def initialize(section=None):
|
||||||
NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \
|
NICENESS, LOG_DEBUG, FORCE_CLEAN, FFMPEG_PATH, FFMPEG, FFPROBE, AUDIOCONTAINER, EXTCONTAINER, TORRENT_CLASS, \
|
||||||
DELETE_ORIGINAL, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \
|
DELETE_ORIGINAL, PASSWORDSFILE, USER_DELAY, USER_SCRIPT, USER_SCRIPT_CLEAN, USER_SCRIPT_MEDIAEXTENSIONS, \
|
||||||
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, EXT_REPLACE, CHECK_MEDIA, SAFE_MODE, \
|
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, EXT_REPLACE, CHECK_MEDIA, SAFE_MODE, \
|
||||||
TORRENT_DEFAULTDIR, NZB_DEFAULTDIR
|
TORRENT_DEFAULTDIR, NZB_DEFAULTDIR, REMOTEPATHS
|
||||||
|
|
||||||
if __INITIALIZED__:
|
if __INITIALIZED__:
|
||||||
return False
|
return False
|
||||||
|
@ -280,6 +282,10 @@ def initialize(section=None):
|
||||||
DELUGEUSR = CFG["Torrent"]["DelugeUSR"] # mysecretusr
|
DELUGEUSR = CFG["Torrent"]["DelugeUSR"] # mysecretusr
|
||||||
DELUGEPWD = CFG["Torrent"]["DelugePWD"] # mysecretpwr
|
DELUGEPWD = CFG["Torrent"]["DelugePWD"] # mysecretpwr
|
||||||
|
|
||||||
|
REMOTEPATHS = CFG["Network"]["mount_points"] or None
|
||||||
|
if REMOTEPATHS:
|
||||||
|
REMOTEPATHS = [ tuple(item.split(',')) for item in REMOTEPATHS.split('|') ] # /volume1/Public/,E:\|/volume2/share/,\\NAS\
|
||||||
|
|
||||||
COMPRESSEDCONTAINER = [re.compile('.r\d{2}$', re.I),
|
COMPRESSEDCONTAINER = [re.compile('.r\d{2}$', re.I),
|
||||||
re.compile('.part\d+.rar$', re.I),
|
re.compile('.part\d+.rar$', re.I),
|
||||||
re.compile('.rar$', re.I)]
|
re.compile('.rar$', re.I)]
|
||||||
|
|
|
@ -3,7 +3,7 @@ import time
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
import requests
|
import requests
|
||||||
import time
|
import time
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, replaceExtensions
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, replaceExtensions, remoteDir
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessComics:
|
class autoProcessComics:
|
||||||
|
@ -51,28 +51,20 @@ class autoProcessComics:
|
||||||
except:
|
except:
|
||||||
web_root = ""
|
web_root = ""
|
||||||
try:
|
try:
|
||||||
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
remote_path = int(nzbtomedia.CFG[section][inputCategory]["remote_path"])
|
||||||
except:
|
except:
|
||||||
remote_path = None
|
remote_path = 0
|
||||||
|
|
||||||
inputName, dirName = convert_to_ascii(inputName, dirName)
|
inputName, dirName = convert_to_ascii(inputName, dirName)
|
||||||
|
|
||||||
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
|
params['nzb_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['nzb_folder'] = remote_path
|
params['nzb_folder'] = remoteDir(dirName)
|
||||||
|
|
||||||
if inputName != None:
|
if inputName != None:
|
||||||
params['nzb_name'] = inputName
|
params['nzb_name'] = inputName
|
||||||
|
|
|
@ -4,7 +4,7 @@ import requests
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
|
|
||||||
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, rmDir, find_imdbid, find_download, listMediaFiles
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, rmDir, find_imdbid, find_download, listMediaFiles, remoteDir
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
from nzbtomedia.transcoder import transcoder
|
from nzbtomedia.transcoder import transcoder
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ class autoProcessMovie:
|
||||||
except:
|
except:
|
||||||
web_root = ""
|
web_root = ""
|
||||||
try:
|
try:
|
||||||
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
remote_path = int(nzbtomedia.CFG[section][inputCategory]["remote_path"])
|
||||||
except:
|
except:
|
||||||
remote_path = None
|
remote_path = 0
|
||||||
|
|
||||||
if ssl:
|
if ssl:
|
||||||
protocol = "https://"
|
protocol = "https://"
|
||||||
|
@ -145,14 +145,6 @@ 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)
|
||||||
|
@ -173,7 +165,7 @@ class autoProcessMovie:
|
||||||
|
|
||||||
params['media_folder'] = dirName
|
params['media_folder'] = dirName
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['media_folder'] = remote_path
|
params['media_folder'] = remoteDir(dirName)
|
||||||
|
|
||||||
url = "%s%s" % (baseURL, command)
|
url = "%s%s" % (baseURL, command)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import time
|
||||||
import requests
|
import requests
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
|
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, remoteDir
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessMusic:
|
class autoProcessMusic:
|
||||||
|
@ -47,9 +47,9 @@ class autoProcessMusic:
|
||||||
web_root = ""
|
web_root = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
remote_path = int(nzbtomedia.CFG[section][inputCategory]["remote_path"])
|
||||||
except:
|
except:
|
||||||
remote_path = None
|
remote_path = 0
|
||||||
|
|
||||||
if ssl:
|
if ssl:
|
||||||
protocol = "https://"
|
protocol = "https://"
|
||||||
|
@ -58,14 +58,6 @@ 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:
|
||||||
|
@ -76,7 +68,7 @@ class autoProcessMusic:
|
||||||
|
|
||||||
params['dir'] = os.path.dirname(dirName)
|
params['dir'] = os.path.dirname(dirName)
|
||||||
if remote_path:
|
if remote_path:
|
||||||
params['dir'] = remote_path
|
params['dir'] = remoteDir(dirName)
|
||||||
|
|
||||||
release_status = self.get_status(url, apikey, dirName)
|
release_status = self.get_status(url, apikey, dirName)
|
||||||
if not release_status:
|
if not release_status:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import nzbtomedia
|
||||||
|
|
||||||
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
from nzbtomedia.nzbToMediaAutoFork import autoFork
|
||||||
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
||||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, flatten, rmDir, listMediaFiles
|
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, flatten, rmDir, listMediaFiles, remoteDir
|
||||||
from nzbtomedia import logger
|
from nzbtomedia import logger
|
||||||
from nzbtomedia.transcoder import transcoder
|
from nzbtomedia.transcoder import transcoder
|
||||||
|
|
||||||
|
@ -73,9 +73,9 @@ class autoProcessTV:
|
||||||
except:
|
except:
|
||||||
process_method = None
|
process_method = None
|
||||||
try:
|
try:
|
||||||
remote_path = nzbtomedia.CFG[section][inputCategory]["remote_path"]
|
remote_path = int(nzbtomedia.CFG[section][inputCategory]["remote_path"])
|
||||||
except:
|
except:
|
||||||
remote_path = None
|
remote_path = 0
|
||||||
try:
|
try:
|
||||||
wait_for = int(nzbtomedia.CFG[section][inputCategory]["wait_for"])
|
wait_for = int(nzbtomedia.CFG[section][inputCategory]["wait_for"])
|
||||||
except:
|
except:
|
||||||
|
@ -107,14 +107,6 @@ 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:
|
||||||
|
@ -127,7 +119,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] = remote_path
|
fork_params[param] = remoteDir(dirName)
|
||||||
|
|
||||||
if param == "process_method":
|
if param == "process_method":
|
||||||
if process_method:
|
if process_method:
|
||||||
|
|
|
@ -172,7 +172,11 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
if option == "forceClean":
|
if option == "forceClean":
|
||||||
CFG_NEW['General']['force_clean'] = value
|
CFG_NEW['General']['force_clean'] = value
|
||||||
values.pop(option)
|
values.pop(option)
|
||||||
|
if option == "remote_path":
|
||||||
|
if value and not isinstance(value, int):
|
||||||
|
value = 1
|
||||||
|
elif not value:
|
||||||
|
value = 0
|
||||||
# remove any options that we no longer need so they don't migrate into our new config
|
# remove any options that we no longer need so they don't migrate into our new config
|
||||||
if not list(ConfigObj.find_key(CFG_NEW, option)):
|
if not list(ConfigObj.find_key(CFG_NEW, option)):
|
||||||
values.pop(option)
|
values.pop(option)
|
||||||
|
@ -247,10 +251,20 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
value = os.environ[key]
|
value = os.environ[key]
|
||||||
CFG_NEW[section][option] = value
|
CFG_NEW[section][option] = value
|
||||||
|
|
||||||
|
section = "Network"
|
||||||
|
envKeys = ['MOUNTPOINTS']
|
||||||
|
cfgKeys = ['mount_points']
|
||||||
|
for index in range(len(envKeys)):
|
||||||
|
key = 'NZBPO_' + envKeys[index]
|
||||||
|
if os.environ.has_key(key):
|
||||||
|
option = cfgKeys[index]
|
||||||
|
value = os.environ[key]
|
||||||
|
CFG_NEW[section][option] = value
|
||||||
|
|
||||||
section = "CouchPotato"
|
section = "CouchPotato"
|
||||||
envCatKey = 'NZBPO_CPSCATEGORY'
|
envCatKey = 'NZBPO_CPSCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'METHOD', 'DELETE_FAILED', 'REMOTECPS', 'WAIT_FOR', 'WATCH_DIR']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'METHOD', 'DELETE_FAILED', 'REMOTE_PATH' 'WAIT_FOR', 'WATCH_DIR']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'method', 'delete_failed', 'remoteCPS', 'wait_for', 'watch_dir']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'method', 'delete_failed', 'remote_path', 'wait_for', 'watch_dir']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_CPS' + envKeys[index]
|
key = 'NZBPO_CPS' + envKeys[index]
|
||||||
|
@ -264,8 +278,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "SickBeard"
|
section = "SickBeard"
|
||||||
envCatKey = 'NZBPO_SBCATEGORY'
|
envCatKey = 'NZBPO_SBCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY']
|
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'REMOTE_PATH']
|
||||||
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy']
|
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy', 'remote_path']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_SB' + envKeys[index]
|
key = 'NZBPO_SB' + envKeys[index]
|
||||||
|
@ -279,8 +293,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "HeadPhones"
|
section = "HeadPhones"
|
||||||
envCatKey = 'NZBPO_HPCATEGORY'
|
envCatKey = 'NZBPO_HPCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WAIT_FOR', 'WATCH_DIR']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WAIT_FOR', 'WATCH_DIR', 'REMOTE_PATH']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'wait_for', 'watch_dir']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'wait_for', 'watch_dir', 'remote_path']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_HP' + envKeys[index]
|
key = 'NZBPO_HP' + envKeys[index]
|
||||||
|
@ -294,8 +308,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "Mylar"
|
section = "Mylar"
|
||||||
envCatKey = 'NZBPO_MYCATEGORY'
|
envCatKey = 'NZBPO_MYCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR']
|
envKeys = ['ENABLED', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'REMOTE_PATH']
|
||||||
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir']
|
cfgKeys = ['enabled', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'remote_path']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_MY' + envKeys[index]
|
key = 'NZBPO_MY' + envKeys[index]
|
||||||
|
@ -309,8 +323,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "Gamez"
|
section = "Gamez"
|
||||||
envCatKey = 'NZBPO_GZCATEGORY'
|
envCatKey = 'NZBPO_GZCATEGORY'
|
||||||
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'LIBRARY']
|
envKeys = ['ENABLED', 'APIKEY', 'HOST', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'LIBRARY', 'REMOTE_PATH']
|
||||||
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'watch_dir', 'library']
|
cfgKeys = ['enabled', 'apikey', 'host', 'port', 'ssl', 'web_root', 'watch_dir', 'library', 'remote_path']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_GZ' + envKeys[index]
|
key = 'NZBPO_GZ' + envKeys[index]
|
||||||
|
@ -324,8 +338,8 @@ class ConfigObj(configobj.ConfigObj, Section):
|
||||||
|
|
||||||
section = "NzbDrone"
|
section = "NzbDrone"
|
||||||
envCatKey = 'NZBPO_NDCATEGORY'
|
envCatKey = 'NZBPO_NDCATEGORY'
|
||||||
envKeys = ['ENABLED', 'HOST', 'APIKEY', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED']
|
envKeys = ['ENABLED', 'HOST', 'APIKEY', 'PORT', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'TORRENT_NOLINK', 'NZBEXTRACTIONBY', 'WAIT_FOR', 'DELETE_FAILED', 'REMOTE_PATH']
|
||||||
cfgKeys = ['enabled', 'host', 'apikey', 'port', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed']
|
cfgKeys = ['enabled', 'host', 'apikey', 'port', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'Torrent_NoLink', 'nzbExtractionBy', 'wait_for', 'delete_failed', 'remote_path']
|
||||||
if os.environ.has_key(envCatKey):
|
if os.environ.has_key(envCatKey):
|
||||||
for index in range(len(envKeys)):
|
for index in range(len(envKeys)):
|
||||||
key = 'NZBPO_ND' + envKeys[index]
|
key = 'NZBPO_ND' + envKeys[index]
|
||||||
|
|
|
@ -31,7 +31,7 @@ def sanitizeName(name):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# remove bad chars from the filename
|
# remove bad chars from the filename
|
||||||
name = re.sub(r'[\\/\*]', '-', name)
|
name = re.sub(r'[\\\/*]', '-', name)
|
||||||
name = re.sub(r'[:"<>|?]', '', name)
|
name = re.sub(r'[:"<>|?]', '', name)
|
||||||
|
|
||||||
# remove leading/trailing periods and spaces
|
# remove leading/trailing periods and spaces
|
||||||
|
@ -62,6 +62,21 @@ def makeDir(path):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def remoteDir(path):
|
||||||
|
for local,remote in nzbtomedia.REMOTEPATHS:
|
||||||
|
if local in path:
|
||||||
|
base_dirs = path.replace(local,"").split(os.sep)
|
||||||
|
if '/' in remote:
|
||||||
|
remote_sep = '/'
|
||||||
|
else:
|
||||||
|
remote_sep = '\\'
|
||||||
|
new_path = remote_sep.join([remote] + base_dirs)
|
||||||
|
new_path = re.sub(r'(\S)(\\+)', r'\1\\', new_path)
|
||||||
|
new_path = re.sub(r'(\/+)', r'/', new_path)
|
||||||
|
new_path = re.sub(r'([\/\\])$', r'', new_path)
|
||||||
|
return new_path
|
||||||
|
return path
|
||||||
|
|
||||||
def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
tordir = False
|
tordir = False
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue