View Single Post
Old 10-07-2010, 11:38 AM   #5
chaley
"chaley", not "charley"
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: 5,422
Karma: 821648
Join Date: Jan 2010
Location: France
Device: Many android devices
The next release has a new command-line function: calibredb list_categories

Documentation:
Spoiler:
calibre_development>calibredb list_categories --help
Usage: calibredb.exe list_categories [options]

Produce a report of the category information in the database. The
information is the equivalent of what is shown in the tags pane.


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

-i, --item_count Output only the number of items in a category instead
of the counts per item within the category

-c, --csv Output in CSV

-q QUOTE, --quote=QUOTE
The character to put around the category value in CSV
mode. Default is quotes (").

-r REPORT, --categories=REPORT
Comma-separated list of category lookup names.
Default: all

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

-s SEPARATOR, --separator=SEPARATOR
The string used to separate fields in CSV mode.
Default is a comma.


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>


Sample output: calibredb list_categories -i
Spoiler:
> calibredb list_categories -i
Code:
category  tag_name       count rating
authors   CATEGORY ITEMS 17    0.0
formats   CATEGORY ITEMS 6     0.0
news      CATEGORY ITEMS 2     0.0
publisher CATEGORY ITEMS 10    0.0
rating    CATEGORY ITEMS 3     0.0
search    CATEGORY ITEMS 4     0.0
#series   CATEGORY ITEMS 1     0.0
series    CATEGORY ITEMS 3     0.0
tags      CATEGORY ITEMS 30    0.0
#text     CATEGORY ITEMS 2     0.0
#textmult CATEGORY ITEMS 1     0.0
#tool     CATEGORY ITEMS 1     0.0


Sample output: calibredb list_categories (edited)

Spoiler:
Code:
>calibredb list_categories
category  tag_name                                          count rating
authors   calibre                                           2     0
authors   Flint, Eric                                       2     2.0
authors   Rohmer, Sax                                       1     0
authors   Miguel de Cervantes Saavedra                      1     0
authors   Shakespeare, William, 1564-1616                   1     0
authors   Unknown                                           1     0
authors   Jules Verne                                       1     0
authors   Weber, David                                      1     0
formats   EPUB                                              20    0.0
formats   LRF                                               1     0.0
formats   MOBI                                              12    0.0
formats   RTF                                               1     0.0
formats   TXT                                               2     0.0
formats   ZIP                                               1     0.0
news      Dilbert                                           1     0.0
news      LeMonde.fr                                        1     0.0
publisher Ace Books                                         1     3.0
publisher Baen                                              3     2.0
publisher calibre                                           1     0
rating    2                                                 1     3.33333333333
rating    3                                                 1     3.33333333333
rating    5                                                 1     3.33333333333
#series   foo                                               2     0
series    1632                                              5     2.0
tags      a                                                 1     0
tags      Alternate history                                 2     0
tags      b                                                 1     0
tags      c                                                 1     0
tags      Classics                                          2     0
tags      d                                                 1     0
tags      Dilbert                                           1     0
tags      e                                                 1     0
tags      f                                                 1     0
tags      ffff1                                             1     0
tags      Knights and knighthood -- Spain -- Fiction        1     0
tags      LeMonde.fr                                        1     0
tags      Mystery                                           1     0
tags      News                                              2     0
tags      PBook                                             7     0
tags      Picaresque literature                             1     0
tags      Romances                                          1     0
tags      Science Fiction                                   10    4.0
tags      Spain -- Social life and customs -- 16th century  1     0
          -- Fiction
#text     foo                                               2     0
#text     zzz                                               1     2.0
#textmult foo                                               2     0
#tool     asdas                                             1     2.0
chaley is offline   Reply With Quote