Things to do:
Check your rar supports "lb":
Code: Select all
$ rar | grep List
l[t[a],b] List archive contents [technical[all], bare]
Short: replace it with this file http://pastebin.com/EhLL9f57
Or long & detailed: in assembler.py find the line:
Code: Select all
def rar_contains_unwanted_file(filepath):
Code: Select all
def rarfilecontents(myrarfile):
cmd = sabnzbd.newsunpack.RAR_COMMAND + ' lb ' + myrarfile
result = os.popen(cmd).readlines()
return map(str.rstrip, result ) # return the list of files, with \r and \n etc removed
def rar_contains_unwanted_file(filepath):
# checks for unwanted extensions in the rar file 'filepath'
# ... unwanted extensions are defined in global variable cfg.unwanted_extensions()
# returns False if no unwanted extensions are found in the rar file
# returns name of file if unwanted extension is found in the rar file
unwanted = None
if cfg.unwanted_extensions() and is_rarfile(filepath):
logging.debug('SJ: rar file to check: %s',filepath)
# logging.debug('unwanted extensions are: %s', cfg.unwanted_extensions())
try:
'''
zf = RarFile(filepath, all_names=True)
logging.debug('SJ: files in rar file: %s', zf.namelist())
for somefile in zf.namelist():
'''
for somefile in rarfilecontents(filepath):
logging.debug('file in rar file: %s', somefile)
if os.path.splitext(somefile)[1].replace('.', '').lower() in cfg.unwanted_extensions():
logging.debug('Unwanted file %s', somefile)
unwanted = somefile
zf.close()
except:
logging.debug('RAR file %s cannot be inspected.', filepath)
return unwanted
Code: Select all
> def rarfilecontents(myrarfile):
> cmd = 'rar lb ' + myrarfile # sabnzbd.newsunpack.RAR_COMMAND
> cmd = sabnzbd.newsunpack.RAR_COMMAND + ' lb ' + myrarfile
> result = os.popen(cmd).readlines()
> print "SJ:", result
> return map(str.rstrip, result )
> '''
> for thisline in result:
> print thisline.rstrip()
> '''
>
337c348
< # logging.debug('rar file to check: %s',filepath)
---
> logging.debug('SJ: rar file to check: %s',filepath)
339a351
> '''
341c353
< # logging.debug('files in rar file: %s', zf.namelist())
---
> logging.debug('SJ: files in rar file: %s', zf.namelist())
342a355,356
> '''
> for somefile in rarfilecontents(filepath):