mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-27 10:03:59 +00:00
Merge pull request #217 from Typz/googleImages
Allow dropping image directly from Google image results.
This commit is contained in:
@@ -172,10 +172,14 @@ class CoverArtBox(QtGui.QGroupBox):
|
||||
|
||||
def on_remote_image_fetched(self, data, reply, error):
|
||||
mime = reply.header(QtNetwork.QNetworkRequest.ContentTypeHeader)
|
||||
if mime not in ('image/jpeg', 'image/png'):
|
||||
if mime in ('image/jpeg', 'image/png'):
|
||||
self.load_remote_image(mime, data)
|
||||
elif reply.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"))
|
||||
self.fetch_remote_image(url)
|
||||
else:
|
||||
log.warning("Can't load image with MIME-Type %s", mime)
|
||||
return
|
||||
return self.load_remote_image(mime, data)
|
||||
|
||||
def load_remote_image(self, mime, data):
|
||||
pixmap = QtGui.QPixmap()
|
||||
|
||||
Reference in New Issue
Block a user