delete storage fix
parent
82dab260c8
commit
e7693e5698
|
@ -278,7 +278,6 @@ class TorrentPlayer(xbmc.Player):
|
||||||
return
|
return
|
||||||
xbmc.sleep(1000)
|
xbmc.sleep(1000)
|
||||||
#self.torrent.torrentHandle.flush_cache()
|
#self.torrent.torrentHandle.flush_cache()
|
||||||
self.torrent.resume_data()
|
|
||||||
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
self.torrent.session.remove_torrent(self.torrent.torrentHandle)
|
||||||
progressBar.update(0)
|
progressBar.update(0)
|
||||||
progressBar.close()
|
progressBar.close()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="plugin.video.torrenter" name="Torrenter" version="2.3.7" provider-name="vadim.skorba, DiMartino">
|
<addon id="plugin.video.torrenter" name="Torrenter" version="2.3.8" provider-name="vadim.skorba, DiMartino">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.libtorrent"/>
|
<import addon="script.module.libtorrent"/>
|
||||||
|
|
27
functions.py
27
functions.py
|
@ -53,7 +53,9 @@ __plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
|
||||||
|
|
||||||
def clearStorage(userStorageDirectory):
|
def clearStorage(userStorageDirectory):
|
||||||
userStorageDirectory = decode(userStorageDirectory)
|
userStorageDirectory = decode(userStorageDirectory)
|
||||||
if xbmcvfs.exists(userStorageDirectory + os.sep):
|
#log('[clearStorage]: storage '+str(userStorageDirectory) + os.sep)
|
||||||
|
if xbmcvfs.exists(userStorageDirectory + os.sep) or os.path.exists(userStorageDirectory):
|
||||||
|
log('[clearStorage]: storage exists')
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
temp = userStorageDirectory.rstrip('Torrenter').rstrip('/\\')
|
temp = userStorageDirectory.rstrip('Torrenter').rstrip('/\\')
|
||||||
|
@ -86,13 +88,17 @@ def clearStorage(userStorageDirectory):
|
||||||
if saved_bool:
|
if saved_bool:
|
||||||
shutil.move(saved_temp, saved)
|
shutil.move(saved_temp, saved)
|
||||||
|
|
||||||
|
showMessage(Localization.localize('Storage'), Localization.localize('Storage was cleared'), forced=True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
showMessage(Localization.localize('Storage'), Localization.localize('Does not exists'), forced=True)
|
||||||
|
log('[clearStorage]: fail storage '+userStorageDirectory + os.sep)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
DownloadDB().clear()
|
DownloadDB().clear()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log('[clearStorage]: DownloadDB().clear() failed. '+str(e))
|
log('[clearStorage]: DownloadDB().clear() failed. '+str(e))
|
||||||
|
|
||||||
showMessage(Localization.localize('Storage'), Localization.localize('Storage was cleared'), forced=True)
|
|
||||||
|
|
||||||
|
|
||||||
def sortcomma(dict, json):
|
def sortcomma(dict, json):
|
||||||
for x in dict:
|
for x in dict:
|
||||||
|
@ -1322,11 +1328,10 @@ def fetchData(url, referer=None):
|
||||||
|
|
||||||
def file_decode(filename):
|
def file_decode(filename):
|
||||||
pass
|
pass
|
||||||
#if not __settings__.getSetting('delete_russian') == 'true':
|
try:
|
||||||
# try:
|
filename = filename.decode('utf-8') # ,'ignore')
|
||||||
# filename = filename.decode('utf-8') # ,'ignore')
|
except:
|
||||||
# except:
|
pass
|
||||||
# pass
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
@ -1672,14 +1677,14 @@ def vista_check():
|
||||||
return platform.release() == "Vista"
|
return platform.release() == "Vista"
|
||||||
|
|
||||||
def is_writable(path):
|
def is_writable(path):
|
||||||
if not os.path.exists(path):
|
if not xbmcvfs.exists(path+os.sep):
|
||||||
xbmcvfs.mkdirs(path)
|
xbmcvfs.mkdirs(path)
|
||||||
try:
|
try:
|
||||||
open(os.path.join(path, 'temp'), 'w')
|
open(os.path.join(file_decode(path), 'temp'), 'w')
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
os.remove(os.path.join(path, 'temp'))
|
os.remove(os.path.join(file_decode(path), 'temp'))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def unescape(string):
|
def unescape(string):
|
||||||
|
|
Loading…
Reference in New Issue