Another semi-automatic solution for you to get around this error:
- Choose all the books you want, and use calibre gui to convert to text.
- Modify the Action Chain code to use the text file created by calibre conversion. (I can help with that if you don't know to do it)
- Delete all the converted text files using calibre's "remove format" option.
Edit: You can make a chain of all the above steps. Make sure to check the option to wait for ongoing jobs in the "Calibre Actions" settings dialog.
Edit2: Chain attached below.
There are two things to take into consideration while using this chain
- The chain is interactive because the convert step will pop up a dialog asking you for input. Make sure you select the output format to be text.
- Warning: that this chain will delete all (selected) text formats even pre-exsiting ones. If you don't want this remove the last action from the chain and manually delete the text files instead
Edit3: For anyone else who wants to test this, you must make a dictionary of tags and corresponding regular expressions in the format illustrated below (This is the format chosen by OP in his original code).
Code:
{
"case_sensitive_tag": "case_sensitive_tag",
"science-fiction": "(?i)science.?fiction",
"non-fiction": "(?i)non.?fiction"
}
The location of dictionary is controlled by a variable in the first action withing the chain. You have to change the variable to the location of your dictionary.