Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-02-2015, 12:47 PM   #16
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
Quote:
Originally Posted by BetterRed View Post
@loviedovie - Maybe - I've never had any dvju format files.

But I suspect the problem is that the file name contains 'truncated' titles as in - "The artistic anatomy of trees, their struc" whereas the title in the metadata is presumably "The artistic anatomy of trees, their structure & treatment in painting".

I'm not sure what constitutes a 'duplicate' in the Add process. What happens if the title & author are not truncated in the file name, e.g - "Some Title - Some Author.djvu"

BR
Yeah that might be it. The title is truncated but not the author. In any case Calibre should be able to detect that the file name is pretty close given that the author is the same.

When I put the full file name , it adds as a duplicate so it works. But the thing is that I did not set these file names my self, Calibre truncated the file names on the file system and the converted djvu are named after whatever pdfs there were in the Calibre database folders.


This would have been a perfect solution for me since I have not done any Python coding for years ;(

Last edited by loviedovie; 06-02-2015 at 12:49 PM.
loviedovie is offline   Reply With Quote
Old 06-02-2015, 04:43 PM   #17
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,738
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@loviedovie - calibre munges the book title and author names to accommodate the vagaries of the different operating/file systems it supports. The shortening is done to fit names into Windows 255 (ish) path length limit. IIRC the loss of diacritics and 'conversion' of non latin characters (Greek, Cyrillic etc) to ASCII is done in order to maintain compatibility with some Linux file systems.

You could try something along these lines
  • delete all the djvu's in the library book folders;
  • save the pdfs to a flat folder with template {title} - {authors} using Save to Disk;
  • write a bash script to convert the pdf files to djvu files, with same file names;
  • delete the pdfs;
  • use the Add books from single directory to add the djvu files, with appropriate Add Books settings.
FWIW - to reduce the incidence of shortened file names, I truncate Titles by putting subtitles and straplines into a custom column, so for that sample previously cited, I would have 'The Artistic Anatomy of Trees' in the Title column and 'Their structure & treatment in painting' in my Strapline column.

BR
BetterRed is offline   Reply With Quote
Advert
Old 06-02-2015, 05:35 PM   #18
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
@BetterRed

Thanks for the recommendations. I will give it a try.
loviedovie is offline   Reply With Quote
Old 06-02-2015, 05:44 PM   #19
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,738
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by loviedovie View Post
@BetterRed

Thanks for the recommendations. I will give it a try.
@loviedovie I forgot something - you'll probably need to adjust the 'save_template_title_series_sorting' twerk to 'strictly alphabetic'

Click image for larger version

Name:	Capture.JPG
Views:	157
Size:	168.3 KB
ID:	138953

BR
BetterRed is offline   Reply With Quote
Old 06-02-2015, 07:20 PM   #20
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
Thanks for the tip.

What should I use for the saving template? "{title}-{authors}" ?
loviedovie is offline   Reply With Quote
Advert
Old 06-02-2015, 07:51 PM   #21
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
Ok this does not work me either ;(

Actual book
title:Greek Vases in the J. Paul Getty Museum, Volume 3, OPA 2
auth:János Gy. Szilágy


saved pdf: "Greek_Vases_in_the_J._Paul_Getty_Museum,_Volume_3 ,_OPA_2-@-Janos_Gy._Szilagy.pdf"
converted djvu: "Greek_Vases_in_the_J._Paul_Getty_Museum,_Volume_3 ,_OPA_2-@-Janos_Gy._Szilagy.djvu"

save format: "{title}-@-{authors}"

add books regex: "(?P<title>.+)-@-(?P<author>[^_]+)"

This is tested properly with the regex in the add books window meaning that all the underscores are repalced with spaces properly and the author is recognized properly.

I wonder if the new template which replaces spaces with underscores is the issue?
loviedovie is offline   Reply With Quote
Old 06-02-2015, 09:42 PM   #22
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,738
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by loviedovie View Post
Ok this does not work me either ;(

Actual book
title:Greek Vases in the J. Paul Getty Museum, Volume 3, OPA 2
auth:János Gy. Szilágy


saved pdf: "Greek_Vases_in_the_J._Paul_Getty_Museum,_Volume_3 ,_OPA_2-@-Janos_Gy._Szilagy.pdf"
converted djvu: "Greek_Vases_in_the_J._Paul_Getty_Museum,_Volume_3 ,_OPA_2-@-Janos_Gy._Szilagy.djvu"

save format: "{title}-@-{authors}"

add books regex: "(?P<title>.+)-@-(?P<author>[^_]+)"

This is tested properly with the regex in the add books window meaning that all the underscores are repalced with spaces properly and the author is recognized properly.

I wonder if the new template which replaces spaces with underscores is the issue?
@loviedovie - yes, that and the fact that we lost the diacritics on the Authors name.

I created a book with that name and author - good choice btw.

The PDF in the book folder is

Code:
Greek Vases in the J. Paul Gett - Janos Gy. Szilagy.pdf
I saved it with these settings

Click image for larger version

Name:	Capture.JPG
Views:	184
Size:	110.3 KB
ID:	138956

And I got this as the saved file name

Code:
Greek Vases in the J. Paul Getty Museum, Volume 3, OPA 2 - János Gy. Szilágy.pdf
I used these Add Books settings

Click image for larger version

Name:	Capture2.JPG
Views:	188
Size:	142.6 KB
ID:	138957

When I added a DOCX with the name

Code:
Greek Vases in the J. Paul Getty Museum, Volume 3, OPA 2 - János Gy. Szilágy.doc
I got this

Click image for larger version

Name:	Capture3.JPG
Views:	176
Size:	34.0 KB
ID:	138958

And in the book folder I have

Code:
Greek Vases in the J. Paul Gett - Janos Gy. Szilagy.doc
Greek Vases in the J. Paul Gett - Janos Gy. Szilagy.pdf
I think that's what we want - give it a go

BR
BetterRed is offline   Reply With Quote
Old 06-02-2015, 10:38 PM   #23
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
@BetterRed

Thanks for all your help, this works for me Great way to achieve what I needed. This should be a wiki entry

This is my script to convert to djvu. It can be run in a folder. It is linux only and you need pdf2djvu package

#!/bin/bash

fltyp()
{
IFS=$'\n'
filename_full="$1"

filename=$(basename "$filename_full" .pdf)

export DIR=$(readlink -f $filename_full)
DIR=${DIR%/*}
echo $DIR
pdf2djvu -j 4 --lossy -v "$2" -o $DIR/$filename.djvu

}


export -f fltyp

find -type f -name "*.pdf" -exec bash -c 'fltyp "{}" "{}"' \;
loviedovie is offline   Reply With Quote
Old 06-02-2015, 11:45 PM   #24
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,738
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by loviedovie View Post
@BetterRed

Thanks for all your help, this works for me Great way to achieve what I needed. This should be a wiki entry
glad we got there, sorry it took so long. My fault, I didn't pay enough attention to the regex, I forgot the tweak, and the unset of ascii-fication setting in Save

BR
BetterRed is offline   Reply With Quote
Old 06-03-2015, 06:09 PM   #25
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
Quote:
Originally Posted by BetterRed View Post
glad we got there, sorry it took so long. My fault, I didn't pay enough attention to the regex, I forgot the tweak, and the unset of ascii-fication setting in Save

BR

@BetterRed,

You did great help. I was able to add all the Djvus with minor hickups. Hopefully in the future Calibre could detect these additional formats and add them automatically and also it could provide to Djvu conversion as well.
loviedovie is offline   Reply With Quote
Old 06-04-2015, 02:07 AM   #26
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,366
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If all you want to do is get calibre to recognize djvu files in the library folders that are named exactly the same as the PDF files, you can do that by running Library Maintenance and adding the detected extra formats.
kovidgoyal is offline   Reply With Quote
Old 06-04-2015, 11:44 AM   #27
loviedovie
Addict
loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.loviedovie ought to be getting tired of karma fortunes by now.
 
Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
Quote:
Originally Posted by kovidgoyal View Post
If all you want to do is get calibre to recognize djvu files in the library folders that are named exactly the same as the PDF files, you can do that by running Library Maintenance and adding the detected extra formats.
Kovid

I actually tried that as the first method but it did not work. It showed the additional formats but there was no way to select anything to "fix". No checkbox if I remember correctly.

Last edited by loviedovie; 06-04-2015 at 01:43 PM.
loviedovie is offline   Reply With Quote
Old 06-16-2015, 10:29 PM   #28
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
... And back to the topic of parsing json in bash, it's pretty much impossible -- unless you use a tool like jshon. Obviously a proper programming language like python will be easier to work with -- but if you really want to do it with bash you can.

I have used jshon before, for parsing calibredb's output.
eschwartz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Manually tweak date (& time?) added? Snorkledorf Library Management 1 04-09-2014 09:37 AM
Manually add a TOC entry p3aul Sigil 4 06-13-2012 08:22 AM
Manually adding different formats of a book murali Calibre 4 12-02-2010 02:17 PM
Force Calibre not to add Page Breaks on H1 and H2 Tags jloakes Calibre 2 11-18-2010 04:08 PM
How can I add multiple formats (without converting) and have Calibre see them? strannik Calibre 4 02-03-2010 05:49 PM


All times are GMT -4. The time now is 05:09 AM.


MobileRead.com is a privately owned, operated and funded community.