automate "retrieve metadata"/"create parent item"
Now that retrieve metadata is working a lot better, I wanted to bring up the idea of automatically running it when users add a top-level PDF again. This could also move into the direction of an oft-requested "watch folder".
I also still think with retrieve metadata failing we should create an empty parent item - and probably default that to journal article.
The only real downside I see is that a user may want to drag a PDF to an item but drags it to a standalone position and then has to wait for retrieve metadata to finish and move the PDF. That seems rare enough to ignore.
Thoughts, concerns?
I also still think with retrieve metadata failing we should create an empty parent item - and probably default that to journal article.
The only real downside I see is that a user may want to drag a PDF to an item but drags it to a standalone position and then has to wait for retrieve metadata to finish and move the PDF. That seems rare enough to ignore.
Thoughts, concerns?
I'm all for automating this though.
In all of these cases, I'm not totally sure what the logic is — mtime since the last check? Then if a file is edited it gets imported again. But ctime probably isn't sufficient, since some software might set ctime based on the wherever the file came from instead of the local time. If we do this, do we also need an option on child PDFs to regenerate parent metadata from the PDF? Or do you have to disassociate first, delete the parent item, and then re-recognize? (If the former, it would be handy for more things than just transient recognition failures — it could be helpful for imported libraries, etc. But it'd probably need to use the merge window to show the differences before overwriting.
As for the watched folder - I had never looked into that. ZotFile has a sort-of watched folder feature, not sure what Joscha is doing.
Alternatively, Zotero, could keep track of which files have already been imported by file path and checksum (say MD5). This way, one could avoid re-importing after renaming the PDF or modifying its content somehow. In the case of renames and importing as link, Zotero could automatically adjust the links. In case of modifications and importing normally, Zotero could re-import (though that's possibly a bad idea). The downside is that this is somewhat complicated and ugly internally (I'd say it's worth the hassle for a smooth UX)
***At some point in the future
window.ZoteroPane.document.getElementById('zotero-items-tree').addEventListener('focus', Zotero.ZotFile.watchFolder, false);
So whenever the 'zotero-items-tree' get's focus, I poll. The idea that the pop-up only makes sense when the user is working with Zotero.
It looks like there's actually a more efficient way to do this on Windows, but I think on OS X and Linux we'd have to stat all the files individually:
https://developer.mozilla.org/en-US/docs/JavaScript_OS.File/OS.File.DirectoryIterator_for_the_main_thread#Example.3A_Sorting_files_by_last_modification_date
As an alternative, though, in Firefox we could just watch for downloads. I'm not sure what the current capabilities are for Chrome and Safari extensions — it's possible we could have one or both of the connectors watch for downloads and notify Standalone.