I use a custom column called Original Filename, that I store the original filename of Amazon books, so theinfo is always linked and I can simply overwrite the book from calibre without problems.
X-Ray, as well as APNX, EndActions, annotations/bookmarks, etc. are all located in the appropriately named file within the {/ondevice/path/to/book}.sdr folder, and the path must match up.
The following save to device template will use the default save path (actually, I do cut the authors field short after the first author), but only if the field "#file" (seen as Original Filename) is empty. If "#field" has something in it, in other words an original filename, it uses that instead:
Code:
program: ifempty(field('#file'), template('[[author_sort:sublist(0,1,&)]]/[[title]] - [[authors:sublist(0,1,&)]]'))
You can also rename the folder+file combinations to move the .sdr folders to match up with where calibre puts the book.
I want a plugin that will let you use these files, saved in calibre, by sending them automatically, but I will most likely have to write it myself one of these days.