More PDF tools tweaks

- If one tool is missing, reinstall it automatically during translator
  update check
- Account for pdfinfo 3.02pl1 on Linux
This commit is contained in:
Dan Stillman 2015-04-01 16:23:12 -04:00
parent 1a47d79716
commit e567ad25aa
3 changed files with 20 additions and 8 deletions

View file

@ -187,13 +187,17 @@ Zotero_Preferences.Search = {
var converterVersionAvailable = (!converterIsRegistered ||
Zotero.Fulltext.pdfConverterVersion == 'UNKNOWN'
|| latestVersion > Zotero.Fulltext.pdfConverterVersion
|| (latestVersion != '3.02' && Zotero.Fulltext.pdfConverterVersion == '3.02')
|| (latestVersion != '3.02' && latestVersion != '3.04' && Zotero.Fulltext.pdfConverterVersion == '3.04'));
|| (!latestVersion.startsWith('3.02')
&& Zotero.Fulltext.pdfConverterVersion.startsWith('3.02'))
|| (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
&& Zotero.Fulltext.pdfConverterVersion == '3.04'));
var infoVersionAvailable = (!infoIsRegistered ||
Zotero.Fulltext.pdfInfoVersion == 'UNKNOWN'
|| latestVersion > Zotero.Fulltext.pdfInfoVersion
|| (latestVersion != '3.02' && Zotero.Fulltext.pdfInfoVersion == '3.02')
|| (latestVersion != '3.02' && latestVersion != '3.04' && Zotero.Fulltext.pdfInfoVersion == '3.04'));
|| (!latestVersion.startsWith('3.02')
&& Zotero.Fulltext.pdfInfoVersion.startsWith('3.02'))
|| (!latestVersion.startsWith('3.02') && latestVersion != '3.04'
&& Zotero.Fulltext.pdfInfoVersion == '3.04'));
var bothAvailable = converterVersionAvailable && infoVersionAvailable;
// Up to date -- disable update button

View file

@ -339,7 +339,7 @@ Zotero.Fulltext = new function(){
case 'info':
// Modified 3.02 version doesn't use redirection script
if (version == '3.02') break;
if (version.startsWith('3.02')) break;
var script = Zotero.getZoteroDirectory();
script.append('pdfinfo.' + _getScriptExtension())
@ -600,7 +600,7 @@ Zotero.Fulltext = new function(){
cacheFile.append(this.pdfConverterCacheFile);
// Modified 3.02 version that can output a text file directly
if (_pdfInfo && _pdfInfoVersion == '3.02') {
if (_pdfInfo && _pdfInfoVersion.startsWith('3.02')) {
var infoFile = cacheFile.parent;
infoFile.append(this.pdfInfoCacheFile);

View file

@ -1606,18 +1606,26 @@ Zotero.Schema = new function(){
if (Zotero.Fulltext.pdfInfoIsRegistered()) {
let currentVersion = Zotero.Fulltext.pdfInfoVersion;
if (currentVersion < availableVersion || currentVersion == '3.02'
if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|| currentVersion == 'UNKNOWN') {
installInfo = true;
}
}
// Install missing component if one is installed
else if (Zotero.Fulltext.pdfConverterIsRegistered()) {
installInfo = true;
}
if (Zotero.Fulltext.pdfConverterIsRegistered()) {
let currentVersion = Zotero.Fulltext.pdfConverterVersion;
if (currentVersion < availableVersion || currentVersion == '3.02'
if (currentVersion < availableVersion || currentVersion.startsWith('3.02')
|| currentVersion == 'UNKNOWN') {
installConverter = true;
}
}
// Install missing component if one is installed
else if (Zotero.Fulltext.pdfInfoIsRegistered()) {
installConverter = true;
}
let prefKey = 'pdfToolsInstallError';
let lastTry = 0, delay = 43200000; // half a day, so doubles to a day initially