Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 11-20-2012, 06:13 AM   #16
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Matsendrasana View Post
Maybe I have not made clear what I try to accomplish: I do not want to add another format, and did not asked for detailed command-lines. I just want to replace a present book in the same format because its source (LibreOffice, Asciidoc etc.) has changed.
As far as I can tell you really do want to replace the format, not add a book. The add_format command does that. Why do you want add a new book if the source file has changed instead of replacing the file in the existing book?

As for the ID, I assume that the book has some known attribute that you can use to match the book. If that attribute is title, then the following command provides trivially parsable output
Code:
calibredb list -f uuid -s "title:\"=the first lensman\""

Last edited by chaley; 11-21-2012 at 04:54 AM. Reason: add missing calibredb command
chaley is offline   Reply With Quote
Old 11-20-2012, 06:14 AM   #17
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: 43,835
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It really isn't that hard.

Code:
title=`ebook-meta file.mobi | grep '^Title' | head -n1 | cut -d: -f 2`
id=`calibredb list --separator : --fields title | grep "$title" | cut -d: -f1`
calibredb add_format $id file.mobi
kovidgoyal is online now   Reply With Quote
Advert
Old 11-21-2012, 03:26 AM   #18
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: 20,544
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
@Matsendrasana - Assuming the number of replacements you want to do at any given time is small, then why not drag/drop the replacement files from your editing location into the the Book Details panel of the relevant book.

I do it frequently for RTF, PDF, EPUB, MOBI & PRC formats - the new files replace the old files in the relevant "library/author/title (id)" directory. You can also drag/drop replacements into the Edit Metadata Formats box.

I found it by suck it and see, it doesn't seem to be documented - Managing book formats has - "You can add a new format, delete an existing format and also ask calibre to set the metadata ..."

I hope its not a bug - I'd be lost without it

BR
BetterRed is offline   Reply With Quote
Old 11-21-2012, 04:46 AM   #19
Matsendrasana
Member
Matsendrasana began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Nov 2012
Device: none
Quote:
Originally Posted by BetterRed View Post
@Matsendrasana - Assuming the number of replacements you want to do at any given time is small, then why not drag/drop the replacement files from your editing location into the the Book Details panel of the relevant book.
I'm a (lazy) programmer. Why repeat it when you can automate it?
Since I do not update the library each time a source has been edited, but maybe just at the end of the day or the week, a script is safer.

@kovidgoyal: Thank you! The --separator : --fields title options are the solution! I wasn't aware of them. Although I use the newest Calibre:
Code:
$ calibredb --version
calibredb.exe (calibre 0.9.6)
-h only shows the options --version, -h and --help. With --separator and --fields the rest indeed is easy. Maybe I should have read the online manual more carefully.
Matsendrasana is offline   Reply With Quote
Old 11-21-2012, 05:00 AM   #20
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,731
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Matsendrasana View Post
@kovidgoyal: Thank you! The --separator : --fields title options are the solution! I wasn't aware of them. Although I use the newest Calibre:
Code:
$ calibredb --version
calibredb.exe (calibre 0.9.6)
-h only shows the options --version, -h and --help. With --separator and --fields the rest indeed is easy. Maybe I should have read the online manual more carefully.
That is why Kovid said in post #11 to use
Code:
calibredb list -h
If you run that command you see all the options, as shown under the spoiler.
Spoiler:
Code:
C:>calibredb list -h
Usage: calibredb.exe list [options]

List the books available in the calibre database.


Whenever you pass arguments to calibredb.exe that have spaces in them, enclose the arguments in quotation marks

Options:
  --version             show program's version number and exit

  -h, --help            show this help message and exit

  -f FIELDS, --fields=FIELDS
                        The fields to display when listing books in the
                        database. Should be a comma separated list of fields.
                        Available fields: *authtest,*comment,*comment2,*commen
                        t3,*comp2,*comp3,*comp4,*comp5,*comp_2,*composite,*del
                        ete,*deleteme,*enum,*enum2,*genre,*isbn,*mybool,*myboo
                        l2,*mydate,*myfloat,*myint,*myint2,*myrating,*people,*
                        s_dex,*series,*series_index,*text,*textmult,*tool,auth
                        or_sort,authors,comments,cover,formats,identifiers,isb
                        n,last_modified,pubdate,publisher,rating,series,series
                        _index,size,tags,timestamp,title,uuid
                        Default: title,authors. The special field "all" can be
                        used to select all fields. Only has effect in the text
                        output format.

  --sort-by=SORT_BY     The field by which to sort the results.
                        Available fields: publisher,series_index,formats,isbn,
                        uuid,pubdate,rating,series,timestamp,author_sort,cover
                        ,comments,identifiers,last_modified,authors,title,tags
                        ,size
                        Default: none

  --ascending           Sort results in ascending order

  -s SEARCH, --search=SEARCH
                        Filter the results by the search query. For the format
                        of the search query, please see the search related
                        documentation in the User Manual. Default is to do no
                        filtering.

  -w LINE_WIDTH, --line-width=LINE_WIDTH
                        The maximum width of a single line in the output.
                        Defaults to detecting screen size.

  --separator=SEPARATOR
                        The string used to separate fields. Default is a
                        space.

  --prefix=PREFIX       The prefix for all file paths. Default is the absolute
                        path to the library folder.


  GLOBAL OPTIONS:
    --library-path=LIBRARY_PATH, --with-library=LIBRARY_PATH
                        Path to the calibre library. Default is to use the
                        path stored in the settings.


Created by Kovid Goyal <kovid@kovidgoyal.net>
chaley is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestion: change default library folder location so it's backed up by Win7 Backup robcohen Devices 2 02-24-2012 01:50 AM
Can I change library folder names? lizzielou Library Management 2 01-23-2012 11:49 AM
Moving library folder outside calibre - than change within. myle00 Calibre 6 08-16-2011 07:08 AM
Want to change folder structure or file names in the Calibre library? Manichean Library Management 0 01-30-2011 10:51 AM
Change the folder where News are sent Walkmancho Calibre 0 07-07-2010 01:22 AM


All times are GMT -4. The time now is 04:10 AM.


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