57 lines
2.3 KiB
Diff
57 lines
2.3 KiB
Diff
|
diff --git a/picard/ui/coverartbox.py b/picard/ui/coverartbox.py
|
||
|
index fc515877..f381fe77 100644
|
||
|
--- a/picard/ui/coverartbox.py
|
||
|
+++ b/picard/ui/coverartbox.py
|
||
|
@@ -54,14 +54,14 @@ class ActiveLabel(QtGui.QLabel):
|
||
|
|
||
|
def dragEnterEvent(self, event):
|
||
|
for url in event.mimeData().urls():
|
||
|
- if url.scheme() in ('http', 'file'):
|
||
|
+ if url.scheme() in ('https', 'http', 'file'):
|
||
|
event.acceptProposedAction()
|
||
|
break
|
||
|
|
||
|
def dropEvent(self, event):
|
||
|
accepted = False
|
||
|
for url in event.mimeData().urls():
|
||
|
- if url.scheme() in ('http', 'file'):
|
||
|
+ if url.scheme() in ('https', 'http', 'file'):
|
||
|
accepted = True
|
||
|
self.imageDropped.emit(url)
|
||
|
if accepted:
|
||
|
@@ -153,11 +153,15 @@ class CoverArtBox(QtGui.QGroupBox):
|
||
|
def fetch_remote_image(self, url):
|
||
|
if self.item is None:
|
||
|
return
|
||
|
- if url.scheme() == 'http':
|
||
|
+ if url.scheme() in ('https', 'http'):
|
||
|
path = url.encodedPath()
|
||
|
if url.hasQuery():
|
||
|
path += '?' + url.encodedQuery()
|
||
|
- self.tagger.xmlws.get(url.encodedHost(), url.port(80), path,
|
||
|
+ if url.scheme() == 'https':
|
||
|
+ port = 443
|
||
|
+ else:
|
||
|
+ port = 80
|
||
|
+ self.tagger.xmlws.get(str(url.encodedHost()), url.port(port), str(path),
|
||
|
partial(self.on_remote_image_fetched, url),
|
||
|
xml=False,
|
||
|
priority=True, important=True)
|
||
|
@@ -173,13 +177,14 @@ class CoverArtBox(QtGui.QGroupBox):
|
||
|
mime = reply.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
|
||
|
if mime in ('image/jpeg', 'image/png'):
|
||
|
self.load_remote_image(url, mime, data)
|
||
|
- elif reply.url().hasQueryItem("imgurl"):
|
||
|
+ elif url.hasQueryItem("imgurl"):
|
||
|
# This may be a google images result, try to get the URL which is encoded in the query
|
||
|
- url = QtCore.QUrl(reply.url().queryItemValue("imgurl"))
|
||
|
+ url = QtCore.QUrl(url.queryItemValue("imgurl"))
|
||
|
self.fetch_remote_image(url)
|
||
|
else:
|
||
|
log.warning("Can't load image with MIME-Type %s", mime)
|
||
|
|
||
|
+
|
||
|
def load_remote_image(self, url, mime, data):
|
||
|
try:
|
||
|
coverartimage = CoverArtImage(
|