replace .cbz and .cbr with .zip and .rar. fixes #351

This commit is contained in:
clinton-hall 2014-05-02 09:52:41 +09:30
parent 39bf06f358
commit 0c8ce3917b
3 changed files with 9 additions and 4 deletions

View file

@ -125,6 +125,9 @@ def processTorrent(inputDirectory, inputName, inputCategory, inputHash, inputID,
for inputFile in inputFiles:
filePath = os.path.dirname(inputFile)
fileName, fileExt = os.path.splitext(os.path.basename(inputFile))
if fileExt in nzbtomedia.EXT_REPLACE:
fullFileName = fileName + nzbtomedia.EXT_REPLACE[fileExt]
else:
fullFileName = os.path.basename(inputFile)
targetFile = nzbtomedia.os.path.join(outputDestination, fullFileName)

View file

@ -104,6 +104,7 @@ DELUGEPWD = None
EXTCONTAINER = []
COMPRESSEDCONTAINER = []
EXT_REPLACE = {}
MEDIACONTAINER = []
AUDIOCONTAINER = []
METACONTAINER = []
@ -156,7 +157,7 @@ def initialize(section=None):
OUTPUTVIDEOBITRATE, OUTPUTAUDIOCODEC, OUTPUTAUDIOBITRATE, OUTPUTSUBTITLECODEC, OUTPUTFASTSTART, OUTPUTQUALITYPERCENT, \
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, \
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO
USER_SCRIPT_PARAM, USER_SCRIPT_RUNONCE, USER_SCRIPT_SUCCESSCODES, DOWNLOADINFO, EXT_REPLACE
if __INITIALIZED__:
return False
@ -277,6 +278,7 @@ def initialize(section=None):
re.compile('.part\d+.rar$', re.I),
re.compile('.rar$', re.I)]
COMPRESSEDCONTAINER += [re.compile('%s$' % ext, re.I) for ext in CFG["Extensions"]["compressedExtensions"]]
EXT_REPLACE = {'.cbr':'.rar', '.cbz':'.zip'} # extensions used for comic books need to be replaced before we can extract.
MEDIACONTAINER = CFG["Extensions"]["mediaExtensions"]
AUDIOCONTAINER = CFG["Extensions"]["audioExtensions"]
METACONTAINER = CFG["Extensions"]["metaExtensions"] # .nfo,.sub,.srt

View file

@ -771,7 +771,7 @@ def backupVersionedFile(old_file, version):
def update_downloadInfoStatus(inputName, status):
logger.debug("Updating status of our download %s in the DB to %s" % (inputName, status))
logger.db("Updating status of our download %s in the DB to %s" % (inputName, status))
myDB = nzbToMediaDB.DBConnection()
myDB.action("UPDATE downloads SET status=?, last_update=? WHERE input_name=?",
@ -779,7 +779,7 @@ def update_downloadInfoStatus(inputName, status):
def get_downloadInfo(inputName, status):
logger.debug("Getting download info for %s from the DB" % (inputName))
logger.db("Getting download info for %s from the DB" % (inputName))
myDB = nzbToMediaDB.DBConnection()
sqlResults = myDB.select("SELECT * FROM downloads WHERE input_name=? AND status=?",