Coder Social home page Coder Social logo

wileyyugioh / zotmoov Goto Github PK

View Code? Open in Web Editor NEW
366.0 6.0 6.0 8.24 MB

Zotero plugin to automatically move attachments and link them

License: GNU General Public License v3.0

Fluent 3.15% JavaScript 86.51% HTML 6.20% PowerShell 0.21% Python 3.94%
zotero zotero-plugin

zotmoov's Introduction

ZotMoov

A simple plugin for managing attachments in Zotero 7

ZotMoov can:

  • Automatically move/copy imported attachments into a custom directory
  • Manually move/copy imported attachments to/from a custom directory via right-clicking
  • Automatically delete linked attachments from your computer when you delete them in Zotero
  • Easily attach the last modified file in a folder to a Zotero item

Installation

Download the latest release here

  • If using Firefox you have to right click the .xpi and save link as.

And set the ZotMoov directory to the folder you want to move/copy files to.

It is highly recommended to

  1. Make a local backup before mooving your library
  2. Give ZotMoov its own folder that other applications will not alter
  3. Uncheck "Sync attachment files in My Library" in the Sync settings if you do not plan to use Zotero's cloud file storage
  4. If planning to sync across multiple devices, set the Linked Attachment Base Directory to the synced folder on each computer.

Settings

Click here for a complete description of the ZotMoov settings

FAQ

Migrating from ZotFile

ZotMoov should not break any existing linked files from ZotFile. But to be sure, before updating to Zotero 7 make a local backup of your library and of your ZotFile folder.

The ZotMoov data directory can be the previous ZotFile directory if you don't mind new files being mixed with the old ones, or a brand new data directory if you like to keep things separate.

For any ZotFile tablet files, you can recover them using the official ZotFile Recovery plugin.

One problem that might arise is the Linked Attachment Base Directory. If you were using this feature before (check in Settings > Advanced > Files and Folders > Linked Attachment Base Directory) you may need to change the base directory to a folder that contains both the ZotFile files and the ZotMoov files.

The easiest way to accomplish this is to simply reuse the ZotFile folder or put the ZotMoov folder inside the previous ZotFile one. For example, the ZotMoov data folder will be ZotFile/ or ZotFile/ZotMoov/ respectively.

File Renaming

I recommend using the automatic file renaming functionality included in Zotero 7. It has support for custom patterns.

Moving Files in Group Libraries

Zotero does not support linked files for group libraries, so ZotMoov can only move files in your personal library. Any linked files pointing to group libraries that are somehow created will be broken. The copy feature is unaffected by this limitation.

Bugs/Feature Requests

Both can be filed here. Please keep feature requests tightly focused on the extension's core purpose of mooving attachments and linking them!

zotmoov's People

Contributors

redleafnew avatar wileyyugioh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zotmoov's Issues

Copying an Item that is in multiple Collections

I have noticed that if an item is in multiple collections within Zotero, then the copying function doesn't work as expected. It should only copy that item from the opened collection to the folder of same name. However, it makes a new folder with name of other collections as well, and then only copies the pdf to the original collection.

I would be okay if it copied the selected item to all relevant collections, but it only copies it from the collection where the file was saved initially.

I hope my explanation made sense. Happy to clarify further if needed.

彻底删除附件后,在文件夹中pdf文件仍然保留

当彻底删除文件(回收站中永久删除)后,附件仍然保留在链接的文件夹中,日积月累zotero中看不到“死链”文件会越来越多,建议回收站中彻底删除后,文件夹中对应的文件和目录也彻底删除,谢谢!

Add "Get from Tablet" equivalent feature

Thanks for your work on this extension! 😄

Zotfile had a "Get from Tablet" feature that would copy attachments out of the syncing folder and back into internal Zotero storage. Is that something you'd be interested in adding here?

For some context on my usage model, I used to use Zotfile's "Send to Tablet" to move attachments I wanted to read on my tablet to a shared syncing folder. I would then read / annotate on my tablet, then move back to Zotero internal storage when done with that item. Zotmoov's copy mode seems to be roughly the same as "Send to Tablet", so that covers the first half of my workflow. As far as I can tell though, there doesn't seem to be any "copy from shared storage back to Zotero internal and remove from shared storage" feature currently, so that's why I've filed this issue.

If you're not interested in supporting such a mode, that's okay of course, just let me know! 🙂 I may fork this add-on or create my own to support it if needed.

