GithubHelp home page GithubHelp logo

zotutil's Introduction

ZotUtil

This is a repository of utilities to assist the use of Zotero and its plugins via pyzotero.

Utilities

  • Unlinked Files Clean

    • Motivation

      This is to resolve situations when attachment files are left behind whilst their formerly linked entries have been deleted from the Zotero library. This happens when the Linked Files is used, most likely together with ZotFile.

    • Functions

      clean unlinked files
      ├── relocate unlinked files
      ├── remove unlinked files
      └── restore unlinked files
  • Tags Case Unification (To Do)

    • Motivation

      This is to resolve situations when literally same tags co-exist in different cases (e.g. climate change, Climate change & Climate Change), due to diverse bibliography import sources and the case sensitivity in Zotero. Some regard this as a feature though, see discussion here.

zotutil's People

Contributors

airallergy avatar

Stargazers

 avatar marijane white avatar

Watchers

 avatar

zotutil's Issues

Empty directories removal not complete when nested

If the directory structure is like

folder a
├── folder b1
│   └── file c1
├── folder b2
│   └── folder c1
│       └── folder d1
└── file b1

only folder d1 will be removed currently, while folder b2 & folder c1 should also be removed.

Empty directories removal verbose

#4 nested empty directories can be removed, but one path could be checked over once, which could raise error due to non existence after the first removal.

Add the option to relocate unlinked files to the same directory each time

Add the option to define a suffix to the relocation directory name, if None, unlinked files will be relocated to the same directory every time, otherwise, a directory with some suffix, such as the timestamp currently.

The logic would be:

  1. check if the specified directory exists, create if not;
  2. check if the map file exists, read if does;
  3. do the relocation.

Besides, might need to deal with files with the same name, need to check how pathlib does about it.

A bit restructure required to deal with the unlinked files

  1. Relying on the nuance between remove and delete can cause confusion.
  2. There should be a separated function to put unlinked files together, and a function to combine it and the permanent deletion, like the current remove_unlinked_files.

Occasion of duplicates when relocation

Mentioned in #2. This would happen only when no distinguished relocation folder suffix is used.

pathlib will silently replace the duplicate if one, a bit strategy should be applied to address this.

One solution would be:

  1. check if the renamed path exists;
  2. if exists, check if they have the same pre-relocation path;
    3a. if yes, delete the to-be-relocated unlinked file, and leave no entry in the relocation map;
    3b. if not, add a suffix to the filename, and do the relocation.

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.