Additional logging for PDF annotation import
This commit is contained in:
parent
59969d1a7b
commit
d76cf829b1
1 changed files with 9 additions and 1 deletions
|
@ -237,12 +237,17 @@ class PDFWorker {
|
||||||
async import(itemID, isPriority, password, transfer) {
|
async import(itemID, isPriority, password, transfer) {
|
||||||
return this._enqueue(async () => {
|
return this._enqueue(async () => {
|
||||||
let attachment = await Zotero.Items.getAsync(itemID);
|
let attachment = await Zotero.Items.getAsync(itemID);
|
||||||
|
|
||||||
|
Zotero.debug("Importing annotations for item " + attachment.libraryKey);
|
||||||
|
let t = new Date();
|
||||||
|
|
||||||
if (!attachment.isPDFAttachment()) {
|
if (!attachment.isPDFAttachment()) {
|
||||||
throw new Error('Item must be a PDF attachment');
|
throw new Error('Item must be a PDF attachment');
|
||||||
}
|
}
|
||||||
|
|
||||||
let mtime = Math.floor(await attachment.attachmentModificationTime / 1000);
|
let mtime = Math.floor(await attachment.attachmentModificationTime / 1000);
|
||||||
if (!transfer && attachment.attachmentLastProcessedModificationTime === mtime) {
|
if (!transfer && attachment.attachmentLastProcessedModificationTime === mtime) {
|
||||||
|
Zotero.debug("File hasn't changed since last-processed time -- skipping annotations import");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +316,10 @@ class PDFWorker {
|
||||||
|
|
||||||
attachment.attachmentLastProcessedModificationTime = mtime;
|
attachment.attachmentLastProcessedModificationTime = mtime;
|
||||||
await attachment.saveTx({ skipDateModifiedUpdate: true });
|
await attachment.saveTx({ skipDateModifiedUpdate: true });
|
||||||
|
|
||||||
|
Zotero.debug(`Imported ${imported.length} annotation(s) for item ${attachment.libraryKey} `
|
||||||
|
+ `in ${new Date() - t} ms`);
|
||||||
|
|
||||||
return !!(imported.length || deleted.length);
|
return !!(imported.length || deleted.length);
|
||||||
}, isPriority);
|
}, isPriority);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue