исправления и версия python 3.7

master v1.2.1
Роман Бородин 2022-03-14 22:57:02 +03:00
parent bf08457a2a
commit 8198b8f558
14 changed files with 23 additions and 19 deletions

View File

@ -1 +1 @@
7175372
7171244

View File

@ -1 +1 @@
11220000
11170816

View File

@ -1 +1 @@
11148992
11059240

View File

@ -47,7 +47,7 @@ else:
log('dirname:' + str(dirname))
versions = ['1.2.15']
versions = ['1.1.14']
default_path = versions[-1]
set_version = int(__settings__.getSetting('set_version'))
if getSettingAsBool('custom_version'):

View File

@ -35,7 +35,7 @@ __libbaseurl__ = "https://git.ukamnya.ru/ukamnya/script.module.libtorrent/raw/br
__settings__ = xbmcaddon.Addon(id='script.module.libtorrent')
__version__ = __settings__.getAddonInfo('version')
__plugin__ = __settings__.getAddonInfo('name') + " v." + __version__
__icon__ = os.path.join(xbmc.translatePath('special://home'), 'addons',
__icon__ = os.path.join(xbmcvfs.translatePath('special://home'), 'addons',
'script.module.libtorrent', 'icon.png')
__language__ = __settings__.getLocalizedString
@ -98,7 +98,7 @@ class LibraryManager():
self.http = HTTP()
self.http.fetch(url, download=dest + ".zip", progress=True)
log("%s -> %s" % (url, dest))
xbmc.executebuiltin('XBMC.Extract("%s.zip","%s")' % (dest, self.dest_path), True)
xbmc.executebuiltin('Extract("%s.zip","%s")' % (dest, self.dest_path), True)
xbmcvfs.delete(dest + ".zip")
except:
text = 'Failed download %s!' % libname

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
'''
"""
python-libtorrent for Kodi (script.module.libtorrent)
Copyright (C) 2015-2016 DiMartino, srg70, RussakHH, aisman
@ -21,7 +21,7 @@
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
'''
"""
import base64
import http.cookiejar
@ -75,6 +75,8 @@ class HTTP:
self._opener()
self._fetch()
except Exception as e:
import traceback
xbmc.log(f'XBMCup trace: {traceback.format_exc()}')
xbmc.log('XBMCup: HTTP: ' + str(e), xbmc.LOGERROR)
if isinstance(e, urllib.error.HTTPError):
self.response.code = e.code
@ -82,15 +84,15 @@ class HTTP:
else:
self.response.code = 200
if self.fd:
if self.fd is not None:
self.fd.close()
self.fd = None
if self.con:
if self.con is not None:
self.con.close()
self.con = None
if self.progress:
if self.progress is not None:
self.progress.close()
self.progress = None
@ -186,13 +188,15 @@ class HTTP:
while 1:
buf = self.con.read(bs)
if buf == '':
if buf == b'':
break
read += len(buf)
fd.write(buf)
if self.request.progress:
self.progress.update(*self._progress(read, size, name))
# self.progress.update(*self._progress(read, size, name))
pr = self._progress(read, size, name)
self.progress.update(pr[0], ' '.join(pr[1:]))
self.response.filename = self.request.download
@ -235,8 +239,10 @@ class HTTP:
def _headers(self, raw):
headers = {}
for line in raw.headers:
pair = line.split(':', 1)
#for line in raw.headers:
for line in raw.raw_items():
#pair = line.split(':', 1)
pair = line
if len(pair) == 2:
tag = pair[0].lower().strip()
value = pair[1].strip()

View File

@ -97,8 +97,8 @@ msgid "Windows 64-bit"
msgstr "Windows 64-bit"
msgctxt "#401150"
msgid "1.2.15"
msgstr "1.2.15"
msgid "1.1.14"
msgstr "1.1.14"
msgctxt "#401010"
msgid "401010"