Subfolder not deleted after unlinking files and deleting them with zotmoov

When converting a linked file back to Zotero and deleting the file in the external folder as well, the subfolder is not deleted and stays empty in the folder for linked files.

--> When converting a linked file to a file stored in Zotero, deleting the originally linked file in a subfolder, the subfolder should be deleted as well if empty.

Thank you!

Is there a way to "retrieve" a file back to my Zotero?

Hi, I just upgraded to Zotero 7 and was sorry to see Zotfile is discontinued, so was keen to test out Zotmoov as a replacement. I've added the Zotmoov plugin, and see that I can select a file and "Move to Selected Directory", which is useful - but is there any way to "retrieve" that file document once I've finished reading it and it gets added back to the right location within my Zotero library, and adds a note of the annotations I made on the document? This was a wonderful feature of Zotfile, so really hoping I can replicate that workflow here. Is the main workaround just to do it manually? Thanks, Samantha

Select which type of attachment to store

Zotmoov works great. However, there is uncertainty about which attachments are stored and which are not. And I think I would only like to have PDFs stored outside of Zotero.

The background is that the Zotero parent item can hold notes and other files with additional information. Some entries only have snapshots (HTML).

Zotmoov does not seem to export and link the notes, but it exports and links HTML files and snapshots besides PDFs. I would like to have these in Zotero; only PDFs that follow the naming convention for PDFs in Zotero should be exported.

Also, I think epubs can be read in Zotero now; I am not yet bothered about them, but they might be treated like PDFs as well.

new function: customized file saving path

Hi, I am not sure whether following function can be added:

add another move option to the right click manual:
- allows user to choose the folder where he wants to store the file.

Note: I understand that this option exists in the setting window, but adding this to the right click manual make it more intuitive when saving files, especially when he wants to save some files to some special pathes. (if the workload is high, then just ignore this suggestion.)

image

Sync annotated pdf in real time?

Hi,

I am new to both Zotero and zotmoov, I was wondering if my annotations can be synced to my cloud storage. Right now it automatically uploads the pdf without annotations (when I add to my personal library) and I have to save the annotated version and manually add it to cloud storage so if any annotation change made to pdf, it syncs again, is that possible?

"Move Selected From Directory" grayed out

Under what circumstances is "Move selected from directory" not grayed out? It always seems to be grayed out for me, even when I've changed the file in the sync directory recently

Why recommend setting the Linked Attachment Base Directory (in Zotero Preferences) ?

I am unclear on why the current Zotmoov instructions need to recommend setting the Linked Attachment Base Directory (in Zotero Preferences) ?
People can have explicit-path linked file setups that do not need or use the LABD setting. For example if they only work on one computer, or if their linked attachments are at identical paths on all their computers. Zotmoov should work perfectly well with such setups.
The LABD only affects where Zotero looks for linked files when the user asks it to open a PDF in its reader. The LABD has no effect on where a new linked attachment gets stored - the thing that Zotmoov does. That is set by your "Directory to Move Files To".
But once a user does set a LABD in Zotero preferences, that changes how the linked file path is stored in the Zotero database. If done unnecessarily, that could break an existing expicit-path linked file setup.
So to my mind, the Zotmoov instructions should omit any reference to the LABD setting. It deals with a separate issue. Zotmoov presumably functions in exactly the same way regardless of whether a LABD is set or not (does the Zotmoov code use the LABD setting for anything ?).
You could simply link to the Zotero instructions on the LABD, making it clear that it is only really needed for Zotero to find linked files on different computers when those files have different parent folder names.
Zotero users can get confused with linked file setups - for example the above difference between where the files get stored and where Zotero looks when opening them. Including the LABD in the plugin instructions doesn't help with that confusion.

插件与同步功能存在冲突

Zotero7最新版,插件最新beta版,设置为“新增时自动移动附件”并且File behavior 设置为MOVE,当新增一个Stored Files(此时软件开始将该文件上传到zotero服务器),同时,插件将Stored Files移动到靶目录并修改为Linked Files。于是本地和云端形成冲突,会跳出一个对话框问你保存本地还是云端。。
经过测试,先关闭软件自动同步功能,再添加文件,等插件移动完了再开启同步就不会有冲突问题,但这样就非常不方便,一旦添加很多文件,后面忘了开同步就会漏同步,建议插件增加一个移动前自动暂停同步,移动后再开启自动同步的功能,谢谢!

