View Single Post
Old 04-01-2023, 03:30 PM   #553
isarl
Addict
isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.isarl ought to be getting tired of karma fortunes by now.
 
Posts: 290
Karma: 2534928
Join Date: Nov 2022
Location: Canada
Device: Kobo Aura 2
Quote:
Originally Posted by ownedbycats View Post
It works

Btw, what should I put for "My Books" in the url when there's a space?
After a little more experimentation, and if you are wiling to use Python templates in Calibre, then the standard library function urllib.parse.quote() may be of use to you – here's an example Python template which uses this function to correctly encode a string in the manner I described above:

Code:
python:
def evaluate(book, context):
  import urllib.parse
  return urllib.parse.quote(book.title)
Example output:

Quote:
To%20Say%20Nothing%20of%20the%20Dog
The%20Poppy%20War
The%20Fifth%20Season
(At first I thought the Calibre template function to_hex() might be useful, but it hex-encodes the entire string, and without the “%” character. Not really what we want here.)
isarl is offline   Reply With Quote