created zip vfs, will create and copy directories to remote share

This commit is contained in:
Rob Weber
2014-07-30 15:16:58 -05:00
parent 24385a2c68
commit 19fcb8bd46
3 changed files with 78 additions and 14 deletions

View File

@ -2,7 +2,8 @@ import utils as utils
import xbmc
import xbmcvfs
import xbmcgui
import sys
import zipfile
import zlib
from dropbox import client, rest, session
APP_KEY = utils.getSetting('dropbox_key')
@ -45,6 +46,12 @@ class Vfs:
def exists(self,aFile):
return True
def rename(self,aFile,newName):
return True
def cleanup(self):
return True
class XBMCFileSystem(Vfs):
@ -60,9 +67,40 @@ class XBMCFileSystem(Vfs):
def rmdir(self,directory):
return xbmcvfs.rmdir(directory,True)
def rename(self,aFile,newName):
return xbmcvfs.rename(aFile, newName)
def exists(self,aFile):
return xbmcvfs.exists(aFile)
class ZipFileSystem(Vfs):
zip = None
def __init__(self,rootString,mode):
self.root_path = ""
self.zip = zipfile.ZipFile(xbmc.translatePath(utils.data_dir() + "xbmc_backup_temp.zip"),mode=mode)
def listdir(self,directory):
return True
def mkdir(self,directory):
#self.zip.write(directory[len(self.root_path):])
return True
def put(self,source,dest):
self.zip.write(source,dest,compress_type=zipfile.ZIP_DEFLATED)
return True
def rmdir(self,directory):
return True
def exists(self,aFile):
return True
def cleanup(self):
self.zip.close()
class DropboxFileSystem(Vfs):
client = None