![]() |
#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?
|
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,215
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
construct_path_name() and construct_file_name()
|
![]() |
![]() |
Advert | |
|
![]() |
#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) |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,215
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
db.library_path
|
![]() |
![]() |
![]() |
#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 | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,215
Karma: 27110894
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.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Book Title from filename | EricBr | Kindle Formats | 3 | 06-17-2012 10:43 PM |
Problem exporting book to device filename... | read365 | Library Management | 0 | 05-28-2012 05:39 AM |
How to change the way Calibre save book's filename? | vne | Calibre | 4 | 10-21-2010 12:41 PM |
Can't add files to library if the filename contain spaces | mduijkers | enTourage Archive | 8 | 09-19-2010 05:10 AM |
Request Library to sort by filename and have search capabilities | drwoood | enTourage Archive | 11 | 07-03-2010 06:09 PM |