File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -165,8 +165,25 @@ kobodl book get \
165165 --output-dir /path/to/download_directory \
166166 --format-str ' {Title}' \
167167 --get-all
168+
169+ # Download books organized into subdirectories by author
170+ kobodl book get \
171+ --output-dir /path/to/library \
172+ --format-str ' {Author}/{Title}' \
173+ --get-all
168174```
169175
176+ ### Format string options
177+
178+ The ` --format-str ` option supports the following fields:
179+ - ` {Author} ` - Book author(s)
180+ - ` {Title} ` - Book title
181+ - ` {ShortRevisionId} ` - First 8 characters of the revision ID (useful for avoiding filename collisions)
182+
183+ You can use ` / ` in the format string to organize books into subdirectories. For example:
184+ - ` '{Author}/{Title}' ` creates ` Author Name/Book Title.epub `
185+ - ` '{Author} - {Title} {ShortRevisionId}' ` creates ` Author Name - Book Title a1b2c3d4.epub ` (default)
186+
170187Running the web UI
171188
172189``` bash
Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ def GetBookOrBooks(
266266
267267 try :
268268 click .echo (f'Downloading { currentProductId } to { outputFilePath } ' , err = True )
269+ os .makedirs (os .path .dirname (outputFilePath ), exist_ok = True )
269270 kobo .Download (bookMetadata , book_type == BookType .AUDIOBOOK , outputFilePath )
270271 except Exception as e :
271272 if productId :
Original file line number Diff line number Diff line change @@ -43,7 +43,12 @@ def book():
4343 '--format-str' ,
4444 type = click .STRING ,
4545 default = r'{Author} - {Title} {ShortRevisionId}' ,
46- help = r"default: '{Author} - {Title} {ShortRevisionId}'" ,
46+ help = (
47+ "Format string for output filename. "
48+ "Available fields: {Author}, {Title}, {ShortRevisionId}. "
49+ "Use '/' to create subdirectories (e.g., '{Author}/{Title}'). "
50+ "Default: '{Author} - {Title} {ShortRevisionId}'"
51+ ),
4752)
4853@click .argument ('product-id' , nargs = - 1 , type = click .STRING )
4954@click .pass_obj
You can’t perform that action at this time.
0 commit comments