mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-30 21:41:57 -04:00
Possible fix for #291
This commit is contained in:
parent
627dd5f315
commit
8d981077b7
@ -1084,6 +1084,8 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
self.conn.commit()
|
||||
|
||||
def export_to_dir(self, dir, indices, byauthor=False):
|
||||
if not os.path.exists(dir):
|
||||
raise IOError('Target directory does not exist: '+dir)
|
||||
by_author = {}
|
||||
for index in indices:
|
||||
id = self.id(index)
|
||||
@ -1110,9 +1112,11 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
||||
for fmt in self.formats(idx).split(','):
|
||||
data = self.format(idx, fmt)
|
||||
name = au + ' - ' + title if byauthor else title + ' - ' + au
|
||||
f = open(os.path.join(tpath, name +'_'+id+'.'+fmt.lower()), 'wb')
|
||||
fname = name +'_'+id+'.'+fmt.lower()
|
||||
f = open(os.path.join(tpath, fname.replace(os.sep, '_')), 'wb')
|
||||
f.write(data)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
db = LibraryDatabase('/home/kovid/library1.db')
|
||||
|
Loading…
x
Reference in New Issue
Block a user