Subfolder named with citation key not updated according to changes in Zotero

I tested creating subfolders with the name of the citation key and observed the following:

  1. When I change the citation key in Zotero, the subfolder name is not updated.
  2. When unlinking the file (convert to stored file again), the folder stays, though empty when the file is deleted by zotmoov.

--> I imagine that other subfolder naming conventions will also not reflect the changes in Zotero, making the system somewhat unreliable.

--> zotmoov follows the renaming of linked files (if renamed in Zotero, the linked file -- HTML and PDF -- is also updated. So this is reliable.

For the time being, it seems best to work without subfolders and manually link files individually to keep snapshots alive in Zotero.

Thanks!

Switch to Zotmoov for Zotfile users

What is the recommended procedure to switch to Zotmoov in Zotero 7 for users who use Zotfile in Zotero 6 and therefore already have linked files in a custom location (the filenames are the Zotfile default)?

Request: step-by-step "for dummies" guide for switching from zotfile

Hello, I am a long-time user of zotfile to move attachments to a Dropbox folder and create a link to the attachment. I would like to upgrade to Zotero 7, but am worried that without zotfile I will lose all the links.

Would it be possible to provide in your FAQ a step-by-step "for dummies" guide to making the switch while keeping all links? I see that you gave a basic "no worries" in a now-closed issue but with a few thousand linked PDFs I am terrified that I will mess something up.

Replicate Send to Tablet and Get from tablet from Zotfile

Hi,

I think there is a big group of people waiting for functions "Send to Tablet" and "Get from tablet" from Zotfile to be implemented in either Attanger or Zotmoov, see https://forums.zotero.org/discussion/116679/zotero-7-and-zotfile

I believe Zotmoov has all the necessary functionalities already available. In Zotfile it worked like this:

  1. By right clicking on a certain item in library, you had available option to "Send to Tablet"
  2. If clicked, this assigned a tag to the item → _tablet and copied the file to specified directory in the settings
  3. Then we markup on tablet, selecting and annotating a PDF in that specified directory
  4. By right clicking on that item in library again, we have available option to "Get from Tablet" which pulls selections and annotations in PDF and extracts them as notes, and takes away the _tablet tag, and it moves the annotated copy of the original file to the storage (which now has +1 pdf files, one of them is the annotated one).

Thank you for consideration!
All the best

Options for Subdirectories

Hi,
I just moved from Zotfile, where I had files in subdirectories named with multiple authors, not just the first. Is this possible in Zotmoov? It'd be nice to have the full set of renaming options / settings form Zotfile. https://zotfile.com/#renaming-rules

Similarly, right now I'm using the %F wildcard, but it'd be nice to have some other wildcards like author first initial so that you can have a separated author tag (e.g., Doe, J instead of DoeJ).

This might be possible already?--apologies if it is.

zotmoov on group libraries?

Zotmoov works efficiently on personal libraries (default My Library on Zotero), but I cannot manage to move files automatically for group libraries. Is this a known missing functionality?

Thanks a lot

不错的插件

正好需要,有一个zotero插件开发团队微信群,茉莉花的作者也在里面,有兴趣加入吗?

Request: Subdirectory setting for moving files manually

Hello,

Thank you for building this extension. It is proving to be very helpful.

When I decide to read a paper, I want to be able to move it into a subdirectory called "Reading". At the moment, when I right-click on the PDF file and select "Move to selected custom directory", a pop-up window appears so that I can choose a directory. But this will get tedious if I have lots of files to move. I would like to be able to set the directory name in the settings, and just select a menu item to move to that directory.

I have tried putting the directory name into the "Automatically move/copy files to subdirectory" setting, but I have that setting turned off because I don't want the files to be moved there automatically. And it doesn't seem to pick up the directory name I have entered when the setting is turned off.

Is this making any sense?
Also, thank you for writing this extension. :D

pdf is not moved automatically

When saving link from the chrome connector, the associated pdf is not moved to the destination folder automatically.

Also, when I mannually move, the link name is not set to the same as the file name (after auto renaming).

zotmoove.js PathUtils error

Not sure how to use github to report this, but on line 95 of zotmoove.js it says:

clone.setField('title', PathUtils.filename(clone.attachmentPath));
However, I believe it should be

clone.setField('title', PathUtils.filename(final_path));
because final_path is a full path that PathUtils can work with, but clone.attachmentPath is not. Move was not working for me until I made this change for myself.

Create custom subfolders

One of the more useful features Zotfile offers for large PDF libraries is the ability to sort files into alphabetic subfolders. The collections option within Zotero doesn't exactly accomplish this and, as noted, runs the risk of creating duplicate locations. Would it be possible to get something similar with this plugin?

Help - shit - I've moved html files

Hi,

When I used ZotFile, I had a procedure that, from time to time, I would select my whole Zotero library and ask to rename/move it. This would make eventual single PDF files stored in the Zotero storage to be moved to my custom folder. I would do this because ZotFile was not always reliable in doing that automatically when I saved a file via the browser addon (Firefox). In this procedure, ZotFile wouldn't touch the HTML files (webpages) though, only the PDFs.

It turns out that I've done this more or less automatically yesterday with ZotMoov / Zotero 7, and the HTML files were also moved to my custom folder. If at least they were linked - as it happens with the PDF ones -, I could have even enjoyed this procedure. But the problem is that they are not. Zotero still wants to find the HTMLs in the original folder. If I manually move every single HTML back to their original folder, it works just fine. But we are talking about 659 files... Is there any way to reverse the move?

Thanks!

能不能像zofile那样监视文件夹及复制到zotero,而不是链接

如图,
1、直接监视文件夹,下载的文件一键添加附件或链接附件

image

image

2、选择是链接文件还是复制到zotero数据储存目录里面,如图

第一个是复制到zoter数据储存目录里面,复制到zotero里面用于Web DAV同步。
红色的下面的那是链接到文件夹,用不了web DAV同步。

image

谢谢!!

Request: Wildcard for year added on zotero

Great extension! However, I am currently missing a (for me) quite useful wildcard.

I would like to move the attachments to a specific directory and use zotmoov to organise the attachments based on the year I added them on Zotero. In the ZotMoov Wildcard Formatting I could not find such option (only publication year %y ) and I was wondering if it would be possible to add such feature

FileNotFoundError (file exists)

This time, a real issue...

I am getting a lot of these:
image

The file does exist in the path, as is visible here:
image

Manually copying the pdf to the specified location does work. For some reason, other files do work when moving. (PS, my target is a mapped network drive from my Synology NAS)

More Options for Handling Duplicates

Currently, it creates a new pdf with -1 at the end. Would it be possible to have more customization, where:

  1. It would create a new file with " - 1" at the end as it does now
  2. Do not copy the file if it already exists
  3. Overwrite the previous copy, and show an error if overwrite fails

Please let me know if this sounds like a good feature to implement :)

