@
Popeye
Is there any plan to implement crypted rar support?
I have bin started with this but I have no succses.
utils.py
Code:
def rar_filenames(folder, file):
log("rar_filenames: folder: %s file: %s" % (folder, file))
filepath = join(folder, file)
temp_path = os.path.join(__userdata__, 'temp.rar')
# clean out potential old temp file
delete(temp_path)
# read only 1024 bytes of the remote rar
buffer = read(filepath, 'rb', 1024)
# write it local for rar inspection
fd_out = open(temp_path,'wb')
fd_out.write(buffer)
fd_out.close()
#shutil.copyfile(filepath, temp_path)
rf = rarfile.RarFile(temp_path)
rf = rarfile.RarFile(filepath)
if rf.needs_password():
# find the password
test_path = join(folder, '__ADMIN__')
nzbname = ('%s.nzb.gz'% folder.split('/')[-1])
nzbfile = join(test_path, nzbname)
f = gzip.open(nzbfile, 'rb')
file_content = f.read()
f.close()
dirtystring = re.split('<meta type="password">', file_content)[-1]
password = re.split('</meta>', dirtystring)[0]
log("RAR is protected")
log("Password was found : %s" % password)
rf.setpassword(password)
delete(temp_path)
movie_file_list = rf.namelist()
log("rar_filenames: movie_file_list: %s" % movie_file_list)
for f in rf.infolist():
log("rar_file: %s" % f)
if f.compress_type != 48:
notification("Compressed rar!")
log("rar_filenames: Compressed rar")
return movie_file_list
Here is the log
Code:
00:43:29 T:2550172480 NOTICE: plugin.program.pneumatic: rar_filenames: folder: /mnt/nas/temp/X-Men.Erste.Entscheidung.2011.German.720p.BluRay.x264.iNTERNAL-MQ4Y.German.720p file: b15l1u3uzdv9ukxhb1a5b7.part01.rar
00:43:29 T:2550172480 NOTICE: plugin.program.pneumatic: RAR is protected
00:43:29 T:2550172480 NOTICE: plugin.program.pneumatic: Password was found : usenet-4all.info_eZHLlHp14XYy
00:43:29 T:2550172480 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'rarfile.NoCrypto'>
Error Contents: Cannot parse encrypted headers - no crypto
Traceback (most recent call last):
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/default.py", line 936, in <module>
pre_play(nzbname, nzo=sab_nzo_id)
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/default.py", line 313, in pre_play
in_rar_file_list = utils.rar_filenames(folder, nzf.filename)
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/utils.py", line 233, in rar_filenames
rf.setpassword(password)
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/rarfile.py", line 445, in setpassword
self._parse()
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/rarfile.py", line 647, in _parse
self._parse_real()
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/rarfile.py", line 668, in _parse_real
h = self._parse_header(fd)
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/rarfile.py", line 734, in _parse_header
fd = self._decrypt_header(fd)
File "/home/freevdr/.xbmc/addons/plugin.program.pneumatic/rarfile.py", line 718, in _decrypt_header
raise NoCrypto('Cannot parse encrypted headers - no crypto')
NoCrypto: Cannot parse encrypted headers - no crypto
-->End of Python script error report<--
Any Idea