* #87 fix ssl comicvine communication * handle missing libunrar. update macos makefile. remove version check window. bump version. * update release notes * #87 fix ssl context in several places. update comicvine api url. * fix drag and drop issues on macOS * bump version to 1.1.16-beta-rc2 * use PNG conversion for Windows build
This commit is contained in:
parent
4ff2061568
commit
d0918c92e4
@ -30,11 +30,13 @@ import StringIO
|
||||
|
||||
from natsort import natsorted
|
||||
from PyPDF2 import PdfFileReader
|
||||
from unrar import rarfile
|
||||
from unrar import unrarlib
|
||||
from unrar import constants
|
||||
#import UnRAR2
|
||||
#from UnRAR2.rar_exceptions import *
|
||||
try:
|
||||
from unrar import rarfile
|
||||
from unrar import unrarlib
|
||||
from unrar import constants
|
||||
except:
|
||||
print "WARNING: cannot find libunrar, rar support is disabled"
|
||||
pass
|
||||
|
||||
if platform.system() == "Windows":
|
||||
import _subprocess
|
||||
|
@ -1,4 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
# we are running in a bundle
|
||||
frozen = 'ever so'
|
||||
bundle_dir = sys._MEIPASS
|
||||
else:
|
||||
# we are running in a normal Python environment
|
||||
bundle_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# setup libunrar
|
||||
if not os.environ.get("UNRAR_LIB_PATH", None):
|
||||
os.environ["UNRAR_LIB_PATH"] = bundle_dir + "/libunrar.so"
|
||||
|
||||
from comictaggerlib.main import ctmain
|
||||
|
||||
|
@ -21,6 +21,7 @@ import re
|
||||
import time
|
||||
import datetime
|
||||
import sys
|
||||
import ssl
|
||||
#from pprint import pprint
|
||||
#import math
|
||||
|
||||
@ -90,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
|
||||
@ -103,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
|
||||
|
||||
@ -131,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)
|
||||
@ -184,7 +188,7 @@ class ComicVineTalker(QObject):
|
||||
# print "ATB---", url
|
||||
for tries in range(3):
|
||||
try:
|
||||
resp = urllib2.urlopen(url)
|
||||
resp = urllib2.urlopen(url, context=self.ssl)
|
||||
return resp.read()
|
||||
except urllib2.HTTPError as e:
|
||||
if e.getcode() == 500:
|
||||
@ -674,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)
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This file should contain only these comments, and the line below.
|
||||
# Used by packaging makefiles and app
|
||||
version = "1.1.15-beta"
|
||||
version = "1.1.16-beta-rc2"
|
||||
|
@ -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!")
|
||||
|
@ -344,14 +344,6 @@ For more help visit the wiki at: http://code.google.com/p/comictagger/
|
||||
"ComicTagger {0}: Copyright (c) 2012-2014 Anthony Beville".format(ctversion.version))
|
||||
print(
|
||||
"Distributed under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)")
|
||||
new_version = VersionChecker().getLatestVersion("", False)
|
||||
if new_version is not None and new_version != ctversion.version:
|
||||
print(
|
||||
"--------------------------------------------------------------------------")
|
||||
print(
|
||||
"New version available online: {0}".format(new_version))
|
||||
print(
|
||||
"--------------------------------------------------------------------------")
|
||||
sys.exit(0)
|
||||
if o in ("-t", "--type"):
|
||||
if a.lower() == "cr":
|
||||
|
@ -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
|
||||
@ -279,7 +279,8 @@ class TaggerWindow(QtGui.QMainWindow):
|
||||
self.settings.ask_about_usage_stats = False
|
||||
|
||||
if self.settings.check_for_new_version:
|
||||
self.checkLatestVersionOnline()
|
||||
#self.checkLatestVersionOnline()
|
||||
pass
|
||||
|
||||
def sigint_handler(self, *args):
|
||||
# defer the actual close in the app loop thread
|
||||
@ -584,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?"):
|
||||
|
@ -80,9 +80,8 @@ if qt_available:
|
||||
# format
|
||||
im = Image.open(StringIO.StringIO(image_data))
|
||||
output = StringIO.StringIO()
|
||||
im.save(output, format="TIFF")
|
||||
img.loadFromData(output.getvalue())
|
||||
success = True
|
||||
im.save(output, format="PNG")
|
||||
success = img.loadFromData(output.getvalue())
|
||||
except Exception as e:
|
||||
pass
|
||||
# if still nothing, go with default image
|
||||
|
@ -1 +1 @@
|
||||
1.1.15-beta
|
||||
1.1.16-beta-rc
|
||||
|
@ -1,7 +1,7 @@
|
||||
#PYINSTALLER_CMD := VERSIONER_PYTHON_PREFER_32_BIT=yes arch -i386 python $(HOME)/pyinstaller-2.0/pyinstaller.py
|
||||
#PYINSTALLER_CMD := python $(HOME)/pyinstaller-2.0/pyinstaller.py
|
||||
PYINSTALLER_CMD := pyinstaller
|
||||
TAGGER_BASE ?= $(HOME)/Dropbox/tagger/comictagger
|
||||
TAGGER_BASE ?= ../
|
||||
TAGGER_SRC := $(TAGGER_BASE)/comictaggerlib
|
||||
|
||||
APP_NAME := ComicTagger
|
||||
@ -11,7 +11,7 @@ MAC_BASE := $(TAGGER_BASE)/mac
|
||||
DIST_DIR := $(MAC_BASE)/dist
|
||||
STAGING := $(MAC_BASE)/$(APP_NAME)
|
||||
APP_BUNDLE := $(DIST_DIR)/$(APP_NAME).app
|
||||
VOLUME_NAME := $(APP_NAME)-$(VERSION_STR)
|
||||
VOLUME_NAME := "$(APP_NAME)-$(VERSION_STR)"
|
||||
DMG_FILE := $(VOLUME_NAME).dmg
|
||||
|
||||
all: clean dist diskimage
|
||||
@ -21,6 +21,7 @@ dist:
|
||||
$(PYINSTALLER_CMD) $(TAGGER_BASE)/comictagger.py -w -n $(APP_NAME) -s
|
||||
cp -a $(TAGGER_SRC)/ui $(APP_BUNDLE)/Contents/MacOS
|
||||
cp -a $(TAGGER_SRC)/graphics $(APP_BUNDLE)/Contents/MacOS
|
||||
cp $(MAC_BASE)/libunrar.so $(APP_BUNDLE)/Contents/MacOS
|
||||
cp $(MAC_BASE)/app.icns $(APP_BUNDLE)/Contents/Resources/icon-windowed.icns
|
||||
# fix the version string in the Info.plist
|
||||
sed -i -e 's/0\.0\.0/$(VERSION_STR)/' $(MAC_BASE)/dist/ComicTagger.app/Contents/Info.plist
|
||||
|
@ -1,3 +1,8 @@
|
||||
---------------------------------
|
||||
1.1.16-beta-rc - 07-Apr-2017
|
||||
---------------------------------
|
||||
* Fix ComicVine SSL problems (issue #87)
|
||||
|
||||
---------------------------------
|
||||
1.1.15-beta - 13-Jun-2014
|
||||
---------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user