Unable to move file via right-click menu

I just installed the latest 1.1.9 release, and it seems to fail and log an error when selecting "Move Selected to Directory" from the right-click menu:

[JavaScript Error: "TypeError: thisCache.zotmoov is undefined" {file: "jar:file:///Users/jryans/Library/Application%20Support/Zotero/Profiles/vny72kh7.default/extensions/[email protected]!/src/03-zotmoov-menus.js" line: 57}]
load/<jar:file:///Users/jryans/Library/Application%20Support/Zotero/Profiles/vny72kh7.default/extensions/[email protected]!/src/03-zotmoov-menus.js:57:13

[FR] Move to the subfolder relative to the root path

Thanks for this life-saving plugin when the ZotFile/Zotero-File is not available in Zotero 7.

I am thinking if you have time to implement the following behavior like ZotFile does:
Move the PDF attachment into the subfolder relative to the root path specified in the settings.

图片

For example, I set the location for the PDF files as /pdf/root/path in the settings of this plugin, and I have one item added in the Course-ELEC5110 subfolder in Zotero. Both ZotFile and Zotero-File can move the PDF file into /pdf/root/path/Course-ELEC5110. However, this plugin moves the PDF file into /pdf/root/path instead.

Thank you.

Request: Additional option for remaining the Attachment Title (instead of directly change it to the same as filename?)

First, thank you for your contribution to such a powerful tool. It helps me a lot in moving to Zotero 7. Currently, it works quite well for me and behaves just the same as the ZotFile functions. However, I found that the Zotero 7 developers recommended distinguishing the Attachment Title and Filename. I also believe that it would be nice to show different titles for the attachment, which can provide more information.

