Potentially cleanable Calibre JSON files
Here are a couple JSON files generated by Calibre which might potentially be cleanable. ~/Calibre Library/metadata_db_prefs_backup.json ~/.config/calibre/viewer.json
metadata_db_prefs_backup.json has "gui_view_history": [] which is a 2D array of the 15 most recently opened books using calibre — I had trouble getting command="json" working for this one.
viewer.json has "viewer_open_history": [] which is an array of the most recently opened books using calibre's ebook viewer (whether you opened the book from calibre itself or otherwise) — I didn't attempt cleaning this bit, it might be easy to do.
A couple other things worth mentioning: both Calibre and Calibre's ebook viewer have a button to clear the lists mentioned above, after doing so I'm left with:
"gui_view_history": [],
and
"viewer_open_history": []
So if the cleaner results like that, hopefully that means it's pretty safe, though I don't know if that's the only thing those built in "clear recent" functions do, and I haven't yet tested what happens if you clear the lists manually while Calibre or Calibre's ebook viewer are open — that might get messy.
And I'll mention this, but I don't think it's important: in "gui_view_history", the number which accompanies the name of each book is the order the book was imported to Calibre. Notice how Calibre Quick Start Guide has number one, that's because it was the first book imported (it comes with Calibre by default).
How about this?
action command="json" search="file" path="~/Calibre Library/metadata_db_prefs_backup.json" address="gui_view_history"
action command="json" search="file" path="~/.config/calibre/viewer.json" address="viewer_open_history"
The one for "viewer_open_history" is working, but the "gui_view_history" one isn't changing metadata_db_prefs_backup.json at all.
It is working here.
First, make sure Calibre is completely closed. (See pull request #92--perhaps you could add the same for Linux.)
Second, do you see a line like this in the BleachBit log?
Clean file 4.1kB /home/user/Calibre Library/metadata_db_prefs_backup.json
Derp derp, my mistake, I forgot my Calibre library wasn't in the default location ><. A significat number of Calibre users may not use the default location either. It looks like the library location information is primarily stored in ~/.config/calibre/global.py e.g.
# library path
# Path to directory in which your library of books is stored
library_path = u'/home/hololinuxmint/Calibre Library'
Do we have a way of parsing that information to find a custom located library? If not, it might be a good idea to add a warning letting people know that their library needs to be in the default location "~/Calibre Library" for those options to work.
This might warrent opening a new issue, but I'll ask here first. So the recents list for Calibre's ebook viewer is being cleared fine, but that's still not the case with Calibre's recents list even though the JSON files are being cleared fine. This is because the metadata_db_prefs_backup.json file is what it sounds like, that file is just a backup of what's in ~/Calibre Library/metadata.db. The real recents list is in that db on the preferences table, with the key gui_view_history and a val being the same 2D array in the JSON file (pics). Do we have a way of clearing that data?
As for the running check, I'll look into that after #92 is merged so as to avoid a merge conflict.
I can say that my library is NOT in the default location and I really think the default is pretty much a bad idea (just my opinion) because your user profile can blow up in size signifcantly.
The possiblity to parse (text) file content would help in this case and there will be "a lot" more cases this feature could help.