OCR-D / core

Collection of OCR-related python tools and wrappers from @OCR-D

Home Page:https://ocr-d.de/core/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

undo-download: does not remove files, but removes sole refs

bertsky opened this issue · comments

if undo_download and f.local_filename:

This implementation is strange:

  1. if it encounters a file ref without any URL FLocat (i.e. if the file was created by OCR-D itself as output of a processor), then it will still just remove the ref (and thus destroy the information).
  2. it never actually removes files from the filesystem (even the ones it unreferenced).

How is this supposed to be used then?

if it encounters a file ref without any URL FLocat (i.e. if the file was created by OCR-D itself as output of a processor), then it will still just remove the ref (and thus destroy the information).

That's an oversight, the local FLocat should not be removed if it is the only ref.

On the same note, the behavior of (bulk-)add is currently also wonky, creating both URL and FILE mets:FLocats.

it never actually removes files from the filesystem (even the ones it unreferenced).

It just didn't occur to me, I wanted to make the downloads reversible on the METS level but we can add the option to actually remove the files.

It just didn't occur to me, I wanted to make the downloads reversible on the METS level but we can add the option to actually remove the files.

Then for the sake of consistency I recommend doing the opposite: making the filesystem action the default and adding an option -k, --keep-file Do not delete file from file system.

It just didn't occur to me, I wanted to make the downloads reversible on the METS level but we can add the option to actually remove the files.

Then for the sake of consistency I recommend doing the opposite: making the filesystem action the default and adding an option -k, --keep-file Do not delete file from file system.

Alternatively, we could implement a generic-purpose command clean, complementary to prune-files and undo-download: removing files in the workspace which are not referenced in the METS.