mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
fixed utorrent loading.. I hope. Added extractor
extractor now tested in windows after some changes
This commit is contained in:
parent
fe9f71ef8e
commit
a920568d44
1 changed files with 13 additions and 7 deletions
|
@ -10,8 +10,10 @@ import datetime
|
||||||
import time
|
import time
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
|
|
||||||
|
|
||||||
# Custom imports
|
# Custom imports
|
||||||
import linktastic.linktastic as linktastic
|
import linktastic.linktastic as linktastic
|
||||||
|
import extractor.extractor as extractor
|
||||||
import autoProcessMovie
|
import autoProcessMovie
|
||||||
import autoProcessTV
|
import autoProcessTV
|
||||||
from nzbToMediaEnv import *
|
from nzbToMediaEnv import *
|
||||||
|
@ -21,6 +23,7 @@ from utorrent.client import UTorrentClient
|
||||||
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
nzbtomedia_configure_logging(os.path.dirname(sys.argv[0]))
|
||||||
Logger = logging.getLogger(__name__)
|
Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
def category_search(inputDirectory, inputName, inputCategory, root, categories):
|
||||||
categorySearch = [os.path.normpath(inputDirectory), ""] # initializie
|
categorySearch = [os.path.normpath(inputDirectory), ""] # initializie
|
||||||
notfound = 0
|
notfound = 0
|
||||||
|
@ -154,7 +157,7 @@ def copy_link(source, target, useLink, outputDestination):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def unpack(dirpath, file, destination):
|
def unpack(dirpath, file, destination): ###Need to remove this when extractor is confirmed
|
||||||
# Using Windows
|
# Using Windows
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
Logger.info("EXTRACTOR: We are using Windows")
|
Logger.info("EXTRACTOR: We are using Windows")
|
||||||
|
@ -262,7 +265,6 @@ Logger.info("TorrentToMedia %s", VERSION)
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
configFilename = os.path.join(os.path.dirname(sys.argv[0]), "autoProcessMedia.cfg")
|
||||||
|
|
||||||
|
|
||||||
### TORRENT TO MEDIA ###
|
### TORRENT TO MEDIA ###
|
||||||
if not os.path.isfile(configFilename):
|
if not os.path.isfile(configFilename):
|
||||||
Logger.error("You need an autoProcessMedia.cfg file - did you rename and edit the .sample?")
|
Logger.error("You need an autoProcessMedia.cfg file - did you rename and edit the .sample?")
|
||||||
|
@ -274,7 +276,7 @@ config.read(configFilename)
|
||||||
clientAgent = config.get("Torrent", "clientAgent")
|
clientAgent = config.get("Torrent", "clientAgent")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
inputDirectory, inputName, inputCategory = parse_args(clientAgent)
|
inputDirectory, inputName, inputCategory, inputHash = parse_args(clientAgent)
|
||||||
except:
|
except:
|
||||||
Logger.error("MAIN: There was a problem loading variables: Exiting")
|
Logger.error("MAIN: There was a problem loading variables: Exiting")
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
@ -302,6 +304,10 @@ categories = (config.get("Torrent", "categories")).split(',')
|
||||||
categories.append(movieCategory)
|
categories.append(movieCategory)
|
||||||
categories.append(tvCategory) # now have a list of all categories in use.
|
categories.append(tvCategory) # now have a list of all categories in use.
|
||||||
|
|
||||||
|
# setup uTorrentClass
|
||||||
|
if inputHash:
|
||||||
|
utorrentClass = UTorrentClient(uTorrentWEBui, uTorrentUSR, uTorrentPWD)
|
||||||
|
|
||||||
status = int(1) # We start as "failed" until we verify movie file in destination
|
status = int(1) # We start as "failed" until we verify movie file in destination
|
||||||
root = int(0)
|
root = int(0)
|
||||||
video = int(0)
|
video = int(0)
|
||||||
|
@ -369,10 +375,10 @@ for dirpath, dirnames, filenames in os.walk(inputDirectory):
|
||||||
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtention, filePath)
|
Logger.info("MAIN: Found compressed archive %s for file %s", fileExtention, filePath)
|
||||||
source = filePath
|
source = filePath
|
||||||
target = os.path.join(outputDestination, file)
|
target = os.path.join(outputDestination, file)
|
||||||
state = unpack(dirpath, file, outputDestination)
|
try:
|
||||||
if state == False:
|
extractor.extract(dirpath, file, outputDestination)
|
||||||
Logger.info("MAIN: Failed to unpack file %s", file)
|
except:
|
||||||
failed_extract = 1
|
Logger.warn("Extraction failed for %s", file)
|
||||||
else:
|
else:
|
||||||
Logger.info("MAIN: Ignoring unknown filetype %s for file %s", fileExtention, filePath)
|
Logger.info("MAIN: Ignoring unknown filetype %s for file %s", fileExtention, filePath)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue