Quote:
Originally Posted by PeterT
Just to explain a few things
for /r says scan the current directory and all sub directories
"%1" ensures that if the matched file name contains spaces there are no issues
%~p1 extracts the directory name
%~n1 extracts just the file name (with no path or extension)
AH... I could have simplified
Code:
for /r %1 in (*.original_epub) do 7za a "%~p1""%~n1".7z "%1"
to
Code:
for /r %1 in (*.original_epub) do 7za a "%~pn1".7z "%1"
|
@
PeterT - after packing the original-epub into the 7z and removing it, would one not need tell calibre about the removal of the original_epub and the addition of the 7z? And after extracting the original_epub, wouldn't one need to do the same - tell calibre the original epub is there?
To do the 'telling calibre' of changes to available formats, I think one would need the calibre book row number - which is available from the book folder name or the adjacent metadata.opf file.
If calibre's not told of the changes then the Library Maintenance->Check Library should throw exceptions.
@
cybmole - you've known about this issue for quite a long time, yet it seems you have persisted with your 'misuse' of the ORIGINAL_EPUB for purposes other than that for which it was designed. If this is now creating you problems, then welcome to the world of 'How recalcitrance can lead to unintended consequences'. Political history is littered with examples - Charles I and Louis XVI are just two that spring to mind, I won't mention those of more recent times.
ORIGINAL_FMT files are never going to be what you want them to be, any more than the earth will become flat. So why don't you bite the bullet and implement your own scheme for securing the format as originally downloaded, as many others have done on realising they've misunderstood the purpose of ORIGINAL_FMT files.
Me, I create the book with say blah-blah.epub, I then rename blah-blah.epub to blah-blah.epub_orig and add that to the newly created book, there's not much can be done in calibre with a XXXX_ORIG format - but at least I know where it is should I ever want it. And I tweaked ORIGINAL_FMT files off, preferring to rely on my backup regime as I do for all other data.
BR