However, currently, it seems that when moving the attachment with ZotMoov, the attachment name is also modified. This is a nice feature that helps people move to Zotero 7 (indeed, I also recommended this feature to friends). Nevertheless, is it possible to leave an option to keep the attachment name unchanged (such as "PDF" or "EPUB")?

Last but not least, I found that when an attachment becomes a link and is renamed with ZotMoov, the attachment title did not change (I use citationKey as the renaming rule, and after changing the citationKey and using move selected to directory with a right-click, the attachment title does not change). The two questions seem related, and I hope they can be solved. Thanks.

Feel free to ask if you need further clarification!

Best regards

conditional folder

Hi,
I would like some help to use the conditional moving to a specific folder. Specifically, I want to have the files moved to a folder according to the first author's last name. But if this is not available I want to move to a folder named "unspecified". Can you please tell me what I should write to the section "subdirectory string default" to achieve this?

Thanks in advance!

Request: Full date wildcard

Add a full date wildcard. The behavior would be to use the full date if available, falling back to yyyy-mm or yyyy if not. I could take a stab at this and submit a pull request. Since %D and %d are already used, my suggestion is %g (for Gregorian, the best I could come up with).

I work with newspaper clippings and I'd like my directory structure to include the full date of publication. I'm currently using year ({%c}/{%y} - {%t}) which is okay but I'd prefer the complete date.

edit: I neglected to mention how much I appreciate this plug-in. It's saved me hours of work and kept me organized. Thanks!

Request: Add full description of right-click Move Selected to Directory to FAQ

For some previous Zotfile users who used/did not use its right-click Rename and Move option, it may not be clear to them that Zotmoov has that option too (just without the renaming). It's only mentioned very briefly in the first few lines of the current instructions: "Manually move/copy imported attachments into a custom directory via right-clicking". A fuller description along with the other functions (with screen shot) would be good.

Automatically move new files

I am not sure if it already exists, I can't find it... Maybe I am just blind.

It would be nice if the files would automatically be moved instead of having to do it manually, just like Zotfile did.

move the pdf attachments and link them

would you add a feature that can move the pdf attachments to the "folder" and link them.
the feature will allow exporting attachments of items in the Zotero Library or selected collection as files organized in "folders". The exported attachments (files) will be organized in "folders" which reflect the hierarchical structure of the selected Zotero Library/Collections.
For example, a reference is in "My Library/A/B", and "move the pdf attachments and link them" will move the PDF to "zotero home directory/A/B" folder, and link it.

this maybe is helpful. https://github.com/retorquere/zotero-file-hierarchy

thank you

Request: Add Zotfile's Attach New File operation

As I understand it, Zotmoov does not currently include Zotfile's Attach New File option ?
In Zotfile, that right-click option looks to the nominated folder (not the same as the 'move to' folder) and finds the latest-dated file there (from the allowed file types list). It then asks the user if they wish to add that named file to the currently selected item (and move the file from that folder to the 'move to' folder as a linked file).
It is very useful when PDFs have to be added in ways other than automatically by the Zotero web connector (eg on sites where the connector fails to get the PDF and it has to be manually downloaded).

html attachments (snapshots) cannot be re-converted to stored files

When marking multiple entries to create linked files from stored files, snapshots (HTML) are also exported and linked.

(1) When testing zotmoov, after linking files of entries, I used the Tools > Manage Attachments > Convert Linked Files to Stored Files command, which works well with PDFs and restores them in Zotero storage. However, snapshots (HTML files of a web page) are restored in a first step but immediately re-linked with file name addition 1. I have to stop Zotmoov, manually return the file, and rename it to get snapshots back.

(2) When linking snapshots, Zotero cannot check that they are snapshots (and cannot give them their icon), so I never get the snapshot icon back for these items.

(3) I would rather have snapshots kept in Zotero storage than linked together with PDFs. My last issue (#16) is with the above behavior in mind.

Thank you very much for your work!

Filename Format Does Not Follow Zotero Settings

The plugin is supposed to follow the filename format according to what is set in the Zotero settings, but it is not. I have changed the default naming scheme from
{{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }}
to
{{ authors max="1" suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="150" }}

However, the plugin still names the files according to the {{ firstCreator suffix=" - " }}{{ year suffix=" - " }}{{ title truncate="100" }} formatting.

adding batch move function

希望作者可以添加batch move的功能. 目前虽然可以使用batch move点击操作, 但似乎无法真正执行. 只有移动单个文件的时候, 文件移动才会真正执行.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.