2017-12-22, 23:02
It is a binary add-on you have to build and install, it is not available in repositories. It should ship with the installer or as a separate system repo entry
python:
kodi_major_version = int(xbmc.getInfoLabel('System.BuildVersion').split('.')[0])
if ext == 'rar' and kodi_major_version >= 18:
src = 'archive' + '://' + quote_plus(compressed_file) + '/'
(cdirs, cfiles) = xbmcvfs.listdir(src)
for cfile in cfiles:
fsrc = '%s%s' % (src, cfile)
xbmcvfs.copy(fsrc, workdir + cfile)
else:
xbmc.executebuiltin("XBMC.Extract(%s, %s)" % (
compressed_file.encode("utf-8"),
workdir.encode("utf-8")), True)
xml:<import addon="vfs.libarchive" version="1.0.0"/>
python:
/path/to/file/myfile.zip
python:
myfile.abc
python:
from urllib import quote_plus as url_quote
dirs_in_dir, files_in_dir = xbmcvfs.listdir(url_quote('archive://path/to/file/myfile.zip'))
#Returns
#dirs_in_dir=
#files_in_dir=['myfile.abc']
success = xbmcvfs.copy(url_quote('archive://path/to/file/myfile.zip/')+'myfile.abc','/path/to/file/myfile.abc')
#success = 0
python:
print 'Web test'
from urllib import quote_plus as url_quote
path = url_quote(directory_from)
(dirs, files) = xbmcvfs.listdir('archive://%s' % (path))
src = 'archive://' + path + '/' + files[0]
dest = os.path.join(directory_to,files[0])
print('copy %s to %s' %(src, dest))
success = xbmcvfs.copy(src, dest)
print success
#Returns
#...
#NOTICE: ADDON: vfs.libarchive v1.0.0 installed
#...
#DEBUG: Web test
#DEBUG: copy archive://%2FUsers%2F...%2Ftemp_iagl%2Ffilename.zip/filename.md to /Users/.../temp_iagl/filename.md
#DEBUG: 0
(2018-07-27, 01:22)zachmorris Wrote:Code:
#DEBUG: copy archive:///Users/.../temp_iagl/filename.zip/filename.md to /Users/.../temp_iagl/filename.md
archive://%2FUsers%2F...%2Ftemp_iagl%2FAction+Fighter+%281989%29%28Firebird+Software%29%5B128K%5D.zip/filename.md
Returns:python:
print('libarchive test')
import os
from urllib import quote_plus as url_quote
from kodi_six import xbmc, xbmcaddon, xbmcplugin, xbmcgui, xbmcvfs
directory_from = '/Users/xxx/Downloads/1941.zip'
directory_to = '/Users/xxx/Downloads/test/'
path = url_quote(directory_from)
print('Archive file test')
(dirs, files) = xbmcvfs.listdir('archive://%s' % (path))
print('Dirs and files')
print(dirs)
print(files)
src = os.path.join('archive://%s' % (path),files[0])
print(xbmcvfs.exists(src))
dest = os.path.join(directory_to,files[0])
print('Test copy from archive %s to %s' %(src, dest))
success = xbmcvfs.copy(src, dest)
print(success)
print('Copied file exists test from archive')
print(xbmcvfs.exists(dest))
print('Zip file test')
(dirs, files) = xbmcvfs.listdir('zip://%s' % (path))
print('Dirs and files')
print(dirs)
print(files)
src = os.path.join('zip://%s' % (path),files[0])
print(xbmcvfs.exists(src))
dest = os.path.join(directory_to,files[0])
print('Test copy from zip %s to %s' %(src, dest))
success = xbmcvfs.copy(src, dest)
print(success)
print('Copied file exists test from zip')
print(xbmcvfs.exists(dest))
print('Done.')
xml:
13:42:32.338 T:123145461903360 DEBUG: libarchive test
13:42:32.419 T:123145461903360 DEBUG: Archive file test
13:42:32.428 T:123145461903360 DEBUG: Dirs and files
13:42:32.428 T:123145461903360 DEBUG:
13:42:32.429 T:123145461903360 DEBUG: ['41_09.rom', '41_18.rom', '41_19.rom', '41_32.rom', '41_gfx1.rom', '41_gfx3.rom', '41_gfx5.rom', '41_gfx7.rom', '41e_30.rom', '41e_31.rom', '41e_35.rom', '41e_36.rom']
13:42:32.429 T:123145461903360 DEBUG: 0
13:42:32.429 T:123145461903360 DEBUG: Test copy from archive archive://%2FUsers%2Fxxx%2FDownloads%2F1941.zip/41_09.rom to /Users/xxx/Downloads/test/41_09.rom
13:42:32.430 T:123145461903360 DEBUG: 0
13:42:32.430 T:123145461903360 DEBUG: Copied file exists test from archive
13:42:32.430 T:123145461903360 DEBUG: 0
13:42:32.430 T:123145461903360 DEBUG: Zip file test
13:42:32.432 T:123145461903360 DEBUG: Dirs and files
13:42:32.433 T:123145461903360 DEBUG:
13:42:32.433 T:123145461903360 DEBUG: ['41_09.rom', '41_18.rom', '41_19.rom', '41_32.rom', '41_gfx1.rom', '41_gfx3.rom', '41_gfx5.rom', '41_gfx7.rom', '41e_30.rom', '41e_31.rom', '41e_35.rom', '41e_36.rom']
13:42:32.433 T:123145461903360 DEBUG: 1
13:42:32.434 T:123145461903360 DEBUG: Test copy from zip zip://%2FUsers%2Fxxx%2FDownloads%2F1941.zip/41_09.rom to /Users/xxx/Downloads/test/41_09.rom
13:42:32.437 T:123145461903360 DEBUG: 1
13:42:32.438 T:123145461903360 DEBUG: Copied file exists test from zip
13:42:32.438 T:123145461903360 DEBUG: 1
13:42:32.438 T:123145461903360 DEBUG: Done.
python:
path = urllib.quote_plus(tempfile)
(dirs, files) = xbmcvfs.listdir('archive://%s' % (path))
for file in files:
src = 'archive://' + path + '/' + file
log( sys._getframe().f_code.co_name ,"file name: %s" % (file))
dest = os.path.join(__temp__, files)
log( sys._getframe().f_code.co_name ,"src: %s" % (src))
log( sys._getframe().f_code.co_name ,"dest: %s" % (dest))
xbmcvfs.copy(src, dest)
python:
import xmbcvfs
...
# Here the correctly and checked downloaded zip file url is
# zipprotocolpath = "zip://C:\Users\Username\AppData\Roaming\Kodi\userdata\addon_data\service.subtitles.legendastv\temp\Extracted\f63a57e12f72471ab5912f976776cc87.zip"
dirs, files = xmbcvfs.listdir( zipprotocolpath )
for dir in dirs:
# Here the first (correctly) found dir = "legendas_tv_20181109202013214"
insidedirs, insidefiles = xmbcvfs.listdir( os.path.join( zipprotocolpath, dir ))
# And that is where we get the GetZipList error
12:39:35.365 T:15704 NOTICE: ADDON: service.subtitles.legendastv v2.4.0 installed
12:39:35.365 T:15704 NOTICE: ADDON: vfs.rar v2.0.6 installed
...
12:46:01.076 T:13608 DEBUG: ### [Legendas.TV] - Opening URL: (http://legendas.tv/downloadarquivo/5be5ebf227fc8)
12:46:03.539 T:13608 DEBUG: CZipManager::GetZipList: failed to stat file zip://C%3a%5cUsers%5cUsername%5cAppData%5cRoaming%5cKodi%5cuserdata%5caddon_data%5cservice.subtitles.legendastv%5ctemp%5cExtracted%5cf63a57e12f72471ab5912f976776cc87.zip%5clegendas_tv_20181109202013214/
12:46:03.539 T:13608 ERROR: XFILE::CDirectory::GetDirectory - Error getting zip://C%3a%5cUsers%5cUsername%5cAppData%5cRoaming%5cKodi%5cuserdata%5caddon_data%5cservice.subtitles.legendastv%5ctemp%5cExtracted%5cf63a57e12f72471ab5912f976776cc87.zip%5clegendas_tv_20181109202013214/