mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-29 13:32:59 +02:00
version 0.4.7. Fix nasty bug in metadata handling.
This commit is contained in:
parent
43300a23f2
commit
96415015a6
4 changed files with 12 additions and 9 deletions
|
|
@ -13,7 +13,7 @@
|
|||
## with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
''' E-book management software'''
|
||||
__version__ = "0.4.6"
|
||||
__version__ = "0.4.7"
|
||||
__docformat__ = "epytext"
|
||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
__appname__ = 'libprs500'
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ def __init__(self, title, authors):
|
|||
def __str__(self):
|
||||
ans = ''
|
||||
ans += 'Title : ' + str(self.title) + '\n'
|
||||
ans += 'Author : ' + ', '.join(self.authors) + '\n'
|
||||
ans += 'Author : ' + (', '.join(self.authors) if self.authors is not None else 'None') + '\n'
|
||||
ans += 'Category: ' + str(self.category) + '\n'
|
||||
ans += 'Comments: ' + str(self.comments) + '\n'
|
||||
return ans.strip()
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ def add_books(self, checked):
|
|||
def _add_books(self, paths, to_device):
|
||||
on_card = False if self.stack.currentIndex() != 2 else True
|
||||
# Get format and metadata information
|
||||
formats, metadata, names, infos = [], [], [], []
|
||||
formats, metadata, names, infos = [], [], [], []
|
||||
for book in paths:
|
||||
format = os.path.splitext(book)[1]
|
||||
format = format[1:] if format else None
|
||||
|
|
@ -281,7 +281,7 @@ def _add_books(self, paths, to_device):
|
|||
metadata.append(mi)
|
||||
names.append(os.path.basename(book))
|
||||
if not mi.authors:
|
||||
mi.authors = 'Unknown'
|
||||
mi.authors = ['Unknown']
|
||||
infos.append({'title':mi.title, 'authors':', '.join(mi.authors),
|
||||
'cover':self.default_thumbnail, 'tags':[]})
|
||||
|
||||
|
|
|
|||
|
|
@ -891,15 +891,18 @@ def set_tags(self, id, tags, append=False):
|
|||
'''
|
||||
if not append:
|
||||
self.conn.execute('DELETE FROM books_tags_link WHERE book=?', (id,))
|
||||
tag = set(tags)
|
||||
for tag in tags:
|
||||
t = self.conn.execute('SELECT id from tags WHERE name=?', (tag,)).fetchone()
|
||||
for tag in set(tags):
|
||||
tag = tag.strip()
|
||||
if not tag:
|
||||
continue
|
||||
t = self.conn.execute('SELECT id FROM tags WHERE name=?', (tag,)).fetchone()
|
||||
if t:
|
||||
tid = t[0]
|
||||
else:
|
||||
tid = self.conn.execute('INSERT INTO tags(name) VALUES(?)', (tag,)).lastrowid
|
||||
if (append and not self.conn.execute('SELECT book FROM books_tags_link WHERE book=? AND tag=?',
|
||||
(id, tid)).fetchone()) or not append:
|
||||
|
||||
if not self.conn.execute('SELECT book FROM books_tags_link WHERE book=? AND tag=?',
|
||||
(id, tid)).fetchone():
|
||||
self.conn.execute('INSERT INTO books_tags_link(book, tag) VALUES (?,?)',
|
||||
(id, tid))
|
||||
self.conn.commit()
|
||||
|
|
|
|||
Loading…
Reference in a new issue