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