Compare commits

...

3 Commits

5 changed files with 45 additions and 12 deletions

View File

@ -14,9 +14,6 @@ else:
if not os.environ.get("UNRAR_LIB_PATH", None):
os.environ["UNRAR_LIB_PATH"] = bundle_dir + "/libunrar.so"
print os.environ.get("UNRAR_LIB_PATH", None)
print bundle_dir
from comictaggerlib.main import ctmain
if __name__ == '__main__':

View File

@ -91,7 +91,7 @@ class ComicVineTalker(QObject):
def __init__(self):
QObject.__init__(self)
self.api_base_url = "http://www.comicvine.com/api"
self.api_base_url = "https://comicvine.gamespot.com/api"
self.wait_for_rate_limit = False
# key that is registered to comictagger
@ -104,6 +104,9 @@ class ComicVineTalker(QObject):
self.log_func = None
# always use a tls context for urlopen
self.ssl = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
def setLogFunc(self, log_func):
self.log_func = log_func
@ -132,7 +135,7 @@ class ComicVineTalker(QObject):
test_url = self.api_base_url + "/issue/1/?api_key=" + \
key + "&format=json&field_list=name"
resp = urllib2.urlopen(test_url)
resp = urllib2.urlopen(test_url, context=self.ssl)
content = resp.read()
cv_response = json.loads(content)
@ -185,8 +188,7 @@ class ComicVineTalker(QObject):
# print "ATB---", url
for tries in range(3):
try:
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
resp = urllib2.urlopen(url, context=context)
resp = urllib2.urlopen(url, context=self.ssl)
return resp.read()
except urllib2.HTTPError as e:
if e.getcode() == 500:
@ -676,7 +678,7 @@ class ComicVineTalker(QObject):
return url_list
# scrape the CV issue page URL to get the alternate cover URLs
resp = urllib2.urlopen(issue_page_url)
resp = urllib2.urlopen(issue_page_url, context=self.ssl)
content = resp.read()
alt_cover_url_list = self.parseOutAltCoverUrls(content)

View File

@ -1,3 +1,3 @@
# This file should contain only these comments, and the line below.
# Used by packaging makefiles and app
version = "1.1.16-beta-rc"
version = "1.1.16-beta-rc2"

View File

@ -20,6 +20,7 @@ import datetime
import shutil
import tempfile
import urllib
import ssl
#import urllib2
try:
@ -65,6 +66,9 @@ class ImageFetcher(QObject):
if not os.path.exists(self.db_file):
self.create_image_db()
# always use a tls context for urlopen
self.ssl = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
def clearCache(self):
os.unlink(self.db_file)
if os.path.isdir(self.cache_folder):
@ -87,7 +91,7 @@ class ImageFetcher(QObject):
if blocking:
if image_data is None:
try:
image_data = urllib.urlopen(url).read()
image_data = urllib.urlopen(url, context=self.ssl).read()
except Exception as e:
print(e)
raise ImageFetcherException("Network Error!")

View File

@ -28,7 +28,7 @@ import pickle
from PyQt4 import QtCore, QtGui, uic
from PyQt4 import QtNetwork
#from PyQt4.QtCore import QUrl, pyqtSignal
from PyQt4.QtCore import QString, QUrl
#from comicarchive import ComicArchive
#from pageloader import PageLoader
@ -585,11 +585,41 @@ class TaggerWindow(QtGui.QMainWindow):
if url.isValid() and url.scheme() == "file":
if self.droppedFiles is None:
self.droppedFiles = []
self.droppedFiles.append(url.toLocalFile())
self.droppedFiles.append(self.getUrlFromLocalFileID(url))
if self.droppedFiles is not None:
event.accept()
# http://stackoverflow.com/questions/34689562/pyqt-mimedata-filename
def getUrlFromLocalFileID(self, localFileID):
import sys
if not sys.platform == 'darwin':
return localFileID.toLocalFile()
import objc
import CoreFoundation as CF
localFileQString = QString(localFileID.toLocalFile())
relCFStringRef = CF.CFStringCreateWithCString(
CF.kCFAllocatorDefault,
localFileQString.toUtf8(),
CF.kCFStringEncodingUTF8
)
relCFURL = CF.CFURLCreateWithFileSystemPath(
CF.kCFAllocatorDefault,
relCFStringRef,
CF.kCFURLPOSIXPathStyle,
False # is directory
)
absCFURL = CF.CFURLCreateFilePathURL(
CF.kCFAllocatorDefault,
relCFURL,
objc.NULL
)
local = QUrl(str(absCFURL[0])).toLocalFile()
return local
def dropEvent(self, event):
# if self.dirtyFlagVerification("Open Archive",
# "If you open a new archive now, data in the form will be lost. Are you sure?"):