mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-20 12:56:30 +01:00
Add a function to return the current library name
This commit is contained in:
parent
e961004b11
commit
d0ab0d6fce
1 changed files with 9 additions and 0 deletions
|
|
@ -61,4 +61,13 @@ def randstr(length):
|
|||
print 'Time per record:', t/float(num_of_records)
|
||||
# }}}
|
||||
|
||||
def current_library_name():
|
||||
from calibre.utils.config import prefs
|
||||
import posixpath
|
||||
path = prefs['library_path']
|
||||
if path:
|
||||
path = path.replace('\\', '/')
|
||||
while path.endswith('/'):
|
||||
path = path[:-1]
|
||||
return posixpath.basename(path)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue