Kodi Community Forum

Full Version: XBMC.Extract
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
fileLocation="\userdata\addon_data\[PLUGIN]\temp\download\[RARFILE]"
subdir="\userdata\addon_data\[PLUGIN]\temp\subs"
xbmc.executebuiltin("XBMC.Extract(" + fileLocation + ", " + subdir + ")", True)

Works with an Rar in kodi17
Doens't work on Kodi18 with Rar 

Used in service.subtitles.tv4user



Hope its a Bug in Kodi18, not a obsoleted feature
you have to install / enable the add-on, vfs.rar.
Maybe we should amend the documentation that if you use this function you need to check and/or enable the vfs addon you need.
How should it be used?
 I Dont file any Dokumentation. When the Plugin is enabled, the Extract still dons't work . is it somthing like xbmfs.rar ?


And how can a Plugin be done working in Kodi17 and Kodi18?
you use the vfs module rather than the extract built-in.

approximately
Code:
import xbmcvfs
xbmcvfs.listdir('rar://<url encoded path to the rar archive>/') to list the contents, then you use
xbmcvfs.copy('rar://<urlencoded path to the rar archive>/<file in archive'>, subdir'+/'+<file in archive>)
this works in all versions and for zips as well (with zip:// instead of rar://)
(2017-11-02, 00:42)spiff Wrote: [ -> ]you use the vfs module rather than the extract built-in.

approximately
Code:
import xbmcvfs
xbmcvfs.listdir('rar://<url encoded path to the rar archive>/') to list the contents, then you use
xbmcvfs.copy('rar://<urlencoded path to the rar archive>/<file in archive'>, subdir'+/'+<file in archive>)
this works in all versions and for zips as well (with zip:// instead of rar://)

Any chance additional VFS modules will be added to support more than zip and rar?  Something like vfs.patool or vfs.p7zip would be beneficial for v18 and the ability to work with different files for Retroplayer.
well somebody just has to write the vfs add-ons.
well that was pretty easy. got a libarchive based vfs going. still early but everything works, playing some music out of tar.bz2 files as we speak (and 7z works fine as well yes).

won't work on it more today, but notspiff/vfs.libarchive. you have to provide libarchive yourself, so right now linux is the easiest. you will need the top commit of 'archive' branch from notspiff/xbmc.

urls are archive://<url encoded path to archive>/<file in archive>. subfolders and shit not yet handled and the archive file has to be local.
Thanks , now it works

If someone find it and have some problems

1. 

xbmcvfs.listdir
returns a list of arrays
on my List it was [[],["FILE1"]]
SO 

Code:
for name in liste:
   filename=name[0]

2.
 fileLocation=urllib.quote_plus(fileLocation)
 quelle=xbmc.translatePath(os.path.join(type, fileLocation)).decode("utf-8")

 quelle=xbmc.translatePath(os.path.join(quelle, FILE)).decode("utf-8")

 xbmcvfs.copy doesnt work
Correct is:
Code:
         quelle=quelle+"/"+element[0]




One Question
Is there a better way to find out what should be used then:


Code:
 try:
        liste=xbmcvfs.listdir("rar://"+fileLocation)
    except:    
        liste=xbmcvfs.listdir("zip://"+fileLocation)       



Am i Correct, or have i done something wrong?
i just landed the add-on in the main binary add-on repo. everything should work ™, archives from network, archives in archives, ... please test shit sh*t out of it.
(2017-11-02, 22:50)L0RE Wrote: [ -> ] xbmcvfs.copy doesnt work
Hello guys!

I'm also having problems with this step 

The second parameter is a path+filename string, right? Already tried "file://urlencoded_path_to_dest_file" just in case
The return value is always false and nothing gets copied

Can anyone confirm that xbmcvfs.copy is working?

listdir woks fine!

Thanks
Code:
import xbmcvfs
import urllib

path = urllib.quote_plus('/home/akva/sample.rar')

(dirs, files) = xbmcvfs.listdir('archive://%s' % (path))
src = 'archive://' + path + '/' + files[0]
dest = '/tmp/' + files[0]
print('copy %s to %s' %(src, dest))
xbmcvfs.copy(src, dest)

works just fine for me.
(2017-12-21, 23:14)spiff Wrote: [ -> ]
Code:
import xbmcvfs
import urllib

path = urllib.quote_plus('/home/akva/sample.rar')

(dirs, files) = xbmcvfs.listdir('archive://%s' % (path))
src = 'archive://' + path + '/' + files[0]
dest = '/tmp/' + files[0]
print('copy %s to %s' %(src, dest))
xbmcvfs.copy(src, dest)

works just fine for me. 

Thanks!
I see now that I was missing the RAR filename in the src parameter

But it didn't worked with the 'archive' protocol.
Had to change to rar or zip based on the file extension

But this is not a problem for my scenario

Thanks again!
you need vfs.libarchive as discussed further up in the thread for archive://, vfs.rar or vfs.libarchive for rar://, while zip is built-in.
(2017-12-22, 01:51)spiff Wrote: [ -> ]you need vfs.libarchive as discussed further up in the thread for archive://, vfs.rar or vfs.libarchive for rar://, while zip is built-in.
 Great!

Last one... I guess  Blush

Can vfs.rar be automatically enabled by another addon during install ?

I've tried to use the import tag on addon.xml:


  <requires>
    <import addon="vfs.rar" version="2.0.2" />
  </requires>

But got this...

ERROR: CAddonInstallJob[myaddon]: The dependency on vfs.rar version 2.0.2 could not be satisfied
Pages: 1 2