08-10-2012, 07:52 PM | #1 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Convert Book ID to Library filename
Is there a function that I can call that takes a Book ID as input and returns the generic filename of the book, (i.e. no extension), without the full library path?
|
08-11-2012, 12:01 AM | #2 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
construct_path_name() and construct_file_name()
|
Advert | |
|
08-14-2012, 09:21 PM | #3 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
construct_file_name() returned exactly what I expected but construct_path_name() returned a folder path relative to the library. Is there anyway to return the full OS path to the library folder?
For example: C:\Folders\Books\Main\Dickens, Charles\The Pickwick Papers (168) |
08-15-2012, 12:49 AM | #4 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
db.library_path
|
08-15-2012, 09:44 AM | #5 |
Guru
Posts: 776
Karma: 2751519
Join Date: Jul 2010
Location: UK
Device: PW2, Nexus7
|
Thanks, that completes the set!
All 3 of these work without me adding any extra import statements to the plugin. How do I know when an import is required or not? Do I just try first without and see if it fails? For example, in the same plugin I have "from calibre.ebooks.metadata.meta import get_metadata" and this one is necessary for use of get_metadata. |
Advert | |
|
08-15-2012, 10:49 AM | #6 |
creator of calibre
Posts: 44,546
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
import statements add names to the current namespace. If the name is already present, like db then you dont need to import it.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Book Title from filename | EricBr | Kindle Formats | 3 | 06-17-2012 11:43 PM |
Problem exporting book to device filename... | read365 | Library Management | 0 | 05-28-2012 06:39 AM |
How to change the way Calibre save book's filename? | vne | Calibre | 4 | 10-21-2010 01:41 PM |
Can't add files to library if the filename contain spaces | mduijkers | enTourage Archive | 8 | 09-19-2010 06:10 AM |
Request Library to sort by filename and have search capabilities | drwoood | enTourage Archive | 11 | 07-03-2010 07:09 PM |