mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-01 15:07:49 +00:00
Tvheadend 42: python: update to python3 - urllib
Automated Python 2 to 3 code translation 2to3 packages/addons/service/tvheadend42/source/download.py http://ix.io/2F2a
This commit is contained in:
parent
ccc5b096d0
commit
5c2cb2022d
@ -1,8 +1,8 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
import urllib, os, zipfile
|
||||
from urllib2 import URLError
|
||||
import urllib.request, urllib.parse, urllib.error, os, zipfile
|
||||
from urllib.error import URLError
|
||||
import xbmc, xbmcvfs, xbmcgui, xbmcaddon
|
||||
import shutil
|
||||
import sys
|
||||
@ -25,7 +25,7 @@ class DownLoader():
|
||||
def download(self, url, dest):
|
||||
try:
|
||||
self.dp.create(ADDON_NAME, LS(30042))
|
||||
urllib.urlretrieve(url, dest, reporthook=self._pbhook)
|
||||
urllib.request.urlretrieve(url, dest, reporthook=self._pbhook)
|
||||
self.dp.close()
|
||||
zip = zipfile.ZipFile(archive)
|
||||
if zip.testzip() is not None: raise zipfile.BadZipfile
|
||||
@ -44,7 +44,7 @@ class DownLoader():
|
||||
shutil.copytree(os.path.join(temp_folder, folder), os.path.join(dest_folder, folder))
|
||||
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30039), xbmcgui.NOTIFICATION_INFO)
|
||||
except URLError, e:
|
||||
except URLError as e:
|
||||
xbmc.log('Could not download file: %s' % e.reason, xbmc.LOGERROR)
|
||||
self.dp.close()
|
||||
xbmcgui.Dialog().notification(ADDON_NAME, LS(30040), xbmcgui.NOTIFICATION_ERROR)
|
||||
|
Loading…
x
Reference in New Issue
Block a user