mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 21:03:14 -07:00
Fixed a few bugs and made a few more improvements
This commit is contained in:
parent
3db20ab072
commit
2be1873cad
3 changed files with 39 additions and 39 deletions
|
@ -44,17 +44,16 @@ CONFIG_TV_FILE = None
|
||||||
SYS_ENCODING = None
|
SYS_ENCODING = None
|
||||||
SYS_ARGV = None
|
SYS_ARGV = None
|
||||||
|
|
||||||
# version constants
|
|
||||||
AUTO_UPDATE = None
|
AUTO_UPDATE = None
|
||||||
NZBTOMEDIA_VERSION = None
|
NZBTOMEDIA_VERSION = None
|
||||||
NEWEST_VERSION = None
|
NEWEST_VERSION = None
|
||||||
NEWEST_VERSION_STRING = None
|
NEWEST_VERSION_STRING = None
|
||||||
VERSION_NOTIFY = None
|
VERSION_NOTIFY = None
|
||||||
|
|
||||||
GIT_PATH = None
|
GIT_PATH = None
|
||||||
GIT_USER = None
|
GIT_USER = None
|
||||||
GIT_BRANCH = None
|
GIT_BRANCH = None
|
||||||
GIT_REPO = None
|
GIT_REPO = None
|
||||||
|
FORCE_CLEAN = None
|
||||||
|
|
||||||
NZB_CLIENTAGENT = None
|
NZB_CLIENTAGENT = None
|
||||||
SABNZBDHOST = None
|
SABNZBDHOST = None
|
||||||
|
@ -82,7 +81,6 @@ DELUGEUSR = None
|
||||||
DELUGEPWD = None
|
DELUGEPWD = None
|
||||||
|
|
||||||
COMPRESSEDCONTAINER = None
|
COMPRESSEDCONTAINER = None
|
||||||
MEDIAEXTENSIONS = None
|
|
||||||
MEDIACONTAINER = None
|
MEDIACONTAINER = None
|
||||||
METACONTAINER = None
|
METACONTAINER = None
|
||||||
MINSAMPLESIZE = None
|
MINSAMPLESIZE = None
|
||||||
|
@ -105,6 +103,7 @@ OUTPUTSUBTITLECODEC = None
|
||||||
OUTPUTFASTSTART = None
|
OUTPUTFASTSTART = None
|
||||||
OUTPUTQUALITYPERCENT = None
|
OUTPUTQUALITYPERCENT = None
|
||||||
NICENESS = None
|
NICENESS = None
|
||||||
|
|
||||||
USER_SCRIPT_CATEGORIES = None
|
USER_SCRIPT_CATEGORIES = None
|
||||||
USER_SCRIPT_MEDIAEXTENSIONS = None
|
USER_SCRIPT_MEDIAEXTENSIONS = None
|
||||||
USER_SCRIPT = None
|
USER_SCRIPT = None
|
||||||
|
@ -130,7 +129,7 @@ def initialize(section=None):
|
||||||
TRANSCODE, GIT_PATH, GIT_USER, GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
TRANSCODE, GIT_PATH, GIT_USER, GIT_BRANCH, GIT_REPO, SYS_ENCODING, NZB_CLIENTAGENT, SABNZBDHOST, SABNZBDPORT, SABNZBDAPIKEY, \
|
||||||
DUPLICATE, IGNOREEXTENSIONS, OUTPUTVIDEOEXTENSION, OUTPUTVIDEOCODEC, OUTPUTVIDEOPRESET, OUTPUTVIDEOFRAMERATE, \
|
DUPLICATE, IGNOREEXTENSIONS, OUTPUTVIDEOEXTENSION, OUTPUTVIDEOCODEC, OUTPUTVIDEOPRESET, OUTPUTVIDEOFRAMERATE, \
|
||||||
OUTPUTVIDEOBITRATE, OUTPUTAUDIOCODEC, OUTPUTAUDIOBITRATE, OUTPUTSUBTITLECODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, \
|
OUTPUTVIDEOBITRATE, OUTPUTAUDIOCODEC, OUTPUTAUDIOBITRATE, OUTPUTSUBTITLECODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, \
|
||||||
NICENESS, MEDIAEXTENSIONS, LOG_DEBUG
|
NICENESS, LOG_DEBUG, FORCE_CLEAN
|
||||||
|
|
||||||
if __INITIALIZED__:
|
if __INITIALIZED__:
|
||||||
return False
|
return False
|
||||||
|
@ -190,7 +189,7 @@ def initialize(section=None):
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
# load newly migrated config
|
# load newly migrated config
|
||||||
logger.info("Loading config from %s" % CONFIG_FILE)
|
logger.info("Loading config from [%s]" % (CONFIG_FILE))
|
||||||
CFG = config()
|
CFG = config()
|
||||||
|
|
||||||
# Enable/Disable DEBUG Logging
|
# Enable/Disable DEBUG Logging
|
||||||
|
@ -200,10 +199,11 @@ def initialize(section=None):
|
||||||
NZBTOMEDIA_VERSION = '9.3'
|
NZBTOMEDIA_VERSION = '9.3'
|
||||||
VERSION_NOTIFY = int(CFG['General']['version_notify'])
|
VERSION_NOTIFY = int(CFG['General']['version_notify'])
|
||||||
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
AUTO_UPDATE = int(CFG['General']['auto_update'])
|
||||||
|
GIT_REPO = 'nzbToMedia'
|
||||||
GIT_PATH = CFG['General']['git_path']
|
GIT_PATH = CFG['General']['git_path']
|
||||||
GIT_USER = CFG['General']['git_user'] or 'clinton-hall'
|
GIT_USER = CFG['General']['git_user'] or 'clinton-hall'
|
||||||
GIT_BRANCH = CFG['General']['git_branch'] or 'dev'
|
GIT_BRANCH = CFG['General']['git_branch'] or 'dev'
|
||||||
GIT_REPO = 'nzbToMedia'
|
FORCE_CLEAN = CFG["General"]["force_clean"]
|
||||||
|
|
||||||
# Check for updates via GitHUB
|
# Check for updates via GitHUB
|
||||||
if versionCheck.CheckVersion().check_for_new_version():
|
if versionCheck.CheckVersion().check_for_new_version():
|
||||||
|
@ -247,11 +247,11 @@ def initialize(section=None):
|
||||||
DELUGEPWD = CFG["Torrent"]["DelugePWD"] # mysecretpwr
|
DELUGEPWD = CFG["Torrent"]["DelugePWD"] # mysecretpwr
|
||||||
|
|
||||||
COMPRESSEDCONTAINER = (CFG["Extensions"]["compressedExtensions"]) # .zip,.rar,.7z
|
COMPRESSEDCONTAINER = (CFG["Extensions"]["compressedExtensions"]) # .zip,.rar,.7z
|
||||||
MEDIAEXTENSIONS = [ 'mkv', 'avi', 'divx', 'xvid', 'mov', 'wmv','mp4', 'mpg', 'mpeg', 'iso' ]
|
|
||||||
MEDIACONTAINER = (CFG["Extensions"]["mediaExtensions"]) # .mkv,.avi,.divx
|
MEDIACONTAINER = (CFG["Extensions"]["mediaExtensions"]) # .mkv,.avi,.divx
|
||||||
METACONTAINER = (CFG["Extensions"]["metaExtensions"]) # .nfo,.sub,.srt
|
METACONTAINER = (CFG["Extensions"]["metaExtensions"]) # .nfo,.sub,.srt
|
||||||
MINSAMPLESIZE = int(CFG["Extensions"]["minSampleSize"]) # 200 (in MB)
|
MINSAMPLESIZE = int(CFG["Extensions"]["minSampleSize"]) # 200 (in MB)
|
||||||
SAMPLEIDS = (CFG["Extensions"]["SampleIDs"]) # sample,-s.
|
SAMPLEIDS = (CFG["Extensions"]["SampleIDs"]) # sample,-s.
|
||||||
|
|
||||||
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
TRANSCODE = int(CFG["Transcoder"]["transcode"])
|
||||||
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
DUPLICATE = int(CFG["Transcoder"]["duplicate"])
|
||||||
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
IGNOREEXTENSIONS = (CFG["Transcoder"]["ignoreExtensions"])
|
||||||
|
@ -267,14 +267,6 @@ def initialize(section=None):
|
||||||
OUTPUTQUALITYPERCENT = int(CFG["Transcoder"]["outputQualityPercent"])
|
OUTPUTQUALITYPERCENT = int(CFG["Transcoder"]["outputQualityPercent"])
|
||||||
NICENESS = int(CFG["Transcoder"]["niceness"])
|
NICENESS = int(CFG["Transcoder"]["niceness"])
|
||||||
|
|
||||||
# check for script-defied section and if None set to allow sections
|
|
||||||
SECTIONS = ("CouchPotato", "SickBeard", "NzbDrone", "HeadPhones", "Mylar", "Gamez")
|
|
||||||
if section:
|
|
||||||
SECTIONS = (section,)
|
|
||||||
|
|
||||||
SUBSECTIONS = CFG[SECTIONS]
|
|
||||||
CATEGORIES += SUBSECTIONS.sections
|
|
||||||
|
|
||||||
USER_SCRIPT_CATEGORIES = CFG["UserScript"]["user_script_categories"]
|
USER_SCRIPT_CATEGORIES = CFG["UserScript"]["user_script_categories"]
|
||||||
if not "NONE" in USER_SCRIPT_CATEGORIES:
|
if not "NONE" in USER_SCRIPT_CATEGORIES:
|
||||||
USER_SCRIPT_MEDIAEXTENSIONS = (CFG["UserScript"]["user_script_mediaExtensions"])
|
USER_SCRIPT_MEDIAEXTENSIONS = (CFG["UserScript"]["user_script_mediaExtensions"])
|
||||||
|
@ -285,6 +277,13 @@ def initialize(section=None):
|
||||||
USER_DELAY = int(CFG["UserScript"]["delay"])
|
USER_DELAY = int(CFG["UserScript"]["delay"])
|
||||||
USER_SCRIPT_RUNONCE = int(CFG["UserScript"]["user_script_runOnce"])
|
USER_SCRIPT_RUNONCE = int(CFG["UserScript"]["user_script_runOnce"])
|
||||||
|
|
||||||
|
# check for script-defied section and if None set to allow sections
|
||||||
|
SECTIONS = ("CouchPotato", "SickBeard", "NzbDrone", "HeadPhones", "Mylar", "Gamez")
|
||||||
|
if section:SECTIONS = (section,)
|
||||||
|
|
||||||
|
SUBSECTIONS = CFG[SECTIONS]
|
||||||
|
CATEGORIES += SUBSECTIONS.sections
|
||||||
|
|
||||||
__INITIALIZED__ = True
|
__INITIALIZED__ = True
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
inputCategory = list(set(pathlist) & set(categories))[-1] # assume last match is most relevant category.
|
inputCategory = list(set(pathlist) & set(categories))[-1] # assume last match is most relevant category.
|
||||||
logger.debug("SEARCH: Found Category: %s in directory structure", inputCategory)
|
logger.debug("SEARCH: Found Category: %s in directory structure" % (inputCategory))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
inputCategory = ""
|
inputCategory = ""
|
||||||
logger.debug("SEARCH: Could not find a category in the directory structure")
|
logger.debug("SEARCH: Could not find a category in the directory structure")
|
||||||
|
@ -53,17 +53,17 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
logger.info(
|
logger.info(
|
||||||
"SEARCH: Found category directory %s in input directory directory %s" % (inputCategory, inputDirectory))
|
"SEARCH: Found category directory %s in input directory directory %s" % (inputCategory, inputDirectory))
|
||||||
inputDirectory = os.path.join(inputDirectory, inputCategory)
|
inputDirectory = os.path.join(inputDirectory, inputCategory)
|
||||||
logger.info("SEARCH: Setting inputDirectory to %s", inputDirectory)
|
logger.info("SEARCH: Setting inputDirectory to %s" % (inputDirectory))
|
||||||
if inputName and os.path.isdir(os.path.join(inputDirectory, inputName)):
|
if inputName and os.path.isdir(os.path.join(inputDirectory, inputName)):
|
||||||
logger.info("SEARCH: Found torrent directory %s in input directory directory %s" % (inputName, inputDirectory))
|
logger.info("SEARCH: Found torrent directory %s in input directory directory %s" % (inputName, inputDirectory))
|
||||||
inputDirectory = os.path.join(inputDirectory, inputName)
|
inputDirectory = os.path.join(inputDirectory, inputName)
|
||||||
logger.info("SEARCH: Setting inputDirectory to %s", inputDirectory)
|
logger.info("SEARCH: Setting inputDirectory to %s" % (inputDirectory))
|
||||||
tordir = True
|
tordir = True
|
||||||
if inputName and os.path.isdir(os.path.join(inputDirectory, safeName(inputName))):
|
if inputName and os.path.isdir(os.path.join(inputDirectory, safeName(inputName))):
|
||||||
logger.info("SEARCH: Found torrent directory %s in input directory directory %s" % (
|
logger.info("SEARCH: Found torrent directory %s in input directory directory %s" % (
|
||||||
safeName(inputName), inputDirectory))
|
safeName(inputName), inputDirectory))
|
||||||
inputDirectory = os.path.join(inputDirectory, safeName(inputName))
|
inputDirectory = os.path.join(inputDirectory, safeName(inputName))
|
||||||
logger.info("SEARCH: Setting inputDirectory to %s", inputDirectory)
|
logger.info("SEARCH: Setting inputDirectory to %s" % (inputDirectory))
|
||||||
tordir = True
|
tordir = True
|
||||||
|
|
||||||
imdbid = [item for item in pathlist if '.cp(tt' in item] # This looks for the .cp(tt imdb id in the path.
|
imdbid = [item for item in pathlist if '.cp(tt' in item] # This looks for the .cp(tt imdb id in the path.
|
||||||
|
@ -76,14 +76,14 @@ def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
index = pathlist.index(inputCategory)
|
index = pathlist.index(inputCategory)
|
||||||
if index + 1 < len(pathlist):
|
if index + 1 < len(pathlist):
|
||||||
tordir = True
|
tordir = True
|
||||||
logger.info("SEARCH: Found a unique directory %s in the category directory", pathlist[index + 1])
|
logger.info("SEARCH: Found a unique directory %s in the category directory" % (pathlist[index + 1]))
|
||||||
if not inputName: inputName = pathlist[index + 1]
|
if not inputName: inputName = pathlist[index + 1]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if inputName and not tordir:
|
if inputName and not tordir:
|
||||||
if inputName in pathlist or safeName(inputName) in pathlist:
|
if inputName in pathlist or safeName(inputName) in pathlist:
|
||||||
logger.info("SEARCH: Found torrent directory %s in the directory structure", inputName)
|
logger.info("SEARCH: Found torrent directory %s in the directory structure" % (inputName))
|
||||||
tordir = True
|
tordir = True
|
||||||
else:
|
else:
|
||||||
root = 1
|
root = 1
|
||||||
|
@ -155,7 +155,7 @@ def copy_link(filePath, targetDirectory, useLink, outputDestination):
|
||||||
|
|
||||||
|
|
||||||
def flatten(outputDestination):
|
def flatten(outputDestination):
|
||||||
logger.info("FLATTEN: Flattening directory: %s", outputDestination)
|
logger.info("FLATTEN: Flattening directory: %s" % (outputDestination))
|
||||||
for dirpath, dirnames, filenames in os.walk(
|
for dirpath, dirnames, filenames in os.walk(
|
||||||
outputDestination): # Flatten out the directory to make postprocessing easier
|
outputDestination): # Flatten out the directory to make postprocessing easier
|
||||||
if dirpath == outputDestination:
|
if dirpath == outputDestination:
|
||||||
|
@ -166,12 +166,12 @@ def flatten(outputDestination):
|
||||||
try:
|
try:
|
||||||
shutil.move(source, target)
|
shutil.move(source, target)
|
||||||
except:
|
except:
|
||||||
logger.error("FLATTEN: Could not flatten %s", source)
|
logger.error("FLATTEN: Could not flatten %s" % (source))
|
||||||
removeEmptyFolders(outputDestination) # Cleanup empty directories
|
removeEmptyFolders(outputDestination) # Cleanup empty directories
|
||||||
|
|
||||||
|
|
||||||
def removeEmptyFolders(path):
|
def removeEmptyFolders(path):
|
||||||
logger.info("REMOVER: Removing empty folders in: %s", path)
|
logger.info("REMOVER: Removing empty folders in: %s" % (path))
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ def removeEmptyFolders(path):
|
||||||
# If folder empty, delete it
|
# If folder empty, delete it
|
||||||
files = os.listdir(path)
|
files = os.listdir(path)
|
||||||
if len(files) == 0:
|
if len(files) == 0:
|
||||||
logger.debug("REMOVER: Removing empty folder: %s", path)
|
logger.debug("REMOVER: Removing empty folder: %s" % (path))
|
||||||
os.rmdir(path)
|
os.rmdir(path)
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ def remove_read_only(path):
|
||||||
return
|
return
|
||||||
for dirpath, dirnames, filenames in os.walk(path):
|
for dirpath, dirnames, filenames in os.walk(path):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
logger.debug("Removing Read Only Flag for: %s", filename)
|
logger.debug("Removing Read Only Flag for: %s" % (filename))
|
||||||
os.chmod(os.path.join(dirpath, filename), stat.S_IWRITE)
|
os.chmod(os.path.join(dirpath, filename), stat.S_IWRITE)
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,23 +234,23 @@ def WakeUp():
|
||||||
wake = int(nzbtomedia.CFG["WakeOnLan"]["wake"])
|
wake = int(nzbtomedia.CFG["WakeOnLan"]["wake"])
|
||||||
if wake == 0: # just return if we don't need to wake anything.
|
if wake == 0: # just return if we don't need to wake anything.
|
||||||
return
|
return
|
||||||
logger.info(("Loading WakeOnLan config from %s", nzbtomedia.CONFIG_FILE))
|
logger.info(("Loading WakeOnLan config from %s" % (nzbtomedia.CONFIG_FILE)))
|
||||||
host = nzbtomedia.CFG["WakeOnLan"]["host"]
|
host = nzbtomedia.CFG["WakeOnLan"]["host"]
|
||||||
port = int(nzbtomedia.CFG["WakeOnLan"]["port"])
|
port = int(nzbtomedia.CFG["WakeOnLan"]["port"])
|
||||||
mac = nzbtomedia.CFG["WakeOnLan"]["mac"]
|
mac = nzbtomedia.CFG["WakeOnLan"]["mac"]
|
||||||
|
|
||||||
i = 1
|
i = 1
|
||||||
while TestCon(host, port) == "Down" and i < 4:
|
while TestCon(host, port) == "Down" and i < 4:
|
||||||
logger.info(("Sending WakeOnLan Magic Packet for mac: %s", mac))
|
logger.info(("Sending WakeOnLan Magic Packet for mac: %s" % (mac)))
|
||||||
WakeOnLan(mac)
|
WakeOnLan(mac)
|
||||||
time.sleep(20)
|
time.sleep(20)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
|
||||||
if TestCon(host, port) == "Down": # final check.
|
if TestCon(host, port) == "Down": # final check.
|
||||||
logger.warning("System with mac: %s has not woken after 3 attempts. Continuing with the rest of the script.",
|
logger.warning("System with mac: %s has not woken after 3 attempts. Continuing with the rest of the script." % (
|
||||||
mac)
|
mac))
|
||||||
else:
|
else:
|
||||||
logger.info("System with mac: %s has been woken. Continuing with the rest of the script.", mac)
|
logger.info("System with mac: %s has been woken. Continuing with the rest of the script." % (mac))
|
||||||
|
|
||||||
|
|
||||||
def convert_to_ascii(nzbName, dirName):
|
def convert_to_ascii(nzbName, dirName):
|
||||||
|
@ -375,7 +375,7 @@ def get_dirnames(section, subsections=None):
|
||||||
watch_dir = None
|
watch_dir = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
outputDirectory = os.path.join(nzbtomedia.CFG["Torrent"]["outputDirectory"], subsection)
|
outputDirectory = os.path.join(nzbtomedia.OUTPUTDIRECTORY, subsection)
|
||||||
if not os.path.exists(outputDirectory):
|
if not os.path.exists(outputDirectory):
|
||||||
outputDirectory = None
|
outputDirectory = None
|
||||||
except:
|
except:
|
||||||
|
@ -414,11 +414,11 @@ def get_dirnames(section, subsections=None):
|
||||||
|
|
||||||
|
|
||||||
def delete(dirName):
|
def delete(dirName):
|
||||||
logger.info("Deleting %s", dirName)
|
logger.info("Deleting %s" % (dirName))
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(dirName, True)
|
shutil.rmtree(dirName, True)
|
||||||
except:
|
except:
|
||||||
logger.error("Unable to delete folder %s", dirName)
|
logger.error("Unable to delete folder %s" % (dirName))
|
||||||
|
|
||||||
|
|
||||||
def cleanup_directories(inputCategory, processCategories, result, directory):
|
def cleanup_directories(inputCategory, processCategories, result, directory):
|
||||||
|
@ -433,14 +433,14 @@ def cleanup_directories(inputCategory, processCategories, result, directory):
|
||||||
num_files_new += 1
|
num_files_new += 1
|
||||||
file_list.append(file)
|
file_list.append(file)
|
||||||
if num_files_new is 0 or int(nzbtomedia.CFG["General"]["force_clean"]) == 1:
|
if num_files_new is 0 or int(nzbtomedia.CFG["General"]["force_clean"]) == 1:
|
||||||
logger.info("All files have been processed. Cleaning directory %s", directory)
|
logger.info("All files have been processed. Cleaning directory %s" % (directory))
|
||||||
shutil.rmtree(directory)
|
shutil.rmtree(directory)
|
||||||
else:
|
else:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Directory %s still contains %s media and/or meta files. This directory will not be removed." % (
|
"Directory %s still contains %s media and/or meta files. This directory will not be removed." % (
|
||||||
directory, num_files_new))
|
directory, num_files_new))
|
||||||
for item in file_list:
|
for item in file_list:
|
||||||
logger.debug("media/meta file found: %s", item)
|
logger.debug("media/meta file found: %s" % (item))
|
||||||
|
|
||||||
|
|
||||||
def create_torrent_class(clientAgent):
|
def create_torrent_class(clientAgent):
|
||||||
|
@ -516,7 +516,7 @@ def resume_torrent(clientAgent, TorrentClass, inputHash, inputID, result, inputN
|
||||||
def find_download(clientAgent, download_id):
|
def find_download(clientAgent, download_id):
|
||||||
tc = create_torrent_class(clientAgent)
|
tc = create_torrent_class(clientAgent)
|
||||||
|
|
||||||
logger.debug("Searching for Download on %s ...", clientAgent)
|
logger.debug("Searching for Download on %s ..." % (clientAgent))
|
||||||
if clientAgent == 'utorrent':
|
if clientAgent == 'utorrent':
|
||||||
torrents = tc.list()[1]['torrents']
|
torrents = tc.list()[1]['torrents']
|
||||||
for torrent in torrents:
|
for torrent in torrents:
|
||||||
|
@ -581,7 +581,7 @@ def isMediaFile(filename):
|
||||||
if re.search('extras?$', sepFile[0], re.I):
|
if re.search('extras?$', sepFile[0], re.I):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if sepFile[2].lower() in nzbtomedia.MEDIAEXTENSIONS:
|
if sepFile[2].lower() in [i.replace(".","") for i in nzbtomedia.MEDIACONTAINER]:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -2,10 +2,11 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import nzbtomedia
|
import nzbtomedia
|
||||||
import TorrentToMedia
|
import TorrentToMedia
|
||||||
from nzbtomedia.nzbToMediaUtil import find_download, clean_nzbname, listMediaFiles
|
from nzbtomedia.nzbToMediaUtil import find_download, isMediaFile
|
||||||
|
|
||||||
nzbtomedia.initialize()
|
nzbtomedia.initialize()
|
||||||
|
|
||||||
|
test = isMediaFile('test.mp4')
|
||||||
download_id = 'SABnzbd_nzo_qhoQ7m'
|
download_id = 'SABnzbd_nzo_qhoQ7m'
|
||||||
if find_download('sabnzbd', download_id):
|
if find_download('sabnzbd', download_id):
|
||||||
print 'found'
|
print 'found'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue