View Single Post
Old 08-24-2012, 01:23 PM   #18
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
Quote:
Originally Posted by BetterRed View Post
Good on yer cobber, happy to test when its ready
A beta version of my plugin is now ready for testing. (I'm not sure if it should be posted in this thread or in the development forum).

The plugin is called Book Links. It has a shortcut key of Ctrl+L and has two required custom settings.


Custom Settings

(1) The filetype (= extension) to use for the links file for each book.

The same extension must be used for each link file within the library, and must be selected from supported calibre book file types. I have further restricted this to: lrf, lit, rar, rtf and txt. Choose a format which you do not use for books.

The link file is created in the library in the same folder as the book, with the same naming scheme. This ensures that calibre manages the file during library operations, (e.g. copy). This file is NOT a book. I tried non-book extensions but calibre is not aware of them, so they get lost if a book is moved to a different library.

(2) The root folder for supplementary folders.

This is used so that the structure can be relocated easily without the need to edit every book link file.

Example: C:\Folders\Books\Supp

When the custom settings are saved the plugin creates a file called booklinks.ext, (where ext is the filetype chosen in (1) above), in this root folder. This is a template for the per-book links file which gets added to the library.


Links File

The links file for each book contains two links: one for a local folder and one for a web page. The local folder is relative to the root folder defined in (2) above, so the full path to the supplementary folder is formed by adding the local folder to the root.

Example: Local Folder = Hobbit

With the root shown in (2) above, the supplementary folder would be:

C:\Folders\Books\Supp\Hobbit

No matter what extenstion is chosen in (1) the links file is always a plain text file and can be inspected with any text editor.


Plugin Buttons

Open Local Folder opens the book's supplementary folder.

Open Web Page opens the web link associated with the book, (if one is defined.)

Edit Book Links opens a dialog to allow the book's links to be edited.

Update Link File saves changes to the links.


Beta Notes

a) I have only been able to test it on Windows 7.
b) The booklinks.ext template file may be better stored in the calibre configuration folder, I'm not sure.
c) The icon is very basic.
d) Comments are absent from this version.
e) There may be redundant code.

Any questions/suggestions/comments are welcome.


As with any plugin, you should inspect the code to make sure that it contains no malware since the Python language provides full access to folders/files etc. on your computer.
Attached Files
File Type: zip ag_booklinks.zip (5.2 KB, 239 views)

Last edited by Agama; 08-24-2012 at 01:33 PM. Reason: Text formatting
Agama is offline   Reply With Quote