View Single Post
Old 03-28-2015, 04:43 PM   #47
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,829
Karma: 30277270
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by PeterT View Post
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

Last edited by BetterRed; 03-29-2015 at 05:16 AM. Reason: significant typo
BetterRed is offline   Reply